Source Code Cross Referenced for RequisitionDocument.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.Calendar;
021:        import java.util.Date;
022:        import java.util.Iterator;
023:        import java.util.List;
024:        import java.util.Map;
025:
026:        import org.apache.commons.lang.StringUtils;
027:        import org.kuali.core.bo.DocumentHeader;
028:        import org.kuali.core.document.Copyable;
029:        import org.kuali.core.document.Document;
030:        import org.kuali.core.exceptions.ValidationException;
031:        import org.kuali.core.service.BusinessObjectService;
032:        import org.kuali.core.service.DateTimeService;
033:        import org.kuali.core.service.KualiConfigurationService;
034:        import org.kuali.core.service.PersistenceService;
035:        import org.kuali.core.util.GlobalVariables;
036:        import org.kuali.core.util.KualiDecimal;
037:        import org.kuali.core.util.ObjectUtils;
038:        import org.kuali.core.workflow.service.KualiWorkflowDocument;
039:        import org.kuali.core.workflow.service.KualiWorkflowInfo;
040:        import org.kuali.core.workflow.service.WorkflowDocumentService;
041:        import org.kuali.kfs.KFSConstants;
042:        import org.kuali.kfs.context.SpringContext;
043:        import org.kuali.kfs.service.ConciseXmlDocumentConversionService;
044:        import org.kuali.kfs.service.ParameterService;
045:        import org.kuali.module.financial.service.UniversityDateService;
046:        import org.kuali.module.purap.PurapConstants;
047:        import org.kuali.module.purap.PurapKeyConstants;
048:        import org.kuali.module.purap.PurapParameterConstants;
049:        import org.kuali.module.purap.PurapConstants.RequisitionStatuses;
050:        import org.kuali.module.purap.PurapWorkflowConstants.NodeDetails;
051:        import org.kuali.module.purap.PurapWorkflowConstants.RequisitionDocument.NodeDetailEnum;
052:        import org.kuali.module.purap.bo.BillingAddress;
053:        import org.kuali.module.purap.bo.PurApAccountingLine;
054:        import org.kuali.module.purap.bo.PurapUser;
055:        import org.kuali.module.purap.bo.RequisitionAccount;
056:        import org.kuali.module.purap.bo.RequisitionItem;
057:        import org.kuali.module.purap.bo.RequisitionView;
058:        import org.kuali.module.purap.service.PurapService;
059:        import org.kuali.module.purap.service.PurchaseOrderService;
060:        import org.kuali.module.purap.service.RequisitionService;
061:        import org.kuali.module.vendor.bo.VendorContract;
062:        import org.kuali.module.vendor.bo.VendorDetail;
063:        import org.kuali.module.vendor.service.PhoneNumberService;
064:        import org.kuali.module.vendor.service.VendorService;
065:
066:        import edu.iu.uis.eden.EdenConstants;
067:        import edu.iu.uis.eden.clientapp.vo.DocumentRouteLevelChangeVO;
068:        import edu.iu.uis.eden.clientapp.vo.ReportCriteriaVO;
069:        import edu.iu.uis.eden.exception.WorkflowException;
070:
071:        /**
072:         * Document class for the Requisition.
073:         */
074:        public class RequisitionDocument extends PurchasingDocumentBase
075:                implements  Copyable {
076:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
077:                    .getLogger(RequisitionDocument.class);
078:
079:            private String requisitionOrganizationReference1Text;
080:            private String requisitionOrganizationReference2Text;
081:            private String requisitionOrganizationReference3Text;
082:            private String alternate1VendorName;
083:            private String alternate2VendorName;
084:            private String alternate3VendorName;
085:            private String alternate4VendorName;
086:            private String alternate5VendorName;
087:            private KualiDecimal organizationAutomaticPurchaseOrderLimit;
088:
089:            /**
090:             * Default constructor.
091:             */
092:            public RequisitionDocument() {
093:                super ();
094:            }
095:
096:            /**
097:             * @see org.kuali.core.document.Document#getDocumentRepresentationForSerialization()
098:             */
099:            @Override
100:            protected Document getDocumentRepresentationForSerialization() {
101:                return SpringContext.getBean(
102:                        ConciseXmlDocumentConversionService.class)
103:                        .getDocumentForSerialization(this );
104:            }
105:
106:            /**
107:             * @see org.kuali.core.bo.PersistableBusinessObjectBase#isBoNotesSupport()
108:             */
109:            @Override
110:            public boolean isBoNotesSupport() {
111:                return true;
112:            }
113:
114:            /**
115:             * Performs logic needed to initiate Requisition Document.
116:             */
117:            public void initiateDocument() {
118:                this 
119:                        .setRequisitionSourceCode(PurapConstants.RequisitionSources.STANDARD_ORDER);
120:                this 
121:                        .setStatusCode(PurapConstants.RequisitionStatuses.IN_PROCESS);
122:                this 
123:                        .setPurchaseOrderCostSourceCode(PurapConstants.POCostSources.ESTIMATE);
124:                this 
125:                        .setPurchaseOrderTransmissionMethodCode(determinePurchaseOrderTransmissionMethod());
126:
127:                // set the default funding source
128:                this .setFundingSourceCode(SpringContext.getBean(
129:                        ParameterService.class).getParameterValue(getClass(),
130:                        PurapConstants.DEFAULT_FUNDING_SOURCE));
131:
132:                PurapUser currentUser = (PurapUser) GlobalVariables
133:                        .getUserSession().getUniversalUser().getModuleUser(
134:                                PurapUser.MODULE_ID);
135:                this .setChartOfAccountsCode(currentUser
136:                        .getChartOfAccountsCode());
137:                this .setOrganizationCode(currentUser.getOrganizationCode());
138:                this .setDeliveryCampusCode(currentUser.getUniversalUser()
139:                        .getCampusCode());
140:                this .setRequestorPersonName(currentUser.getUniversalUser()
141:                        .getPersonName());
142:                this .setRequestorPersonEmailAddress(currentUser
143:                        .getUniversalUser().getPersonEmailAddress());
144:                this .setRequestorPersonPhoneNumber(SpringContext.getBean(
145:                        PhoneNumberService.class).formatNumberIfPossible(
146:                        currentUser.getUniversalUser()
147:                                .getPersonLocalPhoneNumber()));
148:
149:                // set the APO limit
150:                this .setOrganizationAutomaticPurchaseOrderLimit(SpringContext
151:                        .getBean(PurapService.class).getApoLimit(
152:                                this .getVendorContractGeneratedIdentifier(),
153:                                this .getChartOfAccountsCode(),
154:                                this .getOrganizationCode()));
155:
156:                BillingAddress billingAddress = new BillingAddress();
157:                billingAddress.setBillingCampusCode(this 
158:                        .getDeliveryCampusCode());
159:                Map keys = SpringContext.getBean(PersistenceService.class)
160:                        .getPrimaryKeyFieldValues(billingAddress);
161:                billingAddress = (BillingAddress) SpringContext.getBean(
162:                        BusinessObjectService.class).findByPrimaryKey(
163:                        BillingAddress.class, keys);
164:                this .templateBillingAddress(billingAddress);
165:
166:                SpringContext.getBean(PurapService.class).addBelowLineItems(
167:                        this );
168:                this .refreshNonUpdateableReferences();
169:            }
170:
171:            /**
172:             * Determines what PO transmission method to use.
173:             * 
174:             * @return the PO PO transmission method to use.
175:             */
176:            private String determinePurchaseOrderTransmissionMethod() {
177:                // KULPURAP-826: Return a value based on a sys param. Perhaps later change it to more dynamic logic
178:                return SpringContext
179:                        .getBean(ParameterService.class)
180:                        .getParameterValue(
181:                                getClass(),
182:                                PurapParameterConstants.PURAP_DEFAULT_PO_TRANSMISSION_CODE);
183:            }
184:
185:            /**
186:             * Checks whether copying of this document should be allowed. Copying is not allowed if this is a B2B requistion, and more than
187:             * a set number of days have passed since the document's creation.
188:             * 
189:             * @return True if copying of this requisition is allowed.
190:             * @see org.kuali.core.document.Document#getAllowsCopy()
191:             */
192:            @Override
193:            public boolean getAllowsCopy() {
194:                boolean allowsCopy = super .getAllowsCopy();
195:                if (this .getRequisitionSourceCode().equals(
196:                        PurapConstants.RequisitionSources.B2B)) {
197:                    DateTimeService dateTimeService = SpringContext
198:                            .getBean(DateTimeService.class);
199:                    Calendar c = Calendar.getInstance();
200:                    DocumentHeader dh = this .getDocumentHeader();
201:                    KualiWorkflowDocument wd = dh.getWorkflowDocument();
202:
203:                    // The allowed copy date is the document creation date plus a set number of days.
204:                    Date createDate = wd.getCreateDate();
205:                    c.setTime(createDate);
206:                    String allowedCopyDays = SpringContext.getBean(
207:                            ParameterService.class).getParameterValue(
208:                            getClass(), PurapConstants.B2_B_ALLOW_COPY_DAYS);
209:                    c.add(Calendar.DATE, Integer.parseInt(allowedCopyDays));
210:                    Date allowedCopyDate = c.getTime();
211:                    Date currentDate = dateTimeService.getCurrentDate();
212:
213:                    // Return true if the current time is before the allowed copy date.
214:                    allowsCopy = (dateTimeService.dateDiff(currentDate,
215:                            allowedCopyDate, false) > 0);
216:                }
217:                return allowsCopy;
218:            }
219:
220:            /**
221:             * Performs logic needed to copy Requisition Document.
222:             * 
223:             * @see org.kuali.core.document.Document#toCopy()
224:             */
225:            @Override
226:            public void toCopy() throws WorkflowException, ValidationException {
227:                // Need to clear this identifier before copy so that related documents appear to be none
228:                this .setAccountsPayablePurchasingDocumentLinkIdentifier(null);
229:                super .toCopy();
230:                PurapUser currentUser = (PurapUser) GlobalVariables
231:                        .getUserSession().getUniversalUser().getModuleUser(
232:                                PurapUser.MODULE_ID);
233:                this .setPurapDocumentIdentifier(null);
234:
235:                // Set req status to INPR.
236:                this 
237:                        .setStatusCode(PurapConstants.RequisitionStatuses.IN_PROCESS);
238:
239:                // Set fields from the user.
240:                this .setChartOfAccountsCode(currentUser
241:                        .getChartOfAccountsCode());
242:                this .setOrganizationCode(currentUser.getOrganizationCode());
243:                this .setPostingYear(SpringContext.getBean(
244:                        UniversityDateService.class).getCurrentFiscalYear());
245:
246:                boolean activeVendor = true;
247:                boolean activeContract = true;
248:                Date today = SpringContext.getBean(DateTimeService.class)
249:                        .getCurrentDate();
250:                VendorContract vendorContract = new VendorContract();
251:                vendorContract.setVendorContractGeneratedIdentifier(this 
252:                        .getVendorContractGeneratedIdentifier());
253:                Map keys = SpringContext.getBean(PersistenceService.class)
254:                        .getPrimaryKeyFieldValues(vendorContract);
255:                vendorContract = (VendorContract) SpringContext.getBean(
256:                        BusinessObjectService.class).findByPrimaryKey(
257:                        VendorContract.class, keys);
258:                if (!(vendorContract != null
259:                        && today.after(vendorContract
260:                                .getVendorContractBeginningDate()) && today
261:                        .before(vendorContract.getVendorContractEndDate()))) {
262:                    activeContract = false;
263:                }
264:
265:                VendorDetail vendorDetail = SpringContext.getBean(
266:                        VendorService.class).getVendorDetail(
267:                        this .getVendorHeaderGeneratedIdentifier(),
268:                        this .getVendorDetailAssignedIdentifier());
269:                if (!(vendorDetail != null && vendorDetail.isActiveIndicator())) {
270:                    activeVendor = false;
271:                }
272:
273:                // B2B - only copy if contract and vendor are both active (throw separate errors to print to screen)
274:                if (this .getRequisitionSourceCode().equals(
275:                        PurapConstants.RequisitionSources.B2B)) {
276:                    if (!activeContract) {
277:                        throw new ValidationException(
278:                                PurapKeyConstants.ERROR_REQ_COPY_EXPIRED_CONTRACT);
279:                    }
280:                    if (!activeVendor) {
281:                        throw new ValidationException(
282:                                PurapKeyConstants.ERROR_REQ_COPY_INACTIVE_VENDOR);
283:                    }
284:                }
285:
286:                if (!activeVendor) {
287:                    this .setVendorHeaderGeneratedIdentifier(null);
288:                    this .setVendorDetailAssignedIdentifier(null);
289:                    this .setVendorContractGeneratedIdentifier(null);
290:                }
291:                if (!activeContract) {
292:                    this .setVendorContractGeneratedIdentifier(null);
293:                }
294:
295:                // These fields should not be set in this method; force to be null
296:                this .setVendorNoteText(null);
297:                this .setInstitutionContactName(null);
298:                this .setInstitutionContactPhoneNumber(null);
299:                this .setInstitutionContactEmailAddress(null);
300:                this .setOrganizationAutomaticPurchaseOrderLimit(null);
301:                this .setPurchaseOrderAutomaticIndicator(false);
302:
303:                // Fill the BO Notes with an empty List.
304:                this .setBoNotes(new ArrayList());
305:
306:                for (Iterator iter = this .getItems().iterator(); iter.hasNext();) {
307:                    RequisitionItem item = (RequisitionItem) iter.next();
308:                    item.setPurapDocumentIdentifier(null);
309:                    item.setItemIdentifier(null);
310:                    for (Iterator acctIter = item.getSourceAccountingLines()
311:                            .iterator(); acctIter.hasNext();) {
312:                        RequisitionAccount account = (RequisitionAccount) acctIter
313:                                .next();
314:                        account.setAccountIdentifier(null);
315:                        account.setItemIdentifier(null);
316:                    }
317:                }
318:
319:                SpringContext.getBean(PurapService.class).addBelowLineItems(
320:                        this );
321:                this .setOrganizationAutomaticPurchaseOrderLimit(SpringContext
322:                        .getBean(PurapService.class).getApoLimit(
323:                                this .getVendorContractGeneratedIdentifier(),
324:                                this .getChartOfAccountsCode(),
325:                                this .getOrganizationCode()));
326:                this .refreshNonUpdateableReferences();
327:            }
328:
329:            /**
330:             * Updates status of this document and saves it.
331:             * 
332:             * @param statusCode the status code of the current status.
333:             */
334:            private void updateStatusAndSave(String statusCode) {
335:                SpringContext.getBean(PurapService.class).updateStatus(this ,
336:                        statusCode);
337:                SpringContext.getBean(RequisitionService.class)
338:                        .saveDocumentWithoutValidation(this );
339:            }
340:
341:            /**
342:             * @see org.kuali.core.document.DocumentBase#handleRouteStatusChange()
343:             */
344:            @Override
345:            public void handleRouteStatusChange() {
346:                LOG.debug("handleRouteStatusChange() started");
347:                super .handleRouteStatusChange();
348:                try {
349:                    // DOCUMENT PROCESSED
350:                    if (this .getDocumentHeader().getWorkflowDocument()
351:                            .stateIsProcessed()) {
352:                        String newRequisitionStatus = PurapConstants.RequisitionStatuses.AWAIT_CONTRACT_MANAGER_ASSGN;
353:                        if (SpringContext.getBean(RequisitionService.class)
354:                                .isAutomaticPurchaseOrderAllowed(this )) {
355:                            newRequisitionStatus = PurapConstants.RequisitionStatuses.CLOSED;
356:                            SpringContext.getBean(PurchaseOrderService.class)
357:                                    .createAutomaticPurchaseOrderDocument(this );
358:                        }
359:                        updateStatusAndSave(newRequisitionStatus);
360:                    }
361:                    // DOCUMENT DISAPPROVED
362:                    else if (this .getDocumentHeader().getWorkflowDocument()
363:                            .stateIsDisapproved()) {
364:                        String nodeName = SpringContext.getBean(
365:                                WorkflowDocumentService.class)
366:                                .getCurrentRouteLevelName(
367:                                        getDocumentHeader()
368:                                                .getWorkflowDocument());
369:                        NodeDetails currentNode = NodeDetailEnum
370:                                .getNodeDetailEnumByName(nodeName);
371:                        if (ObjectUtils.isNotNull(currentNode)) {
372:                            if (StringUtils.isNotBlank(currentNode
373:                                    .getDisapprovedStatusCode())) {
374:                                updateStatusAndSave(currentNode
375:                                        .getDisapprovedStatusCode());
376:                                return;
377:                            }
378:                        }
379:                        logAndThrowRuntimeException("No status found to set for document being disapproved in node '"
380:                                + nodeName + "'");
381:                    }
382:                    // DOCUMENT CANCELED
383:                    else if (this .getDocumentHeader().getWorkflowDocument()
384:                            .stateIsCanceled()) {
385:                        updateStatusAndSave(RequisitionStatuses.CANCELLED);
386:                    }
387:                } catch (WorkflowException e) {
388:                    logAndThrowRuntimeException(
389:                            "Error saving routing data while saving document with id "
390:                                    + getDocumentNumber(), e);
391:                }
392:                LOG.debug("handleRouteStatusChange() ending");
393:            }
394:
395:            /**
396:             * @see org.kuali.core.document.DocumentBase#handleRouteLevelChange(edu.iu.uis.eden.clientapp.vo.DocumentRouteLevelChangeVO)
397:             */
398:            @Override
399:            public void handleRouteLevelChange(DocumentRouteLevelChangeVO change) {
400:                LOG.debug("handleRouteLevelChange() started");
401:                super .handleRouteLevelChange(change);
402:                try {
403:                    String newNodeName = change.getNewNodeName();
404:                    if (StringUtils.isNotBlank(newNodeName)) {
405:                        ReportCriteriaVO reportCriteriaVO = new ReportCriteriaVO(
406:                                Long.valueOf(getDocumentNumber()));
407:                        reportCriteriaVO.setTargetNodeName(newNodeName);
408:                        if (SpringContext
409:                                .getBean(KualiWorkflowInfo.class)
410:                                .documentWillHaveAtLeastOneActionRequest(
411:                                        reportCriteriaVO,
412:                                        new String[] {
413:                                                EdenConstants.ACTION_REQUEST_APPROVE_REQ,
414:                                                EdenConstants.ACTION_REQUEST_COMPLETE_REQ })) {
415:                            NodeDetails currentNode = NodeDetailEnum
416:                                    .getNodeDetailEnumByName(newNodeName);
417:                            if (ObjectUtils.isNotNull(currentNode)) {
418:                                if (StringUtils.isNotBlank(currentNode
419:                                        .getAwaitingStatusCode())) {
420:                                    updateStatusAndSave(currentNode
421:                                            .getAwaitingStatusCode());
422:                                }
423:                            }
424:                        } else {
425:                            LOG.debug("Document with id " + getDocumentNumber()
426:                                    + " will not stop in route node '"
427:                                    + newNodeName + "'");
428:                        }
429:                    }
430:                } catch (WorkflowException e) {
431:                    String errorMsg = "Workflow Error found checking actions requests on document with id "
432:                            + getDocumentNumber()
433:                            + ". *** WILL NOT UPDATE PURAP STATUS ***";
434:                    LOG.warn(errorMsg, e);
435:                }
436:            }
437:
438:            public String getVendorPaymentTermsCode() {
439:                if (ObjectUtils.isNotNull(getVendorDetail())) {
440:                    return getVendorDetail().getVendorPaymentTermsCode();
441:                }
442:                return "";
443:            }
444:
445:            public String getVendorShippingPaymentTermsCode() {
446:                if (ObjectUtils.isNotNull(getVendorDetail())) {
447:                    return getVendorDetail()
448:                            .getVendorShippingPaymentTermsCode();
449:                }
450:                return "";
451:            }
452:
453:            public String getVendorShippingTitleCode() {
454:                if (ObjectUtils.isNotNull(getVendorDetail())) {
455:                    return getVendorDetail().getVendorShippingTitleCode();
456:                }
457:                return "";
458:            }
459:
460:            public String getRequisitionOrganizationReference1Text() {
461:                return requisitionOrganizationReference1Text;
462:            }
463:
464:            public void setRequisitionOrganizationReference1Text(
465:                    String requisitionOrganizationReference1Text) {
466:                this .requisitionOrganizationReference1Text = requisitionOrganizationReference1Text;
467:            }
468:
469:            public String getRequisitionOrganizationReference2Text() {
470:                return requisitionOrganizationReference2Text;
471:            }
472:
473:            public void setRequisitionOrganizationReference2Text(
474:                    String requisitionOrganizationReference2Text) {
475:                this .requisitionOrganizationReference2Text = requisitionOrganizationReference2Text;
476:            }
477:
478:            public String getRequisitionOrganizationReference3Text() {
479:                return requisitionOrganizationReference3Text;
480:            }
481:
482:            public void setRequisitionOrganizationReference3Text(
483:                    String requisitionOrganizationReference3Text) {
484:                this .requisitionOrganizationReference3Text = requisitionOrganizationReference3Text;
485:            }
486:
487:            public String getAlternate1VendorName() {
488:                return alternate1VendorName;
489:            }
490:
491:            public void setAlternate1VendorName(String alternate1VendorName) {
492:                this .alternate1VendorName = alternate1VendorName;
493:            }
494:
495:            public String getAlternate2VendorName() {
496:                return alternate2VendorName;
497:            }
498:
499:            public void setAlternate2VendorName(String alternate2VendorName) {
500:                this .alternate2VendorName = alternate2VendorName;
501:            }
502:
503:            public String getAlternate3VendorName() {
504:                return alternate3VendorName;
505:            }
506:
507:            public void setAlternate3VendorName(String alternate3VendorName) {
508:                this .alternate3VendorName = alternate3VendorName;
509:            }
510:
511:            public String getAlternate4VendorName() {
512:                return alternate4VendorName;
513:            }
514:
515:            public void setAlternate4VendorName(String alternate4VendorName) {
516:                this .alternate4VendorName = alternate4VendorName;
517:            }
518:
519:            public String getAlternate5VendorName() {
520:                return alternate5VendorName;
521:            }
522:
523:            public void setAlternate5VendorName(String alternate5VendorName) {
524:                this .alternate5VendorName = alternate5VendorName;
525:            }
526:
527:            public KualiDecimal getOrganizationAutomaticPurchaseOrderLimit() {
528:                return organizationAutomaticPurchaseOrderLimit;
529:            }
530:
531:            public void setOrganizationAutomaticPurchaseOrderLimit(
532:                    KualiDecimal organizationAutomaticPurchaseOrderLimit) {
533:                this .organizationAutomaticPurchaseOrderLimit = organizationAutomaticPurchaseOrderLimit;
534:            }
535:
536:            public List<RequisitionView> getRelatedRequisitionViews() {
537:                return null;
538:            }
539:
540:            /**
541:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocumentBase#getItemClass()
542:             */
543:            @Override
544:            public Class getItemClass() {
545:                return RequisitionItem.class;
546:            }
547:
548:            /**
549:             * Returns null as requistion has no source document.
550:             * 
551:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocumentBase#getPurApSourceDocumentIfPossible()
552:             */
553:            @Override
554:            public PurchasingAccountsPayableDocument getPurApSourceDocumentIfPossible() {
555:                return null;
556:            }
557:
558:            /**
559:             * Returns null as requistion has no source document.
560:             * 
561:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocumentBase#getPurApSourceDocumentLabelIfPossible()
562:             */
563:            @Override
564:            public String getPurApSourceDocumentLabelIfPossible() {
565:                return null;
566:            }
567:
568:            /**
569:             * @see org.kuali.core.document.Document#getDocumentTitle()
570:             */
571:            @Override
572:            public String getDocumentTitle() {
573:                String title = "";
574:                String specificTitle = SpringContext.getBean(
575:                        ParameterService.class).getParameterValue(getClass(),
576:                        PurapParameterConstants.PURAP_OVERRIDE_REQ_DOC_TITLE);
577:                if (StringUtils.equalsIgnoreCase(specificTitle, Boolean.TRUE
578:                        .toString())) {
579:                    String docIdStr = "";
580:                    if ((this .getPurapDocumentIdentifier() != null)
581:                            && (StringUtils.isNotBlank(this 
582:                                    .getPurapDocumentIdentifier().toString()))) {
583:                        docIdStr = "Requisition: "
584:                                + this .getPurapDocumentIdentifier().toString();
585:                    }
586:                    String chartAcct = this .getFirstChartAccount();
587:                    String chartAcctStr = (chartAcct == null ? ""
588:                            : " - Account Number:  " + chartAcct);
589:                    title = docIdStr + chartAcctStr;
590:                } else {
591:                    title = super .getDocumentTitle();
592:                }
593:                return title;
594:            }
595:
596:            /**
597:             * Gets this requisition's Chart/Account of the first accounting line from the first item.
598:             * 
599:             * @return The first Chart and Account, or an empty string if there is none.
600:             */
601:            private String getFirstChartAccount() {
602:                String chartAcct = null;
603:                RequisitionItem item = (RequisitionItem) this .getItem(0);
604:                if (ObjectUtils.isNotNull(item)) {
605:                    PurApAccountingLine accountLine = item
606:                            .getSourceAccountingLine(0);
607:                    if (ObjectUtils.isNotNull(accountLine)
608:                            && ObjectUtils.isNotNull(accountLine
609:                                    .getChartOfAccountsCode())
610:                            && ObjectUtils.isNotNull(accountLine
611:                                    .getAccountNumber())) {
612:                        chartAcct = accountLine.getChartOfAccountsCode() + "-"
613:                                + accountLine.getAccountNumber();
614:                    }
615:                }
616:                return chartAcct;
617:            }
618:
619:            public Date getCreateDate() {
620:                return this .getDocumentHeader().getWorkflowDocument()
621:                        .getCreateDate();
622:            }
623:
624:            public String getUrl() {
625:                return SpringContext.getBean(KualiConfigurationService.class)
626:                        .getPropertyString(KFSConstants.WORKFLOW_URL_KEY)
627:                        + "/DocHandler.do?docId="
628:                        + getDocumentNumber()
629:                        + "&command=displayDocSearchView";
630:            }
631:
632:            /**
633:             * Used for routing only.
634:             * 
635:             * @deprecated
636:             */
637:            public String getStatusDescription() {
638:                return "";
639:            }
640:
641:            /**
642:             * Used for routing only.
643:             * 
644:             * @deprecated
645:             */
646:            public void setStatusDescription(String statusDescription) {
647:            }
648:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.