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