Source Code Cross Referenced for AssignContractManagerDocument.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » purap » document » 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.module.purap.document 
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:
017:        package org.kuali.module.purap.document;
018:
019:        import java.util.ArrayList;
020:        import java.util.HashMap;
021:        import java.util.Iterator;
022:        import java.util.List;
023:        import java.util.Map;
024:
025:        import org.apache.commons.lang.StringUtils;
026:        import org.kuali.core.document.TransactionalDocumentBase;
027:        import org.kuali.core.service.BusinessObjectService;
028:        import org.kuali.core.util.ObjectUtils;
029:        import org.kuali.core.workflow.service.KualiWorkflowDocument;
030:        import org.kuali.kfs.context.SpringContext;
031:        import org.kuali.kfs.service.ParameterService;
032:        import org.kuali.module.purap.PurapConstants;
033:        import org.kuali.module.purap.PurapParameterConstants;
034:        import org.kuali.module.purap.PurapPropertyConstants;
035:        import org.kuali.module.purap.PurapWorkflowConstants;
036:        import org.kuali.module.purap.bo.AssignContractManagerDetail;
037:        import org.kuali.module.purap.service.PurapService;
038:        import org.kuali.module.purap.service.PurchaseOrderService;
039:        import org.kuali.module.purap.service.RequisitionService;
040:
041:        import edu.iu.uis.eden.EdenConstants;
042:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
043:        import edu.iu.uis.eden.exception.WorkflowException;
044:
045:        public class AssignContractManagerDocument extends
046:                TransactionalDocumentBase {
047:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
048:                    .getLogger(AssignContractManagerDocument.class);
049:
050:            private List<AssignContractManagerDetail> assignContractManagerDetails = new ArrayList();
051:
052:            // Not persisted (only for labels in tag)
053:            private String requisitionNumber;
054:            private String deliveryCampusCode;
055:            private String vendorName;
056:            private String generalDescription;
057:            private String requisitionTotalAmount;
058:            private String requisitionCreateDate;
059:            private String firstItemDescription;
060:            private String firstObjectCode;
061:
062:            /**
063:             * Default constructor.
064:             */
065:            public AssignContractManagerDocument() {
066:                super ();
067:            }
068:
069:            public AssignContractManagerDetail getAssignContractManagerDetail(
070:                    int index) {
071:                while (assignContractManagerDetails.size() <= index) {
072:                    assignContractManagerDetails
073:                            .add(new AssignContractManagerDetail());
074:                }
075:                return (AssignContractManagerDetail) assignContractManagerDetails
076:                        .get(index);
077:            }
078:
079:            /**
080:             * Perform logic needed to populate the Assign Contract Manager Document with requisitions in status of Awaiting Contract
081:             * Manager Assignment.
082:             */
083:            public void populateDocumentWithRequisitions() {
084:                LOG
085:                        .debug("populateDocumentWithRequisitions() Entering method.");
086:
087:                Map fieldValues = new HashMap();
088:                fieldValues
089:                        .put(
090:                                PurapPropertyConstants.STATUS_CODE,
091:                                PurapConstants.RequisitionStatuses.AWAIT_CONTRACT_MANAGER_ASSGN);
092:                List<RequisitionDocument> unassignedRequisitions = new ArrayList(
093:                        SpringContext.getBean(BusinessObjectService.class)
094:                                .findMatchingOrderBy(RequisitionDocument.class,
095:                                        fieldValues,
096:                                        PurapPropertyConstants.PURAP_DOC_ID,
097:                                        true));
098:
099:                for (RequisitionDocument req : unassignedRequisitions) {
100:                    assignContractManagerDetails
101:                            .add(new AssignContractManagerDetail(this , req));
102:                }
103:                LOG.debug("populateDocumentWithRequisitions() Leaving method.");
104:            }
105:
106:            @Override
107:            public void handleRouteStatusChange() {
108:                LOG.debug("handleRouteStatusChange() Entering method.");
109:
110:                super .handleRouteStatusChange();
111:
112:                if (this .getDocumentHeader().getWorkflowDocument()
113:                        .stateIsProcessed()) {
114:                    boolean isSuccess = true;
115:                    StringBuffer failedReqs = new StringBuffer();
116:                    for (Iterator iter = this .getAssignContractManagerDetails()
117:                            .iterator(); iter.hasNext();) {
118:                        AssignContractManagerDetail detail = (AssignContractManagerDetail) iter
119:                                .next();
120:
121:                        if (ObjectUtils.isNotNull(detail
122:                                .getContractManagerCode())) {
123:                            // Get the requisition for this AssignContractManagerDetail.
124:                            RequisitionDocument req = SpringContext.getBean(
125:                                    RequisitionService.class)
126:                                    .getRequisitionById(
127:                                            detail.getRequisitionIdentifier());
128:
129:                            if (req
130:                                    .getStatusCode()
131:                                    .equals(
132:                                            PurapConstants.RequisitionStatuses.AWAIT_CONTRACT_MANAGER_ASSGN)) {
133:                                // only update REQ if code is empty and status is correct
134:                                SpringContext
135:                                        .getBean(PurapService.class)
136:                                        .updateStatus(
137:                                                req,
138:                                                PurapConstants.RequisitionStatuses.CLOSED);
139:                                SpringContext.getBean(RequisitionService.class)
140:                                        .saveDocumentWithoutValidation(req);
141:                                SpringContext
142:                                        .getBean(PurchaseOrderService.class)
143:                                        .createPurchaseOrderDocument(
144:                                                req,
145:                                                this 
146:                                                        .getDocumentHeader()
147:                                                        .getWorkflowDocument()
148:                                                        .getInitiatorNetworkId(),
149:                                                detail.getContractManagerCode());
150:
151:                            }
152:                        }
153:
154:                    }// endfor
155:
156:                    if (!isSuccess) {
157:                        failedReqs.deleteCharAt(failedReqs.lastIndexOf(","));
158:                        KualiWorkflowDocument workflowDoc = this 
159:                                .getDocumentHeader().getWorkflowDocument();
160:                        String currentNodeName = null;
161:                        try {
162:                            currentNodeName = PurapWorkflowConstants.DOC_ADHOC_NODE_NAME;
163:                            if (!(EdenConstants.ROUTE_HEADER_INITIATED_CD
164:                                    .equals(workflowDoc.getRouteHeader()
165:                                            .getDocRouteStatus()))) {
166:                                if (this .getCurrentRouteNodeName(workflowDoc) != null) {
167:                                    currentNodeName = this 
168:                                            .getCurrentRouteNodeName(workflowDoc);
169:                                }
170:                            }
171:                            workflowDoc
172:                                    .appSpecificRouteDocumentToUser(
173:                                            EdenConstants.ACTION_REQUEST_FYI_REQ,
174:                                            currentNodeName,
175:                                            0,
176:                                            PurapWorkflowConstants.AssignContractManagerDocument.ASSIGN_CONTRACT_DOC_ERROR_COMPLETING_POST_PROCESSING
177:                                                    + failedReqs,
178:                                            new NetworkIdVO(workflowDoc
179:                                                    .getInitiatorNetworkId()),
180:                                            "Initiator", true);
181:                        } catch (WorkflowException e) {
182:                            // do nothing; document should have processed successfully and problem is with sending FYI
183:                        }
184:                    }
185:                }
186:                LOG.debug("handleRouteStatusChange() Leaving method.");
187:            }
188:
189:            private String getCurrentRouteNodeName(KualiWorkflowDocument wd)
190:                    throws WorkflowException {
191:                String[] nodeNames = wd.getNodeNames();
192:                if ((nodeNames == null) || (nodeNames.length == 0)) {
193:                    return null;
194:                } else {
195:                    return nodeNames[0];
196:                }
197:            }
198:
199:            /**
200:             * @see org.kuali.core.document.Document#getDocumentTitle()
201:             */
202:            @Override
203:            public String getDocumentTitle() {
204:                String title = "";
205:                String specificTitle = SpringContext
206:                        .getBean(ParameterService.class)
207:                        .getParameterValue(
208:                                AssignContractManagerDocument.class,
209:                                PurapParameterConstants.PURAP_OVERRIDE_ASSIGN_CONTRACT_MGR_DOC_TITLE);
210:                if (StringUtils.equalsIgnoreCase(specificTitle, Boolean.TRUE
211:                        .toString())) {
212:                    title = PurapWorkflowConstants.AssignContractManagerDocument.WORKFLOW_DOCUMENT_TITLE;
213:                } else {
214:                    title = super .getDocumentTitle();
215:                }
216:                return title;
217:            }
218:
219:            public List getAssignContractManagerDetails() {
220:                return assignContractManagerDetails;
221:            }
222:
223:            public void setAssignContractManagerDetails(
224:                    List assignContractManagerDetails) {
225:                this .assignContractManagerDetails = assignContractManagerDetails;
226:            }
227:
228:            /**
229:             * Gets the firstObjectCode attribute.
230:             * 
231:             * @return Returns the firstObjectCode.
232:             */
233:            public String getFirstObjectCode() {
234:                return firstObjectCode;
235:            }
236:
237:            /**
238:             * Gets the deliveryCampusCode attribute.
239:             * 
240:             * @return Returns the deliveryCampusCode.
241:             */
242:            public String getDeliveryCampusCode() {
243:                return deliveryCampusCode;
244:            }
245:
246:            /**
247:             * Gets the firstItemDescription attribute.
248:             * 
249:             * @return Returns the firstItemDescription.
250:             */
251:            public String getFirstItemDescription() {
252:                return firstItemDescription;
253:            }
254:
255:            /**
256:             * Gets the generalDescription attribute.
257:             * 
258:             * @return Returns the generalDescription.
259:             */
260:            public String getGeneralDescription() {
261:                return generalDescription;
262:            }
263:
264:            /**
265:             * Gets the requisitionCreateDate attribute.
266:             * 
267:             * @return Returns the requisitionCreateDate.
268:             */
269:            public String getRequisitionCreateDate() {
270:                return requisitionCreateDate;
271:            }
272:
273:            /**
274:             * Gets the requisitionNumber attribute.
275:             * 
276:             * @return Returns the requisitionNumber.
277:             */
278:            public String getRequisitionNumber() {
279:                return requisitionNumber;
280:            }
281:
282:            /**
283:             * Gets the requisitionTotalAmount attribute.
284:             * 
285:             * @return Returns the requisitionTotalAmount.
286:             */
287:            public String getRequisitionTotalAmount() {
288:                return requisitionTotalAmount;
289:            }
290:
291:            /**
292:             * Gets the vendorName attribute.
293:             * 
294:             * @return Returns the vendorName.
295:             */
296:            public String getVendorName() {
297:                return vendorName;
298:            }
299:
300:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.