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


001:        /*
002:         * Copyright 2006-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.attribute;
017:
018:        import java.util.ArrayList;
019:        import java.util.HashMap;
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.Map;
023:
024:        import javax.servlet.http.HttpServletRequest;
025:
026:        import org.apache.commons.lang.StringUtils;
027:
028:        import edu.iu.uis.eden.EdenConstants;
029:        import edu.iu.uis.eden.KEWServiceLocator;
030:        import edu.iu.uis.eden.lookupable.Column;
031:        import edu.iu.uis.eden.lookupable.Field;
032:        import edu.iu.uis.eden.lookupable.Row;
033:        import edu.iu.uis.eden.plugin.attributes.WorkflowAttribute;
034:        import edu.iu.uis.eden.plugin.attributes.WorkflowLookupable;
035:        import edu.iu.uis.eden.routetemplate.RuleBaseValues;
036:        import edu.iu.uis.eden.routetemplate.RuleService;
037:        import edu.iu.uis.eden.routetemplate.RuleTemplate;
038:        import edu.iu.uis.eden.routetemplate.RuleTemplateService;
039:        import edu.iu.uis.eden.util.KeyLabelPair;
040:        import edu.iu.uis.eden.util.Utilities;
041:
042:        /**
043:         * This class provides a lookup for org review hierarchy routing rules.
044:         */
045:        public class OrgReviewLookupableImpl implements  WorkflowLookupable {
046:            private Long ruleTemplateId;
047:            private WorkflowAttribute orgReviewAttribute;
048:            private List rows;
049:            private List columns;
050:            private static final String ORG_REVIEW_TEMPLATE_NAME = "";
051:            private static final String TITLE = "Org Review Lookup";
052:            private static final String RETURN_LOCATION = "Lookup.do";
053:            private static final String RULE_ID_FIELD_LABEL = "Rule Id";
054:            private static final String DOC_TYP_NAME_FIELD_LABEL = "Document Type Name";
055:            private static final String ACTIVE_IND_FIELD_LABEL = "Active Indicator";
056:            private static final String RESPONSIBLE_PARTY_FIELD_LABEL = "Responsible Party";
057:            private static final String RULE_ID_PROPERTY_NAME = "ruleId";
058:            private static final String DOC_TYP_NAME_PROPERTY_NAME = "documentTypeName";
059:            private static final String DOC_TYP_LOOKUPABLE = "DocumentTypeLookupableImplService";
060:            private static final String ACTIVE_IND_PROPERTY_NAME = "activeIndicator";
061:            private static final String RESPONSIBLE_PARTY_PROPERTY_NAME = "responsibleParty";
062:            private static final String ALL_ACTIVE_INDICATOR_VALUE = "ALL";
063:
064:            /**
065:             * Constructs a OrgReviewLookupableImpl.java. Retrives the KualiOrgReviewTemplate from Spring, and initializes instance
066:             * variables based on it.
067:             */
068:            public OrgReviewLookupableImpl() {
069:                RuleTemplate ruleTemplate = ((RuleTemplateService) KEWServiceLocator
070:                        .getService(KEWServiceLocator.RULE_TEMPLATE_SERVICE))
071:                        .findByRuleTemplateName("KualiOrgReviewTemplate");
072:                this .ruleTemplateId = ruleTemplate.getRuleTemplateId();
073:                this .orgReviewAttribute = ruleTemplate
074:                        .getRuleTemplateAttribute(0).getWorkflowAttribute();
075:                this .orgReviewAttribute.setRequired(false);
076:                setRows();
077:                setColumns();
078:            }
079:
080:            /**
081:             * This method initializes the search criteria rows.
082:             */
083:            private void setRows() {
084:                rows = new ArrayList();
085:                List documentTypeFields = new ArrayList();
086:                documentTypeFields.add(new Field(DOC_TYP_NAME_FIELD_LABEL, "",
087:                        Field.TEXT, true, DOC_TYP_NAME_PROPERTY_NAME, "", null,
088:                        DOC_TYP_LOOKUPABLE));
089:                documentTypeFields.add(new Field("", "", Field.QUICKFINDER,
090:                        false, "", "", null, DOC_TYP_LOOKUPABLE));
091:                rows.add(new Row(documentTypeFields));
092:                List activeIndicatorOptions = new ArrayList();
093:                activeIndicatorOptions.add(new KeyLabelPair(Boolean.TRUE
094:                        .toString(), "Active"));
095:                activeIndicatorOptions.add(new KeyLabelPair(Boolean.FALSE
096:                        .toString(), "Inactive"));
097:                activeIndicatorOptions.add(new KeyLabelPair(
098:                        ALL_ACTIVE_INDICATOR_VALUE, "Show All"));
099:                List activeIndicatorFields = new ArrayList();
100:                activeIndicatorFields.add(new Field(ACTIVE_IND_FIELD_LABEL, "",
101:                        Field.RADIO, false, ACTIVE_IND_PROPERTY_NAME,
102:                        Boolean.TRUE.toString(), activeIndicatorOptions, null));
103:                rows.add(new Row(activeIndicatorFields));
104:                rows.addAll(orgReviewAttribute.getRuleRows());
105:            }
106:
107:            /**
108:             * This method initializes the result set columns.
109:             */
110:            private void setColumns() {
111:                columns = new ArrayList();
112:                columns.add(new Column(RULE_ID_FIELD_LABEL, Boolean.TRUE
113:                        .toString(), RULE_ID_PROPERTY_NAME));
114:                columns.add(new Column(DOC_TYP_NAME_FIELD_LABEL, Boolean.TRUE
115:                        .toString(), DOC_TYP_NAME_PROPERTY_NAME));
116:                columns.add(new Column(ACTIVE_IND_FIELD_LABEL, Boolean.TRUE
117:                        .toString(), ACTIVE_IND_PROPERTY_NAME));
118:                Iterator extendedAttributeRowItr = orgReviewAttribute
119:                        .getRuleRows().iterator();
120:                while (extendedAttributeRowItr.hasNext()) {
121:                    Row row = (Row) extendedAttributeRowItr.next();
122:                    Iterator fieldItr = row.getFields().iterator();
123:                    while (fieldItr.hasNext()) {
124:                        Field field = (Field) fieldItr.next();
125:                        if (Field.TEXT.equals(field.getFieldType())) {
126:                            columns.add(new Column(field.getFieldLabel(),
127:                                    Boolean.TRUE.toString(), field
128:                                            .getPropertyName()));
129:                        }
130:                    }
131:
132:                }
133:                columns.add(new Column(RESPONSIBLE_PARTY_FIELD_LABEL,
134:                        Boolean.TRUE.toString(),
135:                        RESPONSIBLE_PARTY_PROPERTY_NAME));
136:            }
137:
138:            /**
139:             * This method uses edu.iu.uis.eden.routetemplate.RuleService#search(java.lang.String docTypeName, java.lang.Long ruleId,
140:             * java.lang.Long ruleTemplateId, java.lang.String ruleDescription, java.lang.Long workgroupId, java.lang.String workflowId,
141:             * java.lang.String roleName, java.lang.Boolean delegateRule, java.lang.Boolean activeInd, java.util.Map extensionValues) to
142:             * retrieve a List of rules based on the search criteria specified, then converts the result set into OrgReviewLookupableResults
143:             * and returns those.
144:             * 
145:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getSearchResults(java.util.Map, java.util.Map)
146:             */
147:            public List getSearchResults(Map fieldValues, Map fieldConversions)
148:                    throws Exception {
149:                List errors = new ArrayList();
150:                String docTypeNameParam = (String) fieldValues
151:                        .get(DOC_TYP_NAME_PROPERTY_NAME);
152:                String activeParam = (String) fieldValues
153:                        .get(ACTIVE_IND_PROPERTY_NAME);
154:                String docTypeSearchName = null;
155:                Boolean isActive = null;
156:                if (!activeParam.equals(ALL_ACTIVE_INDICATOR_VALUE)) {
157:                    isActive = new Boolean(activeParam);
158:                }
159:                if (docTypeNameParam != null
160:                        && !"".equals(docTypeNameParam.trim())) {
161:                    docTypeSearchName = docTypeNameParam.replace('*', '%');
162:                    docTypeSearchName = "%" + docTypeSearchName.trim() + "%";
163:                }
164:                Map attributes = new HashMap();
165:                Iterator attributeRowItr = orgReviewAttribute.getRuleRows()
166:                        .iterator();
167:                while (attributeRowItr.hasNext()) {
168:                    Row attributeRow = (Row) attributeRowItr.next();
169:                    Iterator attributeFieldItr = attributeRow.getFields()
170:                            .iterator();
171:                    while (attributeFieldItr.hasNext()) {
172:                        Field attributeField = (Field) attributeFieldItr.next();
173:                        if (fieldValues.get(attributeField.getPropertyName()) != null) {
174:                            String attributeValue = (String) fieldValues
175:                                    .get(attributeField.getPropertyName());
176:                            if (!StringUtils.isBlank(attributeValue)) {
177:                                attributes.put(
178:                                        attributeField.getPropertyName(),
179:                                        attributeValue.trim());
180:                            }
181:                        }
182:                    }
183:                }
184:                Iterator rules = ((RuleService) KEWServiceLocator
185:                        .getService(KEWServiceLocator.RULE_SERVICE)).search(
186:                        docTypeSearchName, null, ruleTemplateId, null, null,
187:                        null, null, null, isActive, attributes).iterator();
188:                List displayList = new ArrayList();
189:                while (rules.hasNext()) {
190:                    displayList.add(new OrgReviewLookupableResult(
191:                            (RuleBaseValues) rules.next()));
192:                }
193:                return displayList;
194:            }
195:
196:            /**
197:             * @see edu.iu.uis.eden.EdenConstants.RULE_SEARCH_INSTRUCTION_KEY
198:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getLookupInstructions()
199:             */
200:            public String getLookupInstructions() {
201:                return Utilities
202:                        .getApplicationConstant(EdenConstants.RULE_SEARCH_INSTRUCTION_KEY);
203:            }
204:
205:            /**
206:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getTitle()
207:             */
208:            public String getTitle() {
209:                return TITLE;
210:            }
211:
212:            /**
213:             * Since this is a lookup, we return Lookup.do.
214:             * 
215:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getReturnLocation()
216:             */
217:            public String getReturnLocation() {
218:                return RETURN_LOCATION;
219:            }
220:
221:            /**
222:             * Returns unodified instance variable initialized in setColumns(), called from the constructor.
223:             * 
224:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getColumns()
225:             */
226:            public List getColumns() {
227:                return columns;
228:            }
229:
230:            /**
231:             * Returns unmodified instance variable initialized in setRows(), called from the constructor.
232:             * 
233:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getRows()
234:             */
235:            public List getRows() {
236:                return rows;
237:            }
238:
239:            /**
240:             * Returns the empty String.
241:             * 
242:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getHtmlMenuBar()
243:             */
244:            public String getHtmlMenuBar() {
245:                return "";
246:            }
247:
248:            /**
249:             * Returns the empty String.
250:             * 
251:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getNoReturnParams(java.util.Map)
252:             */
253:            public String getNoReturnParams(Map fieldConversions) {
254:                return "";
255:            }
256:
257:            /**
258:             * Returns an empty List.
259:             * 
260:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#getDefaultReturnType()
261:             */
262:            public List getDefaultReturnType() {
263:                return new ArrayList();
264:            }
265:
266:            /**
267:             * Does nothing and returns false.
268:             * 
269:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#checkForAdditionalFields(java.util.Map,
270:             *      javax.servlet.http.HttpServletRequest)
271:             */
272:            public boolean checkForAdditionalFields(Map fieldValues,
273:                    HttpServletRequest request) throws Exception {
274:                return false;
275:            }
276:
277:            /**
278:             * Does nothing.
279:             * 
280:             * @see edu.iu.uis.eden.plugin.attributes.WorkflowLookupable#changeIdToName(java.util.Map)
281:             */
282:            public void changeIdToName(Map fieldValues) {
283:            }
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.