Source Code Cross Referenced for KualiContractsAndGrantsDocSearchGenerator.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » workflow » module » cg » docsearch » 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 » ERP CRM Financial » Kuali Financial System » org.kuali.workflow.module.cg.docsearch 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.workflow.module.cg.docsearch;
017:
018:        import java.util.ArrayList;
019:        import java.util.Arrays;
020:        import java.util.Iterator;
021:        import java.util.List;
022:
023:        import org.apache.commons.lang.ArrayUtils;
024:        import org.apache.commons.lang.StringUtils;
025:        import org.kuali.module.cg.lookup.keyvalues.DocumentSearchTypeOfSearchValuesFinder;
026:
027:        import edu.iu.uis.eden.docsearch.DocSearchCriteriaVO;
028:        import edu.iu.uis.eden.docsearch.SearchAttributeCriteriaComponent;
029:        import edu.iu.uis.eden.docsearch.StandardDocumentSearchGenerator;
030:        import edu.iu.uis.eden.doctype.DocumentType;
031:
032:        /**
033:         * This class...
034:         */
035:        public class KualiContractsAndGrantsDocSearchGenerator extends
036:                StandardDocumentSearchGenerator {
037:
038:            private static final String SEARCH_TYPE_ATTRIBUTE_FIELD_DEF_NAME = "searchType";
039:
040:            /*
041:             * (non-Javadoc)
042:             * 
043:             * @see edu.iu.uis.eden.docsearch.StandardDocumentSearchGenerator#clearSearch(edu.iu.uis.eden.docsearch.DocSearchCriteriaVO)
044:             */
045:            @Override
046:            public DocSearchCriteriaVO clearSearch(
047:                    DocSearchCriteriaVO searchCriteria) {
048:                DocSearchCriteriaVO docSearchCriteriaVO = new DocSearchCriteriaVO();
049:                docSearchCriteriaVO.setDocTypeFullName(searchCriteria
050:                        .getDocTypeFullName());
051:                return docSearchCriteriaVO;
052:            }
053:
054:            /*
055:             * Need to override this method because user could have selected a document type that is a proposal type but they could also
056:             * then select the checkbox to "only search for award documents". To adjust for this we change the main doc type the search will
057:             * use. (non-Javadoc)
058:             * 
059:             * @see edu.iu.uis.eden.docsearch.StandardDocumentSearchGenerator#getDocTypeFullNameWhereSql(java.lang.String, java.lang.String)
060:             */
061:            @Override
062:            protected String getDocTypeFullNameWhereSql(String docTypeFullName,
063:                    String whereClausePredicatePrefix) {
064:                // get names from search critera attribute
065:                List documentTypeNames = getDocTypeNames(SEARCH_TYPE_ATTRIBUTE_FIELD_DEF_NAME);
066:                String docTypeToSearchOn = docTypeFullName;
067:                boolean hasProposalDocType = false;
068:                boolean hasAwardDocType = false;
069:                // loop through attribute doc types to see if we have at least one award type as well as at least one proposal type
070:                for (Iterator iter = documentTypeNames.iterator(); iter
071:                        .hasNext();) {
072:                    String docTypeName = (String) iter.next();
073:                    hasProposalDocType |= (ArrayUtils
074:                            .contains(
075:                                    DocumentSearchTypeOfSearchValuesFinder.PROPOSAL_DOCUMENT_TYPE_NAMES,
076:                                    docTypeName));
077:                    hasAwardDocType |= (ArrayUtils
078:                            .contains(
079:                                    DocumentSearchTypeOfSearchValuesFinder.AWARD_DOCUMENT_TYPE_NAMES,
080:                                    docTypeName));
081:                    if (hasAwardDocType && hasProposalDocType) {
082:                        break;
083:                    }
084:                }
085:                // here we check to see if search criteria says only to search proposal documents and if the given doc type to search is an
086:                // award type
087:                if (hasProposalDocType
088:                        && (!hasAwardDocType)
089:                        && (ArrayUtils
090:                                .contains(
091:                                        DocumentSearchTypeOfSearchValuesFinder.AWARD_DOCUMENT_TYPE_NAMES,
092:                                        docTypeFullName))) {
093:                    return super 
094:                            .getDocTypeFullNameWhereSql(
095:                                    DocumentSearchTypeOfSearchValuesFinder.PROPOSAL_DOCUMENT_TYPE_NAMES[0],
096:                                    whereClausePredicatePrefix);
097:                } // here we check to see if search criteria says only to search award documents and if the given doc type to search is a
098:                // proposal type
099:                else if ((!hasProposalDocType)
100:                        && hasAwardDocType
101:                        && (ArrayUtils
102:                                .contains(
103:                                        DocumentSearchTypeOfSearchValuesFinder.PROPOSAL_DOCUMENT_TYPE_NAMES,
104:                                        docTypeFullName))) {
105:                    return super 
106:                            .getDocTypeFullNameWhereSql(
107:                                    DocumentSearchTypeOfSearchValuesFinder.AWARD_DOCUMENT_TYPE_NAMES[0],
108:                                    whereClausePredicatePrefix);
109:                }
110:                // here we are safe to use the given document type
111:                return super .getDocTypeFullNameWhereSql(docTypeToSearchOn,
112:                        whereClausePredicatePrefix);
113:            }
114:
115:            /*
116:             * (non-Javadoc)
117:             * 
118:             * @see edu.iu.uis.eden.docsearch.StandardDocumentSearchGenerator#addExtraDocumentTypesToSearch(java.lang.StringBuffer,
119:             *      edu.iu.uis.eden.doctype.DocumentType)
120:             */
121:            @Override
122:            protected void addExtraDocumentTypesToSearch(StringBuffer whereSql,
123:                    DocumentType docType) {
124:                // static name below is from xml definition of search attribute
125:                List documentTypeNames = getDocTypeNames(SEARCH_TYPE_ATTRIBUTE_FIELD_DEF_NAME);
126:                for (Iterator iter = documentTypeNames.iterator(); iter
127:                        .hasNext();) {
128:                    String docTypeName = (String) iter.next();
129:                    if (StringUtils.isNotBlank(docTypeName)) {
130:                        addDocumentTypeNameToSearchOn(whereSql, docTypeName);
131:                    }
132:                }
133:            }
134:
135:            private List<String> getDocTypeNames(String criteriaKeyName) {
136:                List documentTypes = new ArrayList();
137:                SearchAttributeCriteriaComponent criteriaComponent = getSearchableAttributeByFieldName(criteriaKeyName);
138:                if (criteriaComponent != null) {
139:                    // we know that this particular criteria component is a multibox therefor we need to use the list of values
140:                    for (String value : criteriaComponent.getValues()) {
141:                        if (StringUtils.isNotBlank(value)) {
142:                            documentTypes
143:                                    .addAll(Arrays
144:                                            .asList(value
145:                                                    .split(DocumentSearchTypeOfSearchValuesFinder.DOCUMENT_TYPE_SEPARATOR)));
146:                        }
147:                    }
148:                }
149:                return documentTypes;
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.