Source Code Cross Referenced for CompleteAction.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » actions » 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.actions 
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.actions;
018:
019:        import java.util.Iterator;
020:        import java.util.List;
021:
022:        import org.apache.log4j.MDC;
023:
024:        import edu.iu.uis.eden.EdenConstants;
025:        import edu.iu.uis.eden.actionrequests.ActionRequestValue;
026:        import edu.iu.uis.eden.exception.EdenUserNotFoundException;
027:        import edu.iu.uis.eden.exception.InvalidActionTakenException;
028:        import edu.iu.uis.eden.exception.ResourceUnavailableException;
029:        import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
030:        import edu.iu.uis.eden.user.WorkflowUser;
031:        import edu.iu.uis.eden.util.Utilities;
032:
033:        /**
034:         * CompleteAction records and process a complete action
035:         *
036:         * The routeheader is first checked to make sure the action is valid for the document.
037:         * Next the user is checked to make sure he/she has not taken a previous action on this
038:         * document at the actions responsibility or below. The action is recorded. Any requests
039:         * related to this user are deactivated.
040:         *
041:         * @author rkirkend
042:         * @author ewestfal
043:         * @author seiffert
044:         */
045:        public class CompleteAction extends ActionTakenEvent {
046:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
047:                    .getLogger(CompleteAction.class);
048:
049:            /**
050:             * @param rh
051:             *            RouteHeader for the document upon which the action is taken.
052:             * @param user
053:             *            User taking the action.
054:             */
055:            public CompleteAction(DocumentRouteHeaderValue rh, WorkflowUser user) {
056:                super (rh, user);
057:                setActionTakenCode(EdenConstants.ACTION_TAKEN_COMPLETED_CD);
058:            }
059:
060:            /**
061:             * @param rh
062:             *            RouteHeader for the document upon which the action is taken.
063:             * @param user
064:             *            User taking the action.
065:             * @param annotation
066:             *            User comment on the action taken
067:             */
068:            public CompleteAction(DocumentRouteHeaderValue rh,
069:                    WorkflowUser user, String annotation) {
070:                super (rh, user, annotation);
071:                setActionTakenCode(EdenConstants.ACTION_TAKEN_COMPLETED_CD);
072:            }
073:
074:            /* (non-Javadoc)
075:             * @see edu.iu.uis.eden.actions.ActionTakenEvent#isActionCompatibleRequest(java.util.List)
076:             */
077:            @Override
078:            public String validateActionRules()
079:                    throws EdenUserNotFoundException {
080:                return validateActionRules(getActionRequestService()
081:                        .findAllValidRequests(getUser(),
082:                                routeHeader.getRouteHeaderId(),
083:                                EdenConstants.ACTION_REQUEST_COMPLETE_REQ));
084:            }
085:
086:            private String validateActionRules(List actionRequests)
087:                    throws EdenUserNotFoundException {
088:                String super Error = super .validateActionTakenRules();
089:                if (!Utilities.isEmpty(super Error)) {
090:                    return super Error;
091:                }
092:                if (!getRouteHeader().isValidActionToTake(
093:                        getActionPerformedCode())) {
094:                    return "Document is not in a state to be completed";
095:                }
096:                if (!isActionCompatibleRequest(actionRequests)) {
097:                    return "No request for the user is compatible "
098:                            + "with the COMPLETE action";
099:                }
100:                return "";
101:            }
102:
103:            /* (non-Javadoc)
104:             * @see edu.iu.uis.eden.actions.ActionTakenEvent#isActionCompatibleRequest(java.util.List)
105:             */
106:            @Override
107:            public boolean isActionCompatibleRequest(List requests)
108:                    throws EdenUserNotFoundException {
109:                // we allow pre-approval
110:                if (requests.isEmpty()) {
111:                    return true;
112:                }
113:
114:                // can always cancel saved or initiated document
115:                if (routeHeader.isStateInitiated()
116:                        || routeHeader.isStateSaved()) {
117:                    return true;
118:                }
119:
120:                boolean actionCompatible = false;
121:                Iterator ars = requests.iterator();
122:                ActionRequestValue actionRequest = null;
123:
124:                while (ars.hasNext()) {
125:                    actionRequest = (ActionRequestValue) ars.next();
126:                    String request = actionRequest.getActionRequested();
127:
128:                    // Complete action matches Complete, Approve, FYI, and ACK requests
129:                    if ((EdenConstants.ACTION_REQUEST_FYI_REQ.equals(request))
130:                            || (EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ
131:                                    .equals(request))
132:                            || (EdenConstants.ACTION_REQUEST_APPROVE_REQ
133:                                    .equals(request))
134:                            || (EdenConstants.ACTION_REQUEST_COMPLETE_REQ
135:                                    .equals(request))) {
136:                        actionCompatible = true;
137:                        break;
138:                    }
139:                }
140:                return actionCompatible;
141:            }
142:
143:            /**
144:             * Records the complete action. - Checks to make sure the document status allows the action. - Checks that the user has not taken a previous action. - Deactivates the pending requests for this user - Records the action
145:             *
146:             * @throws InvalidActionTakenException
147:             * @throws ResourceUnavailableException
148:             */
149:            public void recordAction()
150:                    throws edu.iu.uis.eden.exception.InvalidActionTakenException,
151:                    EdenUserNotFoundException {
152:                MDC.put("docId", getRouteHeader().getRouteHeaderId());
153:                checkLocking();
154:                updateSearchableAttributesIfPossible();
155:                LOG.debug("Completing document : " + annotation);
156:
157:                List actionRequests = getActionRequestService()
158:                        .findAllValidRequests(getUser(), getRouteHeaderId(),
159:                                EdenConstants.ACTION_REQUEST_COMPLETE_REQ);
160:                LOG.debug("Checking to see if the action is legal");
161:                String errorMessage = validateActionRules(actionRequests);
162:                if (!Utilities.isEmpty(errorMessage)) {
163:                    throw new InvalidActionTakenException(errorMessage);
164:                }
165:
166:                //        LOG.debug("Checking to see if the action is legal");
167:                //
168:                //        if (! getRouteHeader().isValidActionToTake(getActionTakenCode())) {
169:                //            LOG.warn("Document not in state to be completed.");
170:                //            throw new InvalidActionTakenException("Document is not in a state to be completed");
171:                //        }
172:                //
173:                //        List actionRequests = getActionRequestService().findAllValidRequests(getUser(), getRouteHeaderId(), EdenConstants.ACTION_REQUEST_COMPLETE_REQ);
174:                //        //getActionRequestService().findAllPendingByUserAndDoc(getDelegator(), getRouteHeaderId());
175:
176:                LOG.debug("Record the complete action");
177:                saveActionTaken(findDelegatorForActionRequests(actionRequests));
178:
179:                //        if (!isActionCompatibleRequest(actionRequests, getActionTakenCode())) {
180:                //            throw new InvalidActionTakenException("No request for the user is compatible " + "with the DISAPPROVE or DENY action");
181:                //        }
182:
183:                LOG.debug("Deactivate all pending action requests");
184:                getActionRequestService().deactivateRequests(actionTaken,
185:                        actionRequests);
186:                notifyActionTaken(this .actionTaken);
187:
188:                boolean isException = getRouteHeader().isInException();
189:                boolean isSaved = getRouteHeader().isStateSaved();
190:                if (isException || isSaved) {
191:                    String oldStatus = getRouteHeader().getDocRouteStatus();
192:                    LOG.debug("Moving document back to Enroute from "
193:                            + EdenConstants.DOCUMENT_STATUSES.get(oldStatus));
194:                    getRouteHeader().markDocumentEnroute();
195:                    String newStatus = getRouteHeader().getDocRouteStatus();
196:                    notifyStatusChange(newStatus, oldStatus);
197:                    this.getRouteHeaderService().saveRouteHeader(
198:                            getRouteHeader());
199:                }
200:            }
201:
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.