Source Code Cross Referenced for SearchRequestBean.java in  » Portal » Open-Portal » com » sun » portal » search » providers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.search.providers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.search.providers;
007:
008:        import java.util.*;
009:        import java.lang.*;
010:        import java.io.*;
011:
012:        import com.sun.portal.search.soif.*;
013:        import com.sun.portal.search.demo.*;
014:
015:        /**
016:         * <P>
017:         * The SearchRequestBean is a helper bean used by the search JSP's. The class has 
018:         * specific getter and setter methods for each of the form fields in basic search and
019:         * advanced search. The JSP application can query the Bean using reflection.
020:         * <P>
021:         * SearchRequestBean can be extended based on the search JSP provider 
022:         * requirements. Other get/set methods can be added by extending the SearchRequestBean. 
023:         * Users may also prefer to ignore the SearchRequestBean and implement their own JSP 
024:         * helpers. Here is the List of Bean properties, description and accessor methods
025:         * <UL>
026:         * <LI> Basic, Advanced and Browse Form<UL>
027:         * <LI>scope - get/set - Search query string in the basic search, hidden field in advanced search
028:         * <LI>description - get/set - Corresponds to full description, brief description and title only
029:         * <LI>mode - get/set - Corresponds to basic, advanced and search mode
030:         * <LI>browseCategory - get/set - value of the current category. Defaults to ROOT in the JSP
031:         * <LI>page - get/set - Value of the current page </UL> 
032:         *
033:         * <LI> Advanced Search Form Only<UL>
034:         * <LI>wordsOp - get/set - Corresponds to any/all/exact/passage selection menu in advanced search
035:         * <LI>wordsVal - get/set - The value for the above operation
036:         * <LI>nowords - get/set - corresponds to the value for the 'without any words' field 
037:         * <LI>authorOp - get/set - Corresponds to the operation for author 
038:         * <LI>authorVal - get/set - The value for the above operation
039:         * <LI>titleOp - get/set - Corresponds to the title operator
040:         * <LI>titleVal - get/set - The value for the above operation
041:         * <LI>urlOp - get/set - Corresponds to the url opertor 
042:         * <LI>urlVal - get/set - The value for the above operation
043:         * <LI>since - get/set - The value of the since operator
044:         * <LI>lmodifiedOp- get/set - Corresponds to the lmodified operator 
045:         * <LI>lmodifiedVal  - get/set - The value for the above operation
046:         * <LI>keywordsOp - get/set - Corresponds to the keywords operator i.e contains/does not contain
047:         * <LI>keywordsVal -  - get/set - The value for the above operation
048:         * <LI>viewHits - get/set - currently unused in the JSP </UL>
049:         *
050:         * <LI> Browse Search Form Only<UL>
051:         * <LI>scat - get/set - corresponds to seach all categories radio button on the browse page </UL>
052:         * </UL>
053:         * @see com.sun.portal.search.demo.Search
054:         */
055:        public class SearchRequestBean implements  Serializable {
056:
057:            private String scope = "";
058:            /**
059:             * These are Session variables in the JSP and are passed around as HTML hidden attributes. 
060:             * They are temporarily stored in the request Bean for convenient data access and data 
061:             * manipulation within the Bean object 
062:             **/
063:            private int page = 1;
064:            private String description = "brief";
065:            private String mode = "basic";
066:            private String browseCategory = "ROOT";
067:            private String scat = "";
068:            private int viewHits = 0;
069:            private String processRating = "";
070:
071:            /******************************************************************
072:             * Advanced Search specific parameters
073:             *****************************************************************/
074:            private String wordsOp = "";
075:            private String wordsVal = "";
076:
077:            private String nowords = "";
078:
079:            private int vhits = 0;
080:
081:            private String urlOp = "";
082:            private String urlVal = "";
083:
084:            private String since = "";
085:
086:            private String authorOp = "";
087:            private String authorVal = "";
088:
089:            private String titleOp = "";
090:            private String titleVal = "";
091:
092:            private String keywordsOp = "";
093:            private String keywordsVal = "";
094:
095:            private String expiresOp = "";
096:            private String expiresVal = "";
097:
098:            private String lmodifiedOp = "";
099:            private String lmodifiedVal = "";
100:
101:            private String database = "";
102:            private String rating = "";
103:            private boolean sd = false;
104:
105:            /**
106:             * Public Constructor
107:             */
108:            public void SearchRequestBean() {
109:            }
110:
111:            /***********************************************************
112:             * Session attributes which are passed to the bean in 
113:             * the request object. 
114:             ***********************************************************/
115:
116:            /** 
117:             * Gets the query string 
118:             *
119:             * @return The value of scope, query string  
120:             */
121:            public String getScope() {
122:                return scope;
123:            }
124:
125:            /**
126:             * Sets the query string value
127:             * @param scope is the query string
128:             */
129:            public void setScope(String s) {
130:                // format scope if required
131:                if (s != null)
132:                    this .scope = s;
133:            }
134:
135:            /**
136:             * Gets the description
137:             * @return The value of the description e.g full,brief,title
138:             */
139:            public String getDescription() {
140:                return description;
141:            }
142:
143:            /**
144:             * Gets the description. for example: full,brief,title
145:             * @param d is the description type in the search results
146:             * Description defaults to an empty string if value is null
147:             */
148:            public void setDescription(String d) {
149:                if (d == null)
150:                    d = "";
151:                this .description = d;
152:            }
153:
154:            /**
155:             * Gets the search mode
156:             * @return search mode
157:             */
158:            public String getMode() {
159:                return mode;
160:            }
161:
162:            /**
163:             * Sets the search mode
164:             * @param m value of the current search mode. 
165:             * possible values can be 'adv' or 'basic'
166:             */
167:            public void setMode(String m) {
168:                if (m == null)
169:                    m = "";
170:                this .mode = m;
171:            }
172:
173:            /**
174:             * Sets the current page value
175:             * @param p value of the current page
176:             */
177:            public void setPage(int p) {
178:                this .page = p;
179:            }
180:
181:            /**
182:             * Gets the current page value
183:             * @return The value of the current page
184:             */
185:            public int getPage() {
186:                return page;
187:            }
188:
189:            /**
190:             * Gets the viewHits value
191:             * @return the number of search hits in the results page
192:             */
193:            public int getViewHits() {
194:                return viewHits;
195:            }
196:
197:            /**
198:             * Sets the viewHits value
199:             * @param vhits The number of results to be displayed on the page
200:             */
201:            public void setViewHits(int vhits) {
202:                this .viewHits = vhits;
203:            }
204:
205:            /**
206:             *
207:             * Helper method used to return the selection for the description menu
208:             * Compares the parameter value with the description property
209:             * @param description string normally passed from the request object
210:             * <P>
211:             * @return "SELECTED" if the parameter is equal to the description property
212:             * empty string if these are not equal
213:             */
214:            public String DescSelectionAttribute(String attr) {
215:                if (description != null) {
216:                    return description.equals(attr) ? "SELECTED" : "";
217:                }
218:                return "";
219:            }
220:
221:            /**
222:             *
223:             * Method is used for category browsing and category searching
224:             * @return the current category
225:             */
226:            public String getBrowseCategory() {
227:                return browseCategory;
228:            }
229:
230:            /**
231:             * Sets the current category
232:             * @param bc is the current category, The category is set only if the current
233:             * category value is not an empty string.
234:             */
235:            public void setBrowseCategory(String bc) {
236:                if ((bc != null) && (!bc.equals("")))
237:                    this .browseCategory = bc;
238:            }
239:
240:            /**
241:             * Get the value of scat i.e search all category radio button
242:             * @return The value of the search all category radio button 
243:             */
244:            public String getScat() {
245:                return scat;
246:            }
247:
248:            /**
249:             * Set the value of the scat radio button
250:             * @param cat is the value of  the search all categories radio button
251:             */
252:            public void setScat(String cat) {
253:                this .scat = cat;
254:            }
255:
256:            /**
257:             * Get the value of wordsOp
258:             * @return The value of the with operation (any/all/exact/passage) operator 
259:             * from advanced search
260:             */
261:            public String getWordsOp() {
262:                return wordsOp;
263:            }
264:
265:            /**
266:             * Sets the value of wordsOp
267:             * @param wordsOperator value for the words operation
268:             */
269:            public void setWordsOp(String wordsOperator) {
270:                if (wordsOperator == null)
271:                    wordsOperator = "";
272:                this .wordsOp = wordsOperator;
273:            }
274:
275:            /**
276:             *
277:             * @param op value that is compared with the value of wordsOp 
278:             * @return "SELECTED" is returned if they are both equal and empty
279:             * string is returned if unequal
280:             */
281:            public String wordsOpSelection(String op) {
282:                if (wordsOp.equals(op)) {
283:                    return "SELECTED";
284:                }
285:                return "";
286:            }
287:
288:            /**
289:             * Gets the value of wordsVal
290:             * @return The value of the words property
291:             */
292:            public String getWordsVal() {
293:                return wordsVal;
294:            }
295:
296:            /**
297:             * Sets the value of wordsVal
298:             * @param whichwords value of the words property 
299:             */
300:            public void setWordsVal(String whichwords) {
301:                if (whichwords == null)
302:                    whichwords = "";
303:                this .wordsVal = whichwords;
304:            }
305:
306:            /**
307:             * Gets the value of nowords
308:             * @return The value of the nowords property
309:             */
310:            public String getNowords() {
311:                return nowords;
312:            }
313:
314:            /**
315:             * Sets the value of nowords
316:             * @param nowords value of the nowords property 
317:             */
318:            public void setNowords(String nowords) {
319:                if (nowords == null)
320:                    nowords = "";
321:                this .nowords = nowords;
322:            }
323:
324:            /**
325:             * Gets the value of authorOp 
326:             * @return The value of the author operator
327:             */
328:            public String getAuthorOp() {
329:                return authorOp;
330:            }
331:
332:            /**
333:             * Sets the value of authorOp
334:             * @param authorOperator value of the author property 
335:             */
336:            public void setAuthorOp(String authorOperator) {
337:                if (authorOperator == null)
338:                    authorOperator = "";
339:                this .authorOp = authorOperator;
340:            }
341:
342:            /**
343:             * Gets the value of authorVal
344:             * @return The value of the author property
345:             */
346:            public String getAuthorVal() {
347:                return authorVal;
348:            }
349:
350:            /**
351:             * Compares the input parameter with the authorOp property
352:             * @param op is compared to the author operator
353:             * @returns SELECTED if equal
354:             * "" if unequal
355:             */
356:            public String authorOpSelection(String op) {
357:                if (authorOp.equals(op)) {
358:                    return "SELECTED";
359:                }
360:                return "";
361:            }
362:
363:            /**
364:             * Sets the value of authorVal
365:             * @param authorValue value for the authorVal property
366:             */
367:            public void setAuthorVal(String authorValue) {
368:                if (authorValue == null)
369:                    authorValue = "";
370:                this .authorVal = authorValue;
371:            }
372:
373:            /**
374:             * Sets the value of urlOp 
375:             * @param urlOperator value for the urlOp
376:             */
377:            public void setUrlOp(String urlOperator) {
378:                if (urlOperator == null)
379:                    urlOperator = "";
380:                this .urlOp = urlOperator;
381:            }
382:
383:            /**
384:             * Gets the value of urlOp
385:             * @return The value of the urlOp
386:             */
387:            public String getUrlOp() {
388:                return urlOp;
389:            }
390:
391:            /**
392:             *
393:             * @param op is compared to the url operator 
394:             * @returns 'SELECTED' if equal and "" if unequal
395:             */
396:            public String urlOpSelection(String op) {
397:                if (urlOp.equals(op)) {
398:                    return "SELECTED";
399:                }
400:                return "";
401:            }
402:
403:            /**
404:             * Gets the value of urlVal
405:             * @return The value of the urlVal 
406:             */
407:            public String getUrlVal() {
408:                return urlVal;
409:            }
410:
411:            /**
412:             * Sets the value of urlVal
413:             * @param url value for the urlVal property
414:             */
415:            public void setUrlVal(String url) {
416:                if (url == null)
417:                    url = "";
418:                this .urlVal = url;
419:            }
420:
421:            /**
422:             * Sets the value of titleOp
423:             * @param titleOperator value for the titleOp
424:             */
425:            public void setTitleOp(String titleOperator) {
426:                if (titleOperator == null)
427:                    titleOperator = "";
428:                this .titleOp = titleOperator;
429:            }
430:
431:            /**
432:             * Gets the value of titleOp
433:             * @return The value of the titleOp
434:             */
435:            public String getTitleOp() {
436:                return titleOp;
437:            }
438:
439:            /**
440:             *
441:             * @param op is compared to the title operator
442:             * @return 'SELECTED' if equal and "" if unequal
443:             */
444:            public String titleOpSelection(String op) {
445:                if (titleOp.equals(op)) {
446:                    return "SELECTED";
447:                }
448:                return "";
449:            }
450:
451:            /**
452:             * Gets the title value
453:             * @return The value of the titleVal property
454:             */
455:            public String getTitleVal() {
456:                return titleVal;
457:            }
458:
459:            /**
460:             * Sets the titleVal
461:             * @param The value for the titleVal property
462:             */
463:            public void setTitleVal(String title) {
464:                if (title == null)
465:                    title = "";
466:                this .titleVal = title;
467:            }
468:
469:            /**
470:             * Sets the value of keywordsOp
471:             * @param The value of the keywordsOp property
472:             */
473:            public void setKeywordsOp(String keywordsOperator) {
474:                if (keywordsOperator == null)
475:                    keywordsOperator = "";
476:                this .keywordsOp = keywordsOperator;
477:            }
478:
479:            /**
480:             * Gets the value of keywordsOp
481:             * @return The value of the keywordsOp property
482:             */
483:            public String getKeywordsOp() {
484:                return keywordsOp;
485:            }
486:
487:            /**
488:             * 
489:             * @param op is compared to the keywordsOp
490:             * @return 'SELECTED' if equal "" and if unequal
491:             */
492:            public String keywordsOpSelection(String op) {
493:                if (keywordsOp.equals(op)) {
494:                    return "SELECTED";
495:                }
496:                return "";
497:            }
498:
499:            /**
500:             * Gets the value of keywordsVal
501:             * @return The value of the keywords property 
502:             */
503:            public String getKeywordsVal() {
504:                return keywordsVal;
505:            }
506:
507:            /**
508:             * Sets the value of keywordsVal
509:             * @param keywords value for the keywordsVal 
510:             */
511:            public void setKeywordsVal(String keywords) {
512:                if (keywords == null)
513:                    keywords = "";
514:                this .keywordsVal = keywords;
515:            }
516:
517:            /**
518:             * Sets the value of expiresOp 
519:             * @param expiresOperator value for expiresOp  
520:             */
521:            public void setExpiresOp(String expiresOperator) {
522:                if (expiresOperator == null)
523:                    expiresOperator = "";
524:                this .expiresOp = expiresOperator;
525:            }
526:
527:            /**
528:             * Gets the value of expiresOp
529:             * @return The value of the expiresOp property 
530:             */
531:            public String getExpiresOp() {
532:                return expiresOp;
533:            }
534:
535:            /**
536:             *
537:             * @param op is compared to the expires operator
538:             * @return 'SELECTED' if equal and "" if unequal
539:             */
540:            public String expiresOpSelection(String op) {
541:                if (expiresOp.equals(op)) {
542:                    return "SELECTED";
543:                }
544:                return "";
545:            }
546:
547:            /**
548:             * Gets the value of expiresVal
549:             * @return The value of the expires property 
550:             */
551:            public String getExpiresVal() {
552:                return expiresVal;
553:            }
554:
555:            /**
556:             * Sets the expiresVal property
557:             * @param expires value for the expires property
558:             */
559:            public void setExpiresVal(String expires) {
560:                if (expires == null)
561:                    expires = "";
562:                this .expiresVal = expires;
563:            }
564:
565:            /**
566:             * Sets the lmodifiedOp property
567:             * @param lmodifiedOperator value for the lmodified operator
568:             */
569:            public void setLmodifiedOp(String lmodifiedOperator) {
570:                if (lmodifiedOperator == null)
571:                    lmodifiedOperator = "";
572:                this .lmodifiedOp = lmodifiedOperator;
573:            }
574:
575:            /**
576:             * Gets the lmodifiedOp property
577:             * @return The value of the lmodified operator 
578:             */
579:            public String getLmodifiedOp() {
580:                return lmodifiedOp;
581:            }
582:
583:            /**
584:             *
585:             * @param op is compared to the lmodified operator
586:             * @return 'SELECTED' if equal and "" if unequal
587:             */
588:            public String lmodifiedOpSelection(String op) {
589:                if (lmodifiedOp.equals(op)) {
590:                    return "SELECTED";
591:                }
592:                return "";
593:            }
594:
595:            /**
596:             * Gets the value of the since property
597:             * @return The value of the since property
598:             */
599:            public String getSince() {
600:                return since;
601:            }
602:
603:            /**
604:             * Sets the since property
605:             * @param lmodified value for the since property 
606:             */
607:            public void setSince(String lmodified) {
608:                if (lmodified == null)
609:                    lmodified = "";
610:                this .since = lmodified;
611:            }
612:
613:            /**
614:             *
615:             * @param op is compared to the since property 
616:             * @return 'SELECTED' if equal and empty string if unequal
617:             */
618:            public String sinceSelection(String op) {
619:                if (since.equals(op)) {
620:                    return "SELECTED";
621:                }
622:                return "";
623:            }
624:
625:            /**
626:             * Gets the lmodifiedVal property
627:             * @return The value of lmodified property
628:             */
629:            public String getLmodifiedVal() {
630:                return lmodifiedVal;
631:            }
632:
633:            /**
634:             * Sets the lmodifiedVal property
635:             * @param lmodified value of the lmodified property 
636:             */
637:            public void setLmodifiedVal(String lmodified) {
638:                if (lmodified == null)
639:                    lmodified = "";
640:                this .lmodifiedVal = lmodified;
641:            }
642:
643:            /**
644:             *
645:             * @param op is compared to the viewhits property 
646:             * @return 'SELECTED' if equal and empty string if unequal
647:             */
648:            public String viewhitsSelection(int op) {
649:                if (viewHits == op) {
650:                    return "SELECTED";
651:                }
652:                return "";
653:            }
654:
655:            /**
656:             * Database value can be string or a comma separated multi value field
657:             */
658:            public void setDatabase(String dbname) {
659:                this .database = dbname;
660:            }
661:
662:            /**
663:             * search within specific databases
664:             * form field values are stored in string
665:             */
666:            public void setDatabase(String[] dbname) {
667:                database = "";
668:                if (dbname != null) {
669:                    for (int i = 0; i < dbname.length; i++) {
670:                        if (i < dbname.length - 1)
671:                            database = database + dbname[i] + ", ";
672:                        else
673:                            database = database + dbname[i];
674:                    }
675:                }
676:            }
677:
678:            /**
679:             * returns database values in a comma separated string
680:             */
681:            public String getDatabase() {
682:                return database;
683:            }
684:
685:            /**
686:             * Helper method
687:             * form field search within discussions value is saved accross requests
688:             */
689:            public String databaseSelection(String d) {
690:                if (database.equalsIgnoreCase(d))
691:                    return "CHECKED";
692:
693:                return "";
694:            }
695:
696:            /**
697:             * search within a discussion
698:             * database and discussion id are added to the search query string 
699:             */
700:            public void setSearchDiscussionQuery(String sd, String did) {
701:                setDatabase(sd);
702:                scope = "(RD-reference-id <contains> " + did + ") <AND> "
703:                        + getScope();
704:            }
705:
706:            /**
707:             * sets the rating field from advanced search
708:             */
709:            public void setRating(String r) {
710:                this .rating = r;
711:            }
712:
713:            /**
714:             * Helper method for remembering UI selection 
715:             */
716:            public String ratingSelection(String rt) {
717:                if (rating.equals(rt))
718:                    return "SELECTED";
719:                return "";
720:            }
721:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.