Source Code Cross Referenced for UserLookupableImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » user » 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 » edu.iu.uis.eden.user 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2006 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.user;
018:
019:        import java.util.ArrayList;
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 edu.iu.uis.eden.EdenConstants;
027:        import edu.iu.uis.eden.KEWServiceLocator;
028:        import edu.iu.uis.eden.lookupable.Column;
029:        import edu.iu.uis.eden.lookupable.Field;
030:        import edu.iu.uis.eden.lookupable.Row;
031:        import edu.iu.uis.eden.plugin.attributes.WorkflowLookupable;
032:        import edu.iu.uis.eden.user.web.WebWorkflowUser;
033:        import edu.iu.uis.eden.util.Utilities;
034:        import edu.iu.uis.eden.web.UrlResolver;
035:
036:        /**
037:         * The default Lookupable implementation for WorkflowUsers. 
038:         * 
039:         * @author ewestfal
040:         */
041:        public class UserLookupableImpl implements  WorkflowLookupable {
042:
043:            private List rows;
044:            private static List columns = establishColumns();
045:            private static final String title = "User Lookup";
046:            private static final String returnLocation = "Lookup.do";
047:
048:            private static final String LAST_NAME_FIELD_LABEL = "Last Name";
049:            private static final String FIRST_NAME_FIELD_LABEL = "First Name";
050:            private static final String NETWORK_ID_FIELD_LABEL = "Network Id";
051:            private static final String WORKFLOW_ID_FIELD_LABEL = "Workflow User Id";
052:            private static final String EMPLID_FIELD_LABEL = "University Id";
053:            private static final String UUID_FIELD_LABEL = "UUID";
054:
055:            private static final String LAST_NAME_FIELD_HELP = "";
056:            private static final String FIRST_NAME_FIELD_HELP = "";
057:            private static final String NETWORK_ID_FIELD_HELP = "";
058:            private static final String WORKFLOW_ID_FIELD_HELP = "";
059:            private static final String EMPLID_FIELD_HELP = "";
060:            private static final String UUID_FIELD_HELP = "";
061:
062:            private static final String LAST_NAME_PROPERTY_NAME = "lastName";
063:            private static final String FIRST_NAME_PROPERTY_NAME = "firstName";
064:            private static final String NETWORK_ID_PROPERTY_NAME = "networkId";
065:            private static final String WORKFLOW_ID_PROPERTY_NAME = "workflowId";
066:            private static final String EMPLID_PROPERTY_NAME = "emplId";
067:            private static final String UUID_PROPERTY_NAME = "uuId";
068:            private static final String BACK_LOCATION_KEY_NAME = "backLocation";
069:            private static final String DOC_FORM_KEY_NAME = "docFormKey";
070:
071:            /**
072:             * UserLookupableImpl - constructor that sets up the values of what the form on the jsp will look like.
073:             */
074:            public UserLookupableImpl() {
075:                rows = new ArrayList();
076:
077:                List fields = new ArrayList();
078:                fields.add(new Field(LAST_NAME_FIELD_LABEL,
079:                        LAST_NAME_FIELD_HELP, Field.TEXT, false,
080:                        LAST_NAME_PROPERTY_NAME, "", null, null));
081:                rows.add(new Row(fields));
082:
083:                fields = new ArrayList();
084:                fields.add(new Field(FIRST_NAME_FIELD_LABEL,
085:                        FIRST_NAME_FIELD_HELP, Field.TEXT, false,
086:                        FIRST_NAME_PROPERTY_NAME, "", null, null));
087:                rows.add(new Row(fields));
088:
089:                fields = new ArrayList();
090:                fields.add(new Field(NETWORK_ID_FIELD_LABEL,
091:                        NETWORK_ID_FIELD_HELP, Field.TEXT, false,
092:                        NETWORK_ID_PROPERTY_NAME, "", null, null));
093:                rows.add(new Row(fields));
094:
095:                fields = new ArrayList();
096:                fields.add(new Field(WORKFLOW_ID_FIELD_LABEL,
097:                        WORKFLOW_ID_FIELD_HELP, Field.TEXT, false,
098:                        WORKFLOW_ID_PROPERTY_NAME, "", null, null));
099:                rows.add(new Row(fields));
100:
101:                fields = new ArrayList();
102:                fields
103:                        .add(new Field(EMPLID_FIELD_LABEL, EMPLID_FIELD_HELP,
104:                                Field.TEXT, false, EMPLID_PROPERTY_NAME, "",
105:                                null, null));
106:                rows.add(new Row(fields));
107:
108:                fields = new ArrayList();
109:                fields.add(new Field(UUID_FIELD_LABEL, UUID_FIELD_HELP,
110:                        Field.TEXT, false, UUID_PROPERTY_NAME, "", null, null));
111:                rows.add(new Row(fields));
112:            }
113:
114:            private static List establishColumns() {
115:                List columns = new ArrayList();
116:                columns.add(new Column("Full Name",
117:                        Column.COLUMN_IS_SORTABLE_VALUE, "transposedName"));
118:                columns.add(new Column("Network Id",
119:                        Column.COLUMN_IS_SORTABLE_VALUE,
120:                        "authenticationUserId.authenticationId"));
121:                columns.add(new Column("Workflow User Id",
122:                        Column.COLUMN_IS_SORTABLE_VALUE,
123:                        "workflowUserId.workflowId"));
124:                columns.add(new Column("University Id",
125:                        Column.COLUMN_IS_SORTABLE_VALUE, "emplId.emplId"));
126:                columns.add(new Column("UUID", Column.COLUMN_IS_SORTABLE_VALUE,
127:                        "uuId.uuId"));
128:                columns.add(new Column("Actions",
129:                        Column.COLUMN_IS_SORTABLE_VALUE, "actionsUrl"));
130:                return columns;
131:            }
132:
133:            public String getNoReturnParams(Map fieldConversions) {
134:                String userReturn = (String) fieldConversions
135:                        .get(NETWORK_ID_PROPERTY_NAME);
136:                StringBuffer noReturnParams = new StringBuffer("&");
137:                if (!Utilities.isEmpty(userReturn)) {
138:                    noReturnParams.append(userReturn);
139:                } else {
140:                    noReturnParams.append(NETWORK_ID_PROPERTY_NAME);
141:                }
142:                noReturnParams.append("=");
143:                return noReturnParams.toString();
144:            }
145:
146:            public void changeIdToName(Map fieldValues) {
147:
148:            }
149:
150:            /**
151:             * getSearchResults - searches for a fiscal organization information based on the criteria passed in by the map.
152:             * 
153:             * @return Returns a list of FiscalOrganization objects that match the result.
154:             */
155:            public List getSearchResults(Map fieldValues, Map fieldConversions)
156:                    throws Exception {
157:                String lastName = (String) fieldValues
158:                        .get(LAST_NAME_PROPERTY_NAME);
159:                String firstName = (String) fieldValues
160:                        .get(FIRST_NAME_PROPERTY_NAME);
161:                String networkId = (String) fieldValues
162:                        .get(NETWORK_ID_PROPERTY_NAME);
163:                String workflowId = (String) fieldValues
164:                        .get(WORKFLOW_ID_PROPERTY_NAME);
165:                String emplId = (String) fieldValues.get(EMPLID_PROPERTY_NAME);
166:                String uuId = (String) fieldValues.get(UUID_PROPERTY_NAME);
167:                String backLocation = (String) fieldValues
168:                        .get(BACK_LOCATION_KEY_NAME);
169:                String docFormKey = (String) fieldValues.get(DOC_FORM_KEY_NAME);
170:
171:                String userReturn = (String) fieldConversions
172:                        .get(NETWORK_ID_PROPERTY_NAME);
173:
174:                UserService userSrv = (UserService) KEWServiceLocator
175:                        .getUserService();
176:                WorkflowUser workflowUserExample = userSrv.getBlankUser();
177:                workflowUserExample.setGivenName(firstName == null ? ""
178:                        : firstName.trim());
179:                workflowUserExample.setLastName(lastName == null ? ""
180:                        : lastName.trim());
181:                workflowUserExample
182:                        .setAuthenticationUserId(new AuthenticationUserId(
183:                                networkId == null ? "" : networkId.trim()));
184:                workflowUserExample.setWorkflowUserId(new WorkflowUserId(
185:                        workflowId == null ? "" : workflowId.trim()));
186:                workflowUserExample.setEmplId(new EmplId(emplId == null ? ""
187:                        : emplId.trim()));
188:                workflowUserExample.setUuId(new UuId(uuId == null ? "" : uuId
189:                        .trim()));
190:
191:                Iterator users = userSrv.search(workflowUserExample, false)
192:                        .iterator();
193:                List displayList = new ArrayList();
194:                while (users.hasNext()) {
195:                    WorkflowUser prototype = (WorkflowUser) users.next();
196:                    WebWorkflowUser type = new WebWorkflowUser(prototype);
197:
198:                    StringBuffer returnUrl = new StringBuffer("<a href=\"");
199:                    returnUrl.append(backLocation).append(
200:                            "?methodToCall=refresh&docFormKey=").append(
201:                            docFormKey).append("&");
202:                    if (!Utilities.isEmpty(userReturn)) {
203:                        returnUrl.append(userReturn);
204:                    } else {
205:                        returnUrl.append(NETWORK_ID_PROPERTY_NAME);
206:                    }
207:                    returnUrl.append("=");
208:                    if (type.getAuthenticationUserId() == null
209:                            || type.getAuthenticationUserId()
210:                                    .getAuthenticationId() == null) {
211:                        type.setAuthenticationUserId(new AuthenticationUserId(
212:                                "not found"));
213:                    } else {
214:                        returnUrl.append(type.getAuthenticationUserId()
215:                                .getAuthenticationId());
216:                    }
217:
218:                    returnUrl.append("\">return value</a>");
219:                    type.setReturnUrl(returnUrl.toString());
220:                    StringBuffer actionsUrl = new StringBuffer();
221:                    UserCapabilities capabilities = KEWServiceLocator
222:                            .getUserService().getCapabilities();
223:                    int actionsAvailable = 0;
224:                    if (capabilities.isReportSupported()) {
225:                        // the following distinction is made in the Url because of admin limitation on creation and editing of users
226:                        actionsUrl.append("<a href=\""
227:                                + UrlResolver.getInstance().getUserReportUrl()
228:                                + "?workflowId="
229:                                + type.getWorkflowUserId().getWorkflowId()
230:                                + "&methodToCall=report&showEdit=yes"
231:                                + "\">Report</a>");
232:                        actionsAvailable++;
233:                    }
234:                    if (capabilities.isEditSupported()) {
235:                        if (actionsAvailable > 0) {
236:                            actionsUrl.append(" | ");
237:                        }
238:                        actionsUrl.append("<a href=\""
239:                                + UrlResolver.getInstance().getUserUrl()
240:                                + "?workflowId="
241:                                + type.getWorkflowUserId().getWorkflowId()
242:                                + "&methodToCall=edit" + "\">Edit</a>");
243:                        actionsAvailable++;
244:                    }
245:                    if (actionsAvailable == 0) {
246:                        actionsUrl.append("No actions available");
247:                    }
248:                    type.setActionsUrl(actionsUrl.toString());
249:                    displayList.add(type);
250:                }
251:                return displayList;
252:            }
253:
254:            public boolean checkForAdditionalFields(Map fieldValues,
255:                    HttpServletRequest request) throws Exception {
256:                return false;
257:            }
258:
259:            public List getDefaultReturnType() {
260:                List returnTypes = new ArrayList();
261:                returnTypes.add(NETWORK_ID_PROPERTY_NAME);
262:                return returnTypes;
263:            }
264:
265:            /**
266:             * @return Returns the title.
267:             */
268:            public String getTitle() {
269:                return title;
270:            }
271:
272:            /**
273:             * @return Returns the instructions.
274:             */
275:            public String getLookupInstructions() {
276:                return Utilities
277:                        .getApplicationConstant(EdenConstants.USER_SEARCH_INSTRUCTION_KEY);
278:            }
279:
280:            /**
281:             * @return Returns the returnLocation.
282:             */
283:            public String getReturnLocation() {
284:                return returnLocation;
285:            }
286:
287:            /**
288:             * @return Returns the columns.
289:             */
290:            public List getColumns() {
291:                return columns;
292:            }
293:
294:            public String getHtmlMenuBar() {
295:                if (!KEWServiceLocator.getUserService().getCapabilities()
296:                        .isCreateSupported()) {
297:                    return "";
298:                }
299:                return "<a href=\"" + UrlResolver.getInstance().getUserUrl()
300:                        + "?methodToCall=createNew\">Create a New User</a>";
301:            }
302:
303:            public List getRows() {
304:                return rows;
305:            }
306:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.