Source Code Cross Referenced for ActionTakenServiceImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » actiontaken » 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.actiontaken 
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.actiontaken;
018:
019:        import java.util.ArrayList;
020:        import java.util.Collection;
021:        import java.util.Iterator;
022:        import java.util.List;
023:
024:        import edu.iu.uis.eden.EdenConstants;
025:        import edu.iu.uis.eden.KEWServiceLocator;
026:        import edu.iu.uis.eden.WorkflowServiceErrorException;
027:        import edu.iu.uis.eden.WorkflowServiceErrorImpl;
028:        import edu.iu.uis.eden.actionrequests.ActionRequestValue;
029:        import edu.iu.uis.eden.actiontaken.dao.ActionTakenDAO;
030:        import edu.iu.uis.eden.exception.EdenUserNotFoundException;
031:        import edu.iu.uis.eden.routeheader.RouteHeaderService;
032:        import edu.iu.uis.eden.user.UserService;
033:        import edu.iu.uis.eden.user.WorkflowUser;
034:        import edu.iu.uis.eden.user.WorkflowUserId;
035:        import edu.iu.uis.eden.workgroup.WorkgroupService;
036:
037:        /**
038:         * Default implementation of the {@link ActionTakenService}.
039:         * 
040:         * @author rkirkend
041:         * @author ewestfal
042:         */
043:        public class ActionTakenServiceImpl implements  ActionTakenService {
044:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
045:                    .getLogger(ActionTakenServiceImpl.class);
046:            private ActionTakenDAO actionTakenDAO;
047:
048:            public ActionTakenValue load(Long id) {
049:                return getActionTakenDAO().load(id);
050:            }
051:
052:            public ActionTakenValue findByActionTakenId(Long actionTakenId) {
053:                return getActionTakenDAO().findByActionTakenId(actionTakenId);
054:            }
055:
056:            public ActionTakenValue getPreviousAction(
057:                    ActionRequestValue actionRequest)
058:                    throws EdenUserNotFoundException {
059:                return getPreviousAction(actionRequest, null);
060:            }
061:
062:            public ActionTakenValue getPreviousAction(
063:                    ActionRequestValue actionRequest, List simulatedActionsTaken)
064:                    throws EdenUserNotFoundException {
065:
066:                ActionTakenValue foundActionTaken = null;
067:                List users = new ArrayList();
068:                if (actionRequest.isWorkgroupRequest()) {
069:                    users.addAll(actionRequest.getWorkgroup().getUsers());
070:                } else if (actionRequest.isUserRequest()) {
071:                    users.add(actionRequest.getWorkflowUser());
072:                }
073:
074:                for (Iterator iter = users.iterator(); iter.hasNext();) {
075:                    WorkflowUser user = (WorkflowUser) iter.next();
076:                    List actionsTakenByUser = getActionTakenDAO()
077:                            .findByRouteHeaderIdWorkflowId(
078:                                    actionRequest.getRouteHeaderId(),
079:                                    user.getWorkflowUserId().getWorkflowId());
080:                    if (simulatedActionsTaken != null) {
081:                        actionsTakenByUser.addAll(simulatedActionsTaken);
082:                    }
083:
084:                    for (Iterator iterator = actionsTakenByUser.iterator(); iterator
085:                            .hasNext();) {
086:                        ActionTakenValue actionTaken = (ActionTakenValue) iterator
087:                                .next();
088:                        if (ActionRequestValue.compareActionCode(actionTaken
089:                                .getActionTaken(), actionRequest
090:                                .getActionRequested()) >= 0) {
091:                            foundActionTaken = actionTaken;
092:                        }
093:                    }
094:                }
095:
096:                return foundActionTaken;
097:            }
098:
099:            public Collection findByDocIdAndAction(Long docId, String action) {
100:                return getActionTakenDAO().findByDocIdAndAction(docId, action);
101:            }
102:
103:            public Collection findByRouteHeaderId(Long routeHeaderId) {
104:                return getActionTakenDAO().findByRouteHeaderId(routeHeaderId);
105:            }
106:
107:            public List findByRouteHeaderIdWorkflowId(Long routeHeaderId,
108:                    String workflowId) {
109:                return getActionTakenDAO().findByRouteHeaderIdWorkflowId(
110:                        routeHeaderId, workflowId);
111:            }
112:
113:            public Collection getActionsTaken(Long routeHeaderId) {
114:                return getActionTakenDAO().findByRouteHeaderId(routeHeaderId);
115:            }
116:
117:            public List findByRouteHeaderIdIgnoreCurrentInd(Long routeHeaderId) {
118:                return getActionTakenDAO().findByRouteHeaderIdIgnoreCurrentInd(
119:                        routeHeaderId);
120:            }
121:
122:            public void saveActionTaken(ActionTakenValue actionTaken) {
123:                this .getActionTakenDAO().saveActionTaken(actionTaken);
124:            }
125:
126:            public void delete(ActionTakenValue actionTaken) {
127:                getActionTakenDAO().deleteActionTaken(actionTaken);
128:            }
129:
130:            public ActionTakenDAO getActionTakenDAO() {
131:                return actionTakenDAO;
132:            }
133:
134:            public void setActionTakenDAO(ActionTakenDAO actionTakenDAO) {
135:                this .actionTakenDAO = actionTakenDAO;
136:            }
137:
138:            public WorkgroupService getWorkgroupService() {
139:                return (WorkgroupService) KEWServiceLocator
140:                        .getService(KEWServiceLocator.WORKGROUP_SRV);
141:            }
142:
143:            public void deleteByRouteHeaderId(Long routeHeaderId) {
144:                actionTakenDAO.deleteByRouteHeaderId(routeHeaderId);
145:            }
146:
147:            public void validateActionTaken(ActionTakenValue actionTaken) {
148:                LOG.debug("Enter validateActionTaken(..)");
149:                List errors = new ArrayList();
150:
151:                Long routeHeaderId = actionTaken.getRouteHeaderId();
152:                if (routeHeaderId == null) {
153:                    errors.add(new WorkflowServiceErrorImpl(
154:                            "ActionTaken routeheaderid null.",
155:                            "actiontaken.routeheaderid.empty", actionTaken
156:                                    .getActionTakenId().toString()));
157:                } else if (getRouteHeaderService()
158:                        .getRouteHeader(routeHeaderId) == null) {
159:                    errors.add(new WorkflowServiceErrorImpl(
160:                            "ActionTaken routeheaderid invalid.",
161:                            "actiontaken.routeheaderid.invalid", actionTaken
162:                                    .getActionTakenId().toString()));
163:                }
164:
165:                String userId = actionTaken.getWorkflowId();
166:                if (userId == null || userId.trim().equals("")) {
167:                    errors.add(new WorkflowServiceErrorImpl(
168:                            "ActionTaken personid null.",
169:                            "actiontaken.personid.empty", actionTaken
170:                                    .getActionTakenId().toString()));
171:                } else {
172:                    try {
173:                        getUserService().getWorkflowUser(
174:                                new WorkflowUserId(userId));
175:                    } catch (EdenUserNotFoundException e) {
176:                        errors.add(new WorkflowServiceErrorImpl(
177:                                "ActionTaken personid invalid.",
178:                                "actiontaken.personid.invalid", actionTaken
179:                                        .getActionTakenId().toString()));
180:                    }
181:                }
182:                String actionTakenCd = actionTaken.getActionTaken();
183:                if (actionTakenCd == null || actionTakenCd.trim().equals("")) {
184:                    errors.add(new WorkflowServiceErrorImpl(
185:                            "ActionTaken cd null.",
186:                            "actiontaken.actiontaken.empty", actionTaken
187:                                    .getActionTakenId().toString()));
188:                } else if (!EdenConstants.ACTION_TAKEN_CD
189:                        .containsKey(actionTakenCd)) {
190:                    errors.add(new WorkflowServiceErrorImpl(
191:                            "ActionTaken invalid.",
192:                            "actiontaken.actiontaken.invalid", actionTaken
193:                                    .getActionTakenId().toString()));
194:                }
195:                if (actionTaken.getActionDate() == null) {
196:                    errors.add(new WorkflowServiceErrorImpl(
197:                            "ActionTaken actiondate null.",
198:                            "actiontaken.actiondate.empty", actionTaken
199:                                    .getActionTakenId().toString()));
200:                }
201:
202:                if (actionTaken.getDocVersion() == null) {
203:                    errors.add(new WorkflowServiceErrorImpl(
204:                            "ActionTaken docversion null.",
205:                            "actiontaken.docverion.empty", actionTaken
206:                                    .getActionTakenId().toString()));
207:                }
208:                LOG.debug("Exit validateActionRequest(..) ");
209:                if (!errors.isEmpty()) {
210:                    throw new WorkflowServiceErrorException(
211:                            "ActionRequest Validation Error", errors);
212:                }
213:            }
214:
215:            private RouteHeaderService getRouteHeaderService() {
216:                return (RouteHeaderService) KEWServiceLocator
217:                        .getService(KEWServiceLocator.DOC_ROUTE_HEADER_SRV);
218:            }
219:
220:            private UserService getUserService() {
221:                return (UserService) KEWServiceLocator
222:                        .getService(KEWServiceLocator.USER_SERVICE);
223:            }
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.