KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > clipbuilder > html > bean > UrlBean


1 package org.jahia.clipbuilder.html.bean;
2
3 import java.net.*;
4 import java.util.*;
5
6 import org.jahia.clipbuilder.html.util.*;
7 import org.jahia.clipbuilder.html.web.Constant.*;
8 import org.jahia.clipbuilder.html.web.html.*;
9
10 /**
11  * Bean represent an Url
12  *
13  *@author Tlili Khaled
14  */

15 public class UrlBean extends Bean {
16     private ClipperBean clipperBean;
17     private String JavaDoc relativeUrl;
18     private URL baseURL;
19     private URL redirectUrl;
20
21     private HTMLDocument document;
22     private int position;
23     private Hashtable formHasthable = new Hashtable();
24     private List queryParamBeanList = new ArrayList();
25     private String JavaDoc from = "";
26     private String JavaDoc hash = "";
27     private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(UrlBean.class);
28
29
30     /**
31      * Constructor for the UrlBean object
32      *
33      *@param cBean Description of Parameter
34      *@param baseURL Description of Parameter
35      *@param relativeUrl Description of Parameter
36      *@param queryParamMap Description of Parameter
37      *@param from Description of Parameter
38      *@param hash Description of Parameter
39      */

40     public UrlBean(ClipperBean cBean, URL baseURL, String JavaDoc relativeUrl, Map queryParamMap, String JavaDoc from, String JavaDoc hash) {
41         setBaseURL(baseURL);
42         setRelativeUrl(relativeUrl);
43         setRedirectUrl(baseURL);
44         setClipperBean(cBean);
45         setQueryParamListFromMap(queryParamMap);
46         setFrom(from);
47         setHash(hash);
48     }
49
50
51     /**
52      * Constructor for the UrlBean object
53      *
54      *@param cBean Description of Parameter
55      *@param baseURL Description of Parameter
56      *@param relativeUrl Description of Parameter
57      *@param queryParamMap Description of Parameter
58      *@param from Description of Parameter
59      *@param hash Description of Parameter
60      */

61     public UrlBean(ClipperBean cBean, String JavaDoc baseURL, String JavaDoc relativeUrl, Map queryParamMap, String JavaDoc from, String JavaDoc hash) {
62         this(cBean, URLUtilities.getURL(baseURL), relativeUrl, queryParamMap, from, hash);
63
64     }
65
66
67
68     /**
69      * Sets the Position attribute of the UrlBean object
70      *
71      *@param position The new Position value
72      */

73     public void setPosition(int position) {
74         this.position = position;
75     }
76
77
78     /**
79      * Sets the Document attribute of the UrlBean object
80      *
81      *@param document The new Document value
82      */

83     public void setDocument(HTMLDocument document) {
84         this.document = document;
85     }
86
87
88     /**
89      * Sets the QueryParamBeanList attribute of the UrlBean object
90      *
91      *@param queryParamBeanList The new QueryParamBeanList value
92      */

93     public void setQueryParamBeanList(List queryParamBeanList) {
94         this.queryParamBeanList = queryParamBeanList;
95     }
96
97
98     /**
99      * Sets the ClipperBean attribute of the UrlBean object
100      *
101      *@param clipperBean The new ClipperBean value
102      */

103     public void setClipperBean(ClipperBean clipperBean) {
104         this.clipperBean = clipperBean;
105     }
106
107
108     /**
109      * Sets the RedirectUrl attribute of the UrlBean object
110      *
111      *@param redirectUrl The new RedirectUrl value
112      */

113     public void setRedirectUrl(URL redirectUrl) {
114         this.redirectUrl = redirectUrl;
115     }
116
117
118     /**
119      * Sets the From attribute of the UrlBean object
120      *
121      *@param from The new From value
122      */

123     public void setFrom(String JavaDoc from) {
124         this.from = from;
125     }
126
127
128     /**
129      * Sets the Hash attribute of the UrlBean object
130      *
131      *@param hash The new Hash value
132      */

133     public void setHash(String JavaDoc hash) {
134         this.hash = hash;
135     }
136
137
138     /**
139      * Sets the RelativeUrl attribute of the UrlBean object
140      *
141      *@param relativeUrl The new RelativeUrl value
142      */

143     public void setRelativeUrl(String JavaDoc relativeUrl) {
144         this.relativeUrl = relativeUrl;
145     }
146
147
148     /**
149      * Sets the Url attribute of the UrlBean object
150      *
151      *@param url The new Url value
152      */

153     public void setBaseURL(URL url) {
154         this.baseURL = url;
155     }
156
157
158     /**
159      * Sets the MappingFormParam attribute of the UrlBean object
160      *
161      *@param formParentName The new MappingFormParam value
162      *@param formParentId The new MappingFormParam value
163      *@param formParentPos The new MappingFormParam value
164      *@param name The new MappingFormParam value
165      *@param mapping The new MappingFormParam value
166      *@param paramPosition The new MappingFormParam value
167      */

168     public void setMappingFormParam(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc name, String JavaDoc mapping, int paramPosition) {
169         getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, name, paramPosition).setMapping(mapping);
170     }
171
172
173     /**
174      * Sets the AllDefaultParamValue attribute of the UrlBean object
175      *
176      *@param paramDefaultValue The new AllDefaultParamValue value
177      */

178     public void setQueryParamListFromMap(Map paramDefaultValue) {
179         Iterator i = paramDefaultValue.keySet().iterator();
180
181         // reset the query param list
182
//setQueryParamBeanList(new ArrayList());
183

184         while (i.hasNext()) {
185             String JavaDoc name = (String JavaDoc) i.next();
186             String JavaDoc defaultValueNameTab[] = ((String JavaDoc[]) paramDefaultValue.get(name));
187             for (int queryParamPos = 0; queryParamPos < defaultValueNameTab.length; queryParamPos++) {
188                 String JavaDoc defaultValue = ((String JavaDoc[]) paramDefaultValue.get(name))[queryParamPos];
189                 addQueryParameter(name, defaultValue, queryParamPos);
190                 logger.debug("[Parameter whith name=" + name + " setted whith default value " + defaultValue + " ]");
191             }
192         }
193     }
194
195
196     /**
197      * Sets the UrlValue attribute of the UrlBean object
198      *
199      *@param url The new UrlValue value
200      */

201     public void setBaseUrl(String JavaDoc url) {
202         this.setBaseURL(URLUtilities.getURL(url));
203     }
204
205
206
207     /**
208      * Sets the FormParameterValue attribute of the UrlBean object
209      *
210      *@param formParentName The new FormParameterValue value
211      *@param formParentId The new FormParameterValue value
212      *@param formParentPos The new FormParameterValue value
213      *@param param The new FormParameterValue value
214      *@param possibleValue The new FormParameterValue value
215      *@param type The new FormParameterValue value
216      *@param visibility The new FormParameterValue value
217      *@param paramPosition The new FormParameterValue value
218      *@return Description of the Returned Value
219      */

220     public FormParamBean setFormParameterValue(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc param, String JavaDoc possibleValue, String JavaDoc type, String JavaDoc visibility, int paramPosition) {
221         FormParamBean bean = getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, param, paramPosition);
222         if (bean != null) {
223             logger.debug("[ set used value for " + param + ": " + possibleValue + "]");
224             bean.setUsedValue(possibleValue);
225         }
226         else {
227             logger.warn("[ FormBean not found " + param + "," + formParentName + "," + type + " ]");
228             logger.warn("[ If it's the test mode, it's an ERROR !!!!!]");
229         }
230         return bean;
231     }
232
233
234     /**
235      * Gets the BaseUrlValue attribute of the UrlBean object
236      *
237      *@return The BaseUrlValue value
238      */

239     public String JavaDoc getBaseUrlValue() {
240         return getBaseURL().toExternalForm();
241     }
242
243
244     /**
245      * Gets the BaseURL attribute of the UrlBean object
246      *
247      *@return The BaseURL value
248      */

249     public URL getBaseURL() {
250         return this.baseURL;
251     }
252
253
254     /**
255      * Gets the QueryParamsMap attribute of the UrlBean object
256      *
257      *@return The QueryParamsMap value
258      */

259     public Map getQueryParamsMap() {
260         Map queryParams = new TreeMap();
261         for (int j = 0; j < this.getQueryParamBeanList().size(); j++) {
262             QueryParamBean qBean = (QueryParamBean) getQueryParamBeanList().get(j);
263             String JavaDoc name = qBean.getName();
264             String JavaDoc[] value = {qBean.getDefaultValue()};
265             queryParams.put(name, value);
266         }
267         return queryParams;
268     }
269
270
271     /**
272      * Gets the Url attribute of the UrlBean object
273      *
274      *@return The Url value
275      */

276     public String JavaDoc getAbsoluteUrlValue() {
277         return getAbsoluteURL().toExternalForm();
278     }
279
280
281
282     /**
283      * Gets the ParamBeanList attribute of the UrlBean object
284      *
285      *@param formParentHash Description of Parameter
286      *@return The ParamBeanList value
287      */

288     public List getFormParamBeanListByFormParentHash(String JavaDoc formParentHash) {
289         List l = (List) formHasthable.get(formParentHash);
290         if (l == null) {
291             Iterator key = formHasthable.keySet().iterator();
292             while (key.hasNext()) {
293                 String JavaDoc value = key.next().toString();
294                 logger.debug("Found form hash: " + value);
295             }
296
297             l = new ArrayList();
298             formHasthable.put(formParentHash, l);
299         }
300         return l;
301     }
302
303
304
305     /**
306      * Gets the FormParamBeanList attribute of the UrlBean object
307      *
308      *@return The FormParamBeanList value
309      */

310     public List getFormParamBeanList() {
311         Iterator it = formHasthable.values().iterator();
312         ArrayList allFormParam = new ArrayList();
313         while (it.hasNext()) {
314             List l = (List) it.next();
315             for (int j = 0; j < l.size(); j++) {
316                 allFormParam.add(l.get(j));
317             }
318
319         }
320         return allFormParam;
321     }
322
323
324
325     /**
326      * Gets the QueryParamBeanList attribute of the UrlBean object
327      *
328      *@return The QueryParamBeanList value
329      */

330     public List getQueryParamBeanList() {
331         return queryParamBeanList;
332     }
333
334
335     /**
336      * Gets the Position attribute of the UrlBean object
337      *
338      *@return The Position value
339      */

340     public int getPosition() {
341         return position;
342     }
343
344
345     /**
346      * Gets the Document attribute of the UrlBean object
347      *
348      *@return The Document value
349      */

350     public HTMLDocument getDocument() {
351         return document;
352     }
353
354
355     /**
356      * Gets the ClipperBean attribute of the UrlBean object
357      *
358      *@return The ClipperBean value
359      */

360     public ClipperBean getClipperBean() {
361         return clipperBean;
362     }
363
364
365     /**
366      * Gets the RedirectUrl attribute of the UrlBean object
367      *
368      *@return The RedirectUrl value
369      */

370     public URL getRedirectUrl() {
371         return redirectUrl;
372     }
373
374
375     /**
376      * Gets the From attribute of the UrlBean object
377      *
378      *@return The From value
379      */

380     public String JavaDoc getFrom() {
381         return from;
382     }
383
384
385     /**
386      * Gets the LabelForStrut attribute of the UrlBean object
387      *
388      *@return The LabelForStrut value
389      */

390     public String JavaDoc getLabelForStrut() {
391         //return getPosition() + ": " + this.getAbsoluteURL();
392
return getAbsoluteUrlValue();
393     }
394
395
396
397     /**
398      * Gets the Hash attribute of the UrlBean object
399      *
400      *@return The Hash value
401      */

402     public String JavaDoc getHash() {
403         return hash;
404     }
405
406
407     /**
408      * Gets the RelativeUrl attribute of the UrlBean object
409      *
410      *@return The RelativeUrl value
411      */

412     public String JavaDoc getRelativeUrlValue() {
413         return relativeUrl;
414     }
415
416
417     /**
418      * Gets the Url attribute of the UrlBean object
419      *
420      *@return The Url value
421      */

422     public URL getAbsoluteURL() {
423         URL u = null;
424                 String JavaDoc relativeUrl = getRelativeUrlValue();
425                 if(relativeUrl == null){
426                     logger.error("Relative url is null !!");
427                 }
428         try {
429             if (URLUtilities.isRelatif(getRelativeUrlValue())) {
430                 u = URLUtilities.getAbsolutURL(getRedirectUrl(),getRelativeUrlValue());
431             }
432             else {
433                 u = URLUtilities.getURL(getRelativeUrlValue());
434             }
435         }
436         catch (MalformedURLException ex) {
437             ex.printStackTrace();
438             logger.error("Erro: Malformed URL");
439         }
440         finally {
441             return u;
442         }
443     }
444
445
446
447     /**
448      * Gets the ParamAllowedValue attribute of the UrlBean object
449      *
450      *@param formParentName Description of Parameter
451      *@param formParentId Description of Parameter
452      *@param formParentPos Description of Parameter
453      *@param paramName Description of Parameter
454      *@param paramPosition Description of Parameter
455      *@return The ParamAllowedValue value
456      */

457     public ArrayList getParamFormAllowedValueBeanList(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc paramName, int paramPosition) {
458         return this.getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, paramName, paramPosition).getListPossibleBeanValue();
459     }
460
461
462     /**
463      * Gets the ParamFormAllowedValueStringList attribute of the UrlBean object
464      *
465      *@param formParentName Description of Parameter
466      *@param formParentId Description of Parameter
467      *@param formParentPos Description of Parameter
468      *@param paramName Description of Parameter
469      *@param paramPosition Description of Parameter
470      *@return The ParamFormAllowedValueStringList value
471      */

472     public ArrayList getParamFormAllowedValueStringList(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc paramName, int paramPosition) {
473         return this.getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, paramName, paramPosition).getListPossibleStringValue();
474     }
475
476
477     /**
478      * Gets the ParameterMapping attribute of the UrlBean object
479      *
480      *@param formParentName Description of Parameter
481      *@param formParentId Description of Parameter
482      *@param formParentPos Description of Parameter
483      *@param paramName Description of Parameter
484      *@param paramPosition Description of Parameter
485      *@return The ParameterMapping value
486      */

487     public String JavaDoc getFormParameterMapping(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc paramName, int paramPosition) {
488         FormParamBean bean = getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, paramName, paramPosition);
489         return bean.getMapping();
490     }
491
492
493     /**
494      * Gets the ParamDefaultValue attribute of the UrlBean object
495      *
496      *@param param Description of Parameter
497      *@return The ParamDefaultValue value
498      */

499     public String JavaDoc getQueryParamDefaultValue(String JavaDoc param) {
500         logger.debug("[url " + getAbsoluteUrlValue() + ", queryParam: " + param + " ]");
501         QueryParamBean bean = getQueryParamBean(param);
502         return bean.getDefaultValue();
503     }
504
505
506     /**
507      * Gets the ParamType attribute of the UrlBean object
508      *
509      *@param formParentName Description of Parameter
510      *@param formParentId Description of Parameter
511      *@param formParentPos Description of Parameter
512      *@param paramName Description of Parameter
513      *@param paramPosition Description of Parameter
514      *@return The ParamType value
515      */

516     public String JavaDoc getFormParamType(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc paramName, int paramPosition) {
517         FormParamBean bean = getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, paramName, paramPosition);
518         return bean.getType();
519     }
520
521
522     /**
523      * Gets the FirtParamName attribute of the UrlBean object
524      *
525      *@return The FirtParamName value
526      */

527     public String JavaDoc getFirtParamName() {
528         String JavaDoc formName = (String JavaDoc) formHasthable.keySet().iterator().next();
529         if (getFormParamBeanListByFormParentHash(formName).isEmpty()) {
530             return "No param";
531         }
532         else {
533             return ((FormParamBean) getFormParamBeanListByFormParentHash(formName).get(0)).getName();
534         }
535     }
536
537
538
539     /**
540      * Gets the FormParamBeanByMapping attribute of the UrlBean object
541      *
542      *@param formParentName Description of Parameter
543      *@param mapping Description of Parameter
544      *@return The FormParamBeanByMapping value
545      */

546     public FormParamBean getFormParamBeanByMapping(String JavaDoc formParentName, String JavaDoc mapping) {
547         // find the FormParamBean object
548
List a = getFormParamBeanListByFormParentHash(formParentName);
549         FormParamBean paramAndValue = null;
550         for (int i = 0; i < a.size(); i++) {
551             paramAndValue = (FormParamBean) a.get(i);
552             if (paramAndValue.getMapping().equalsIgnoreCase(mapping)) {
553                 return paramAndValue;
554             }
555         }
556         logger.debug("[Form param Bean " + mapping + " not found]");
557         return null;
558     }
559
560
561     /**
562      * Gets the FormParamBean attribute of the UrlBean object
563      *
564      *@param formParentName Description of Parameter
565      *@param formParentId Description of Parameter
566      *@param formParentPos Description of Parameter
567      *@param name Description of Parameter
568      *@param paramPosition Description of Parameter
569      *@return The FormParamBean value
570      */

571     public FormParamBean getFormParamBeanByNameAndFormParentNameAndFormParentId(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc name, int paramPosition) {
572         // find the FormParamBean object
573
String JavaDoc formHash = HashUtilities.buildFormHash(formParentName, formParentId, formParentPos);
574         return getFormParamByNameAndFormParentHash(name, paramPosition, formHash);
575     }
576
577
578     /**
579      * Gets the FormParamByNameAndFormParentHash attribute of the UrlBean object
580      *
581      *@param name Description of Parameter
582      *@param paramPosition Description of Parameter
583      *@param formHash Description of Parameter
584      *@return The FormParamByNameAndFormParentHash value
585      */

586     public FormParamBean getFormParamByNameAndFormParentHash(String JavaDoc name, int paramPosition, String JavaDoc formHash) {
587         List a = getFormParamBeanListByFormParentHash(formHash);
588         if (a == null) {
589             logger.error("Form param List not found for form parent: " + formHash);
590         }
591         FormParamBean currentFormParam = null;
592         for (int i = 0; i < a.size(); i++) {
593             currentFormParam = (FormParamBean) a.get(i);
594             if (currentFormParam.getPosition() == paramPosition) {
595                 if (currentFormParam.getName().equalsIgnoreCase(name)) {
596                     return currentFormParam;
597                 }
598             }
599         }
600         logger.warn("[Form param Bean " + name + " not found: name=" + name + "," + "formHash=" + formHash + "]");
601         return null;
602     }
603
604
605     /**
606      * Gets the SubmittedParamBean attribute of the UrlBean object
607      *
608      *@param formParentHash Description of Parameter
609      *@return The SubmittedParamBean value
610      */

611     public FormParamBean getSubmittedParamBean(String JavaDoc formParentHash) {
612         List allFormParamBean = getFormParamBeanListByFormParentHash(formParentHash);
613         for (int i = 0; i < allFormParamBean.size(); i++) {
614             FormParamBean fBean = (FormParamBean) allFormParamBean.get(i);
615             String JavaDoc type = fBean.getType();
616             // if the button was clicked, then it's qBean is not'null
617
QueryParamBean qBean = fBean.getQueryParamBean();
618             if (qBean != null) {
619                 if (type.equalsIgnoreCase(WebConstants.TYPE_SUBMIT) || type.equalsIgnoreCase(WebConstants.TYPE_IMAGE) || type.equalsIgnoreCase(WebConstants.TYPE_RESET) || type.equalsIgnoreCase(WebConstants.TYPE_BUTTON)) {
620                     return fBean;
621                 }
622             }
623         }
624         return null;
625     }
626
627
628     /**
629      * Gets the NameInputSubmit attribute of the UrlBean object
630      *
631      *@param fromHash Description of Parameter
632      *@return The NameInputSubmit value
633      */

634     public String JavaDoc getNameInputSubmit(String JavaDoc fromHash) {
635         FormParamBean fBean = getSubmittedParamBean(fromHash);
636         if (fBean != null) {
637             logger.debug("Submit input found: " + fBean.getName());
638             return fBean.getName();
639         }
640         else {
641             logger.warn("Submit input nor found");
642             return null;
643         }
644     }
645
646
647     /**
648      * Description of the Method
649      */

650     public void clearParam() {
651         logger.debug("[ Clear param list ]");
652         /*
653          * this.formParamBeanList = new ArrayList();
654          * this.queryParamBeanList = new ArrayList();
655          */

656     }
657
658
659     /**
660      * Adds a feature to the Parameter attribute of the UrlBean object
661      *
662      *@param formParentName The feature to be added to the FormParameter
663      * attribute
664      *@param formParentId The feature to be added to the FormParameter
665      * attribute
666      *@param formParentPosition The feature to be added to the FormParameter
667      * attribute
668      *@param paramName The feature to be added to the FormParameter
669      * attribute
670      *@param possibleValue The feature to be added to the Parameter
671      * attribute
672      *@param type The feature to be added to the Parameter
673      * attribute
674      *@param visibility The feature to be added to the FormParameter
675      * attribute
676      *@param editable The feature to be added to the FormParameter
677      * attribute
678      *@param position The feature to be added to the FormParameter
679      * attribute
680      *@return Description of the Returned Value
681      */

682     public FormParamBean addFormParameter(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPosition, String JavaDoc paramName, String JavaDoc possibleValue, String JavaDoc type, String JavaDoc visibility, boolean editable, int position) {
683         String JavaDoc formParentHah = HashUtilities.buildFormHash(formParentName, formParentId, formParentPosition);
684
685         //handle the form whith multiple possible value
686
int pos = 0;
687         FormParamBean fBean = getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPosition, paramName, pos);
688         if (fBean != null && (type.equalsIgnoreCase(WebConstants.TYPE_RADIO) || type.equalsIgnoreCase(WebConstants.TYPE_SELECT))) {
689             logger.debug("[ Add possible value for " + paramName + " ]");
690             if (!editable) {
691                 logger.warn("[ Already recorded ]");
692             }
693             fBean.addPossibleValue(possibleValue);
694             return fBean;
695         }
696
697         // find the position of the parameter
698
while (fBean != null) {
699             pos++;
700             fBean = getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPosition, paramName, pos);
701         }
702         // buil a param bean whith the correct position
703
fBean = new FormParamBean(this, formParentName, formParentId, formParentPosition, paramName, type, possibleValue, visibility, pos);
704         getFormParamBeanListByFormParentHash(formParentHah).add(fBean);
705
706         return fBean;
707     }
708
709
710
711     /**
712      * Adds a feature to the FormParameter attribute of the UrlBean object
713      *
714      *@param formParentName The feature to be added to the FormParameter
715      * attribute
716      *@param formParentId The feature to be added to the FormParameter
717      * attribute
718      *@param formParentPosition The feature to be added to the FormParameter
719      * attribute
720      *@param param The feature to be added to the FormParameter
721      * attribute
722      *@param possibleValue The feature to be added to the FormParameter
723      * attribute
724      *@param type The feature to be added to the FormParameter
725      * attribute
726      *@param visibility The feature to be added to the FormParameter
727      * attribute
728      *@param paramPosition The feature to be added to the FormParameter
729      * attribute
730      *@return Description of the Returned Value
731      */

732     public FormParamBean addFormParameter(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPosition, String JavaDoc param, String JavaDoc possibleValue, String JavaDoc type, String JavaDoc visibility, int paramPosition) {
733         return addFormParameter(formParentName, formParentId, formParentPosition, param, possibleValue, type, visibility, true, paramPosition);
734     }
735
736
737     /**
738      * Adds a feature to the QueryParameter attribute of the UrlBean object
739      *
740      *@param param The feature to be added to the QueryParameter
741      * attribute
742      *@param defaultValue The feature to be added to the QueryParameter
743      * attribute
744      *@param position The feature to be added to the QueryParameter
745      * attribute
746      *@return Description of the Returned Value
747      */

748     public QueryParamBean addQueryParameter(String JavaDoc param, String JavaDoc defaultValue, int position) {
749         QueryParamBean bean = new QueryParamBean(this, param, defaultValue, position);
750         getQueryParamBeanList().add(bean);
751         return bean;
752     }
753
754
755     /**
756      * Description of the Method
757      *
758      *@param formParentName Description of Parameter
759      *@param formParentId Description of Parameter
760      *@param formParentPos Description of Parameter
761      *@param paramName Description of Parameter
762      *@param paramPosition Description of Parameter
763      *@return Description of the Returned Value
764      */

765     public boolean formParamExist(String JavaDoc formParentName, String JavaDoc formParentId, int formParentPos, String JavaDoc paramName, int paramPosition) {
766         return (getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName, formParentId, formParentPos, paramName, paramPosition) != null);
767     }
768
769
770     /**
771      * Gets the QueryParamBean attribute of the UrlBean object
772      *
773      *@param param Description of Parameter
774      *@return The QueryParamBean value
775      */

776     private QueryParamBean getQueryParamBean(String JavaDoc param) {
777         // find the FormParamBean object
778
List a = this.getQueryParamBeanList();
779         QueryParamBean paramAndValue = null;
780         for (int i = 0; i < a.size(); i++) {
781             paramAndValue = (QueryParamBean) a.get(i);
782             if (paramAndValue.getName().equalsIgnoreCase(param)) {
783                 return paramAndValue;
784             }
785         }
786         logger.debug("[Query param Bean " + param + " not found]");
787         return null;
788     }
789
790 }
791
Popular Tags