Source Code Cross Referenced for PurchasingAccountsPayableDocumentBase.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:        package org.kuali.module.purap.document;
017:
018:        import java.math.BigDecimal;
019:        import java.util.ArrayList;
020:        import java.util.Arrays;
021:        import java.util.Iterator;
022:        import java.util.LinkedHashMap;
023:        import java.util.List;
024:
025:        import org.apache.commons.lang.ArrayUtils;
026:        import org.apache.commons.lang.StringUtils;
027:        import org.kuali.core.dao.ojb.DocumentDaoOjb;
028:        import org.kuali.core.document.AmountTotaling;
029:        import org.kuali.core.rule.event.KualiDocumentEvent;
030:        import org.kuali.core.util.KualiDecimal;
031:        import org.kuali.core.util.ObjectUtils;
032:        import org.kuali.core.util.TypedArrayList;
033:        import org.kuali.core.workflow.service.KualiWorkflowDocument;
034:        import org.kuali.kfs.bo.Country;
035:        import org.kuali.kfs.bo.SourceAccountingLine;
036:        import org.kuali.kfs.context.SpringContext;
037:        import org.kuali.kfs.document.AccountingDocumentBase;
038:        import org.kuali.module.purap.PurapPropertyConstants;
039:        import org.kuali.module.purap.PurapWorkflowConstants.NodeDetails;
040:        import org.kuali.module.purap.bo.CreditMemoView;
041:        import org.kuali.module.purap.bo.ItemType;
042:        import org.kuali.module.purap.bo.PaymentRequestView;
043:        import org.kuali.module.purap.bo.PurApItem;
044:        import org.kuali.module.purap.bo.PurchaseOrderView;
045:        import org.kuali.module.purap.bo.RequisitionView;
046:        import org.kuali.module.purap.bo.Status;
047:        import org.kuali.module.purap.service.PurapAccountingService;
048:        import org.kuali.module.purap.service.PurapService;
049:        import org.kuali.module.purap.util.PurApOjbCollectionHelper;
050:        import org.kuali.module.vendor.bo.VendorAddress;
051:        import org.kuali.module.vendor.bo.VendorDetail;
052:
053:        import edu.iu.uis.eden.exception.WorkflowException;
054:
055:        /**
056:         * Base class for Purchasing-Accounts Payable Documents.
057:         */
058:        public abstract class PurchasingAccountsPayableDocumentBase extends
059:                AccountingDocumentBase implements 
060:                PurchasingAccountsPayableDocument, AmountTotaling {
061:
062:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
063:                    .getLogger(PurchasingAccountsPayableDocumentBase.class);
064:
065:            // SHARED FIELDS BETWEEN REQUISITION, PURCHASE ORDER, PAYMENT REQUEST, AND CREDIT MEMO
066:            private Integer purapDocumentIdentifier;
067:            private String statusCode;
068:            private Integer vendorHeaderGeneratedIdentifier;
069:            private Integer vendorDetailAssignedIdentifier;
070:            private String vendorCustomerNumber;
071:            private String vendorName;
072:            private String vendorLine1Address;
073:            private String vendorLine2Address;
074:            private String vendorCityName;
075:            private String vendorStateCode;
076:            private String vendorPostalCode;
077:            private String vendorCountryCode;
078:            private Integer accountsPayablePurchasingDocumentLinkIdentifier;
079:
080:            // NOT PERSISTED IN DB
081:            private String vendorNumber;
082:            private Integer vendorAddressGeneratedIdentifier;
083:            private Boolean overrideWorkflowButtons = null;
084:
085:            // COLLECTIONS
086:            private List<PurApItem> items;
087:            private transient List<RequisitionView> relatedRequisitionViews;
088:            private transient List<PurchaseOrderView> relatedPurchaseOrderViews;
089:            private transient List<PaymentRequestView> relatedPaymentRequestViews;
090:            private transient List<PaymentRequestView> paymentHistoryPaymentRequestViews;
091:            private transient List<CreditMemoView> relatedCreditMemoViews;
092:            private transient List<CreditMemoView> paymentHistoryCreditMemoViews;
093:            private List<SourceAccountingLine> accountsForRouting; // don't use me for anything else!!
094:
095:            // REFERENCE OBJECTS
096:            private Status status;
097:            private VendorDetail vendorDetail;
098:            private Country vendorCountry;
099:
100:            // STATIC
101:            public transient String[] belowTheLineTypes;
102:
103:            // workaround for purapOjbCollectionHelper - remove when merged into rice
104:            public boolean allowDeleteAwareCollection = false;
105:
106:            /**
107:             * Default constructor to be overiden.
108:             */
109:            public PurchasingAccountsPayableDocumentBase() {
110:                items = new TypedArrayList(getItemClass());
111:            }
112:
113:            /**
114:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getItemClass()
115:             */
116:            public abstract Class getItemClass();
117:
118:            /**
119:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getPurApSourceDocumentIfPossible()
120:             */
121:            public abstract PurchasingAccountsPayableDocument getPurApSourceDocumentIfPossible();
122:
123:            /**
124:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getPurApSourceDocumentLabelIfPossible()
125:             */
126:            public abstract String getPurApSourceDocumentLabelIfPossible();
127:
128:            /**
129:             * @see org.kuali.core.document.DocumentBase#prepareForSave()
130:             */
131:            @Override
132:            public void prepareForSave(KualiDocumentEvent event) {
133:                customPrepareForSave(event);
134:                super .prepareForSave(event);
135:            }
136:
137:            /**
138:             * PURAP documents are all overriding this method to return false because sufficient funds checking should not be performed on
139:             * route of any PURAP documents. Only the Purchase Order performs a sufficient funds check and it is manually forced during
140:             * routing.
141:             * 
142:             * @see org.kuali.kfs.document.GeneralLedgerPostingDocumentBase#documentPerformsSufficientFundsCheck()
143:             */
144:            @Override
145:            public boolean documentPerformsSufficientFundsCheck() {
146:                return false;
147:            }
148:
149:            /**
150:             * @see org.kuali.core.document.DocumentBase#populateDocumentForRouting()
151:             */
152:            @Override
153:            public void populateDocumentForRouting() {
154:                SpringContext.getBean(PurapAccountingService.class)
155:                        .updateAccountAmounts(this );
156:                setAccountsForRouting(SpringContext.getBean(
157:                        PurapAccountingService.class).generateSummary(
158:                        getItems()));
159:
160:                // need to refresh to get the references for the searchable attributes (ie status) and for invoking route levels (ie account
161:                // objects) -hjs
162:                refreshNonUpdateableReferences();
163:                for (SourceAccountingLine sourceLine : getAccountsForRouting()) {
164:                    sourceLine.refreshNonUpdateableReferences();
165:                }
166:                super .populateDocumentForRouting();
167:            }
168:
169:            /**
170:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#isDocumentStoppedInRouteNode(NodeDetails nodeDetails)
171:             */
172:            public boolean isDocumentStoppedInRouteNode(NodeDetails nodeDetails) {
173:                List<String> currentRouteLevels = new ArrayList<String>();
174:                try {
175:                    KualiWorkflowDocument workflowDoc = getDocumentHeader()
176:                            .getWorkflowDocument();
177:                    currentRouteLevels = Arrays.asList(getDocumentHeader()
178:                            .getWorkflowDocument().getNodeNames());
179:                    if (currentRouteLevels.contains(nodeDetails.getName())
180:                            && workflowDoc.isApprovalRequested()) {
181:                        return true;
182:                    }
183:                    return false;
184:                } catch (WorkflowException e) {
185:                    throw new RuntimeException(e);
186:                }
187:            }
188:
189:            /**
190:             * Records the specified error message into the Log file and throws a runtime exception.
191:             * 
192:             * @param errorMessage the error message to be logged.
193:             */
194:            protected void logAndThrowRuntimeException(String errorMessage) {
195:                this .logAndThrowRuntimeException(errorMessage, null);
196:            }
197:
198:            /**
199:             * Records the specified error message into the Log file and throws the specified runtime exception.
200:             * 
201:             * @param errorMessage the specified error message.
202:             * @param e the specified runtime exception.
203:             */
204:            protected void logAndThrowRuntimeException(String errorMessage,
205:                    Exception e) {
206:                if (ObjectUtils.isNotNull(e)) {
207:                    LOG.error(errorMessage, e);
208:                    throw new RuntimeException(errorMessage, e);
209:                } else {
210:                    LOG.error(errorMessage);
211:                    throw new RuntimeException(errorMessage);
212:                }
213:            }
214:
215:            /**
216:             * Allows child PO classes to customize the prepareForSave method. Most of the subclasses need to call the super's method to get
217:             * the GL entry creation, but they each need to do different things to prepare for those entries to be created. This is only for
218:             * PO since it has children classes that need different prep work for GL creation.
219:             * 
220:             * @param event the event involved in this action.
221:             */
222:            public void customPrepareForSave(KualiDocumentEvent event) {
223:                // Need this here so that it happens before the GL work is done
224:                SpringContext.getBean(PurapAccountingService.class)
225:                        .updateAccountAmounts(this );
226:
227:                // These next 5 lines are temporary changes so that we can use PurApOjbCollectionHelper for release 2.
228:                // But these 5 lines will not be necessary anymore if the changes in PurApOjbCollectionHelper is
229:                // merge into Rice. KULPURAP-1370 is the related jira.
230:                this .allowDeleteAwareCollection = true;
231:                DocumentDaoOjb docDao = SpringContext
232:                        .getBean(DocumentDaoOjb.class);
233:                PurchasingAccountsPayableDocumentBase retrievedDocument = (PurchasingAccountsPayableDocumentBase) docDao
234:                        .findByDocumentHeaderId(this .getClass(), this 
235:                                .getDocumentNumber());
236:                if (retrievedDocument != null) {
237:                    retrievedDocument.allowDeleteAwareCollection = true;
238:                }
239:
240:                SpringContext.getBean(PurApOjbCollectionHelper.class)
241:                        .processCollections(docDao, this , retrievedDocument);
242:                this .allowDeleteAwareCollection = false;
243:                if (retrievedDocument != null) {
244:                    retrievedDocument.allowDeleteAwareCollection = false;
245:                }
246:            }
247:
248:            /**
249:             * @see org.kuali.kfs.document.AccountingDocumentBase#getPersistedSourceAccountingLinesForComparison()
250:             */
251:            @Override
252:            protected List getPersistedSourceAccountingLinesForComparison() {
253:                PurapAccountingService purApAccountingService = SpringContext
254:                        .getBean(PurapAccountingService.class);
255:                List persistedSourceLines = new ArrayList();
256:
257:                for (PurApItem item : (List<PurApItem>) this .getItems()) {
258:                    // only check items that already have been persisted since last save
259:                    if (ObjectUtils.isNotNull(item.getItemIdentifier())) {
260:                        persistedSourceLines.addAll(purApAccountingService
261:                                .getAccountsFromItem(item));
262:                    }
263:                }
264:                return persistedSourceLines;
265:            }
266:
267:            /**
268:             * @see org.kuali.kfs.document.AccountingDocumentBase#getSourceAccountingLinesForComparison()
269:             */
270:            @Override
271:            protected List getSourceAccountingLinesForComparison() {
272:                PurapAccountingService purApAccountingService = SpringContext
273:                        .getBean(PurapAccountingService.class);
274:                List currentSourceLines = new ArrayList();
275:                for (PurApItem item : (List<PurApItem>) this .getItems()) {
276:                    currentSourceLines.addAll(item.getSourceAccountingLines());
277:                }
278:                return currentSourceLines;
279:            }
280:
281:            /**
282:             * @see org.kuali.kfs.document.AccountingDocumentBase#buildListOfDeletionAwareLists()
283:             */
284:            @Override
285:            public List buildListOfDeletionAwareLists() {
286:                List managedLists = super .buildListOfDeletionAwareLists();
287:                if (allowDeleteAwareCollection) {
288:                    managedLists.add(this .getItems());
289:                }
290:                return managedLists;
291:            }
292:
293:            /**
294:             * Populate the document for routing to the specified node.
295:             * 
296:             * @param routeNodeName the specified node to route to.
297:             * @return false.
298:             */
299:            protected boolean documentWillStopInRouteNode(String routeNodeName) {
300:                populateDocumentForRouting();
301:                return false;
302:            }
303:
304:            /**
305:             * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
306:             */
307:            @Override
308:            protected LinkedHashMap toStringMapper() {
309:                LinkedHashMap m = new LinkedHashMap();
310:                m.put("purapDocumentIdentifier", this .purapDocumentIdentifier);
311:                return m;
312:            }
313:
314:            /**
315:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#addItem(PurApItem item)
316:             */
317:            public void addItem(PurApItem item) {
318:                int itemLinePosition = getItemLinePosition();
319:                if (ObjectUtils.isNotNull(item.getItemLineNumber())
320:                        && (item.getItemLineNumber() > 0)
321:                        && (item.getItemLineNumber() <= itemLinePosition)) {
322:                    itemLinePosition = item.getItemLineNumber().intValue() - 1;
323:                }
324:                items.add(itemLinePosition, item);
325:                renumberItems(itemLinePosition);
326:            }
327:
328:            /**
329:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#deleteItem(int lineNum)
330:             */
331:            public void deleteItem(int lineNum) {
332:                if (items.remove(lineNum) == null) {
333:                    // throw error here
334:                }
335:                renumberItems(lineNum);
336:            }
337:
338:            /**
339:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#renumberItems(int start)
340:             */
341:            public void renumberItems(int start) {
342:                for (int i = start; i < items.size(); i++) {
343:                    PurApItem item = (PurApItem) items.get(i);
344:                    // only set the item line number for above the line items
345:                    if (item.getItemType().isItemTypeAboveTheLineIndicator()) {
346:                        item.setItemLineNumber(new Integer(i + 1));
347:                    }
348:                }
349:            }
350:
351:            /**
352:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#itemSwap(int positionFrom, int positionTo)
353:             */
354:            public void itemSwap(int positionFrom, int positionTo) {
355:                // if out of range do nothing
356:                if ((positionTo < 0) || (positionTo >= getItemLinePosition())) {
357:                    return;
358:                }
359:                PurApItem item1 = this .getItem(positionFrom);
360:                PurApItem item2 = this .getItem(positionTo);
361:                Integer oldFirstPos = item1.getItemLineNumber();
362:                // swap line numbers
363:                item1.setItemLineNumber(item2.getItemLineNumber());
364:                item2.setItemLineNumber(oldFirstPos);
365:                // fix ordering in list
366:                items.remove(positionFrom);
367:                items.add(positionTo, item1);
368:            }
369:
370:            /**
371:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getItemLinePosition()
372:             */
373:            public int getItemLinePosition() {
374:                int belowTheLineCount = 0;
375:                for (PurApItem item : items) {
376:                    if (!item.getItemType().isItemTypeAboveTheLineIndicator()) {
377:                        belowTheLineCount++;
378:                    }
379:                }
380:                return items.size() - belowTheLineCount;
381:            }
382:
383:            /**
384:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getItem(int pos)
385:             */
386:            public PurApItem getItem(int pos) {
387:                return (PurApItem) items.get(pos);
388:            }
389:
390:            /**
391:             * Iterates through the items of the document and returns the item with the line number equal to the number given, or null if a
392:             * match is not found.
393:             * 
394:             * @param lineNumber line number to match on.
395:             * @return the PurchasingAp Item if a match is found, else null.
396:             */
397:            public PurApItem getItemByLineNumber(int lineNumber) {
398:                for (Iterator iter = items.iterator(); iter.hasNext();) {
399:                    PurApItem item = (PurApItem) iter.next();
400:                    if (item.getItemLineNumber().intValue() == lineNumber) {
401:                        return item;
402:                    }
403:                }
404:                return null;
405:            }
406:
407:            /**
408:             * @see org.kuali.kfs.document.AccountingDocumentBase#getTotalDollarAmount()
409:             */
410:            @Override
411:            public KualiDecimal getTotalDollarAmount() {
412:                return getTotalDollarAmountAllItems();
413:            }
414:
415:            /**
416:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#setTotalDollarAmount(KualiDecimal amount)
417:             */
418:            public void setTotalDollarAmount(KualiDecimal amount) {
419:                // do nothing, this is so that the jsp won't complain about totalDollarAmount have no setter method.
420:            }
421:
422:            /**
423:             * Computes the total dollar amount of all items.
424:             * 
425:             * @return the total dollar amount of all items.
426:             */
427:            public KualiDecimal getTotalDollarAmountAllItems() {
428:                return getTotalDollarAmountAllItems(null);
429:            }
430:
431:            /**
432:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getTotalDollarAmountAllItems(String[] excludedTypes)
433:             */
434:            public KualiDecimal getTotalDollarAmountAllItems(
435:                    String[] excludedTypes) {
436:                return getTotalDollarAmountWithExclusions(excludedTypes, true);
437:            }
438:
439:            /**
440:             * Computes the total dollar amount of all above the line items.
441:             * 
442:             * @return the total dollar amount of all above the line items.
443:             */
444:            public KualiDecimal getTotalDollarAmountAboveLineItems() {
445:                return getTotalDollarAmountAboveLineItems(null);
446:            }
447:
448:            /**
449:             * Computes the total dollar amount of all above the line items with the specified item types excluded.
450:             * 
451:             * @param excludedTypes the types of items to be excluded.
452:             * @return the total dollar amount of all above the line items with the specified item types excluded..
453:             */
454:            public KualiDecimal getTotalDollarAmountAboveLineItems(
455:                    String[] excludedTypes) {
456:                return getTotalDollarAmountWithExclusions(excludedTypes, false);
457:            }
458:
459:            /**
460:             * Computes the total dollar amount with the specified item types and possibly below the line items excluded.
461:             * 
462:             * @param excludedTypes the types of items to be excluded.
463:             * @param includeBelowTheLine indicates whether below the line items shall be included.
464:             * @return the total dollar amount with the specified item types excluded.
465:             */
466:            public KualiDecimal getTotalDollarAmountWithExclusions(
467:                    String[] excludedTypes, boolean includeBelowTheLine) {
468:                if (excludedTypes == null) {
469:                    excludedTypes = new String[] {};
470:                }
471:
472:                KualiDecimal total = new KualiDecimal(BigDecimal.ZERO);
473:                for (PurApItem item : (List<PurApItem>) getItems()) {
474:                    item
475:                            .refreshReferenceObject(PurapPropertyConstants.ITEM_TYPE);
476:                    ItemType it = item.getItemType();
477:                    if ((includeBelowTheLine || it
478:                            .isItemTypeAboveTheLineIndicator())
479:                            && !ArrayUtils.contains(excludedTypes, it
480:                                    .getItemTypeCode())) {
481:                        KualiDecimal extendedPrice = item.getExtendedPrice();
482:                        KualiDecimal itemTotal = (extendedPrice != null) ? extendedPrice
483:                                : KualiDecimal.ZERO;
484:                        total = total.add(itemTotal);
485:                    }
486:                }
487:                return total;
488:            }
489:
490:            /**
491:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#templateVendorAddress(VendorAddress)
492:             */
493:            public void templateVendorAddress(VendorAddress vendorAddress) {
494:                if (vendorAddress == null) {
495:                    return;
496:                }
497:                this .setVendorLine1Address(vendorAddress
498:                        .getVendorLine1Address());
499:                this .setVendorLine2Address(vendorAddress
500:                        .getVendorLine2Address());
501:                this .setVendorCityName(vendorAddress.getVendorCityName());
502:                this .setVendorStateCode(vendorAddress.getVendorStateCode());
503:                this .setVendorPostalCode(vendorAddress.getVendorZipCode());
504:                this .setVendorCountryCode(vendorAddress.getVendorCountryCode());
505:            }
506:
507:            /**
508:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getRelatedRequisitionViews()
509:             */
510:            public List<RequisitionView> getRelatedRequisitionViews() {
511:                if (relatedRequisitionViews == null) {
512:                    relatedRequisitionViews = new TypedArrayList(
513:                            RequisitionView.class);
514:                    List<RequisitionView> tmpViews = SpringContext.getBean(
515:                            PurapService.class).getRelatedViews(
516:                            RequisitionView.class,
517:                            accountsPayablePurchasingDocumentLinkIdentifier);
518:                    for (RequisitionView view : tmpViews) {
519:                        if (!this .getDocumentNumber().equals(
520:                                view.getDocumentNumber())) {
521:                            relatedRequisitionViews.add(view);
522:                        }
523:                    }
524:                }
525:                return relatedRequisitionViews;
526:            }
527:
528:            /**
529:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getRelatedPurchaseOrderViews()
530:             */
531:            public List<PurchaseOrderView> getRelatedPurchaseOrderViews() {
532:                if (relatedPurchaseOrderViews == null) {
533:                    relatedPurchaseOrderViews = new TypedArrayList(
534:                            PurchaseOrderView.class);
535:                    List<PurchaseOrderView> tmpViews = SpringContext.getBean(
536:                            PurapService.class).getRelatedViews(
537:                            PurchaseOrderView.class,
538:                            accountsPayablePurchasingDocumentLinkIdentifier);
539:                    for (PurchaseOrderView view : tmpViews) {
540:                        if (!this .getDocumentNumber().equals(
541:                                view.getDocumentNumber())) {
542:                            if (view.getPurchaseOrderCurrentIndicator()) {
543:                                // If this is the current purchase order, we'll add it at the front of the List
544:                                relatedPurchaseOrderViews.add(0, view);
545:                            } else {
546:                                // If this is not the current purchase order, we'll just add it to the List
547:                                relatedPurchaseOrderViews.add(view);
548:                            }
549:                        }
550:                    }
551:                }
552:                return relatedPurchaseOrderViews;
553:            }
554:
555:            /**
556:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getRelatedPaymentRequestViews()
557:             */
558:            public List<PaymentRequestView> getRelatedPaymentRequestViews() {
559:                if (relatedPaymentRequestViews == null) {
560:                    relatedPaymentRequestViews = new TypedArrayList(
561:                            PaymentRequestView.class);
562:                    List<PaymentRequestView> tmpViews = SpringContext.getBean(
563:                            PurapService.class).getRelatedViews(
564:                            PaymentRequestView.class,
565:                            accountsPayablePurchasingDocumentLinkIdentifier);
566:                    for (PaymentRequestView view : tmpViews) {
567:                        if (!this .getDocumentNumber().equals(
568:                                view.getDocumentNumber())) {
569:                            relatedPaymentRequestViews.add(view);
570:                        }
571:                    }
572:                }
573:                return relatedPaymentRequestViews;
574:            }
575:
576:            /**
577:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getRelatedCreditMemoViews()
578:             */
579:            public List<CreditMemoView> getRelatedCreditMemoViews() {
580:                relatedCreditMemoViews = new TypedArrayList(
581:                        CreditMemoView.class);
582:                List<CreditMemoView> tmpViews = SpringContext.getBean(
583:                        PurapService.class).getRelatedViews(
584:                        CreditMemoView.class,
585:                        accountsPayablePurchasingDocumentLinkIdentifier);
586:                for (CreditMemoView view : tmpViews) {
587:                    if (!this .getDocumentNumber().equals(
588:                            view.getDocumentNumber())) {
589:                        relatedCreditMemoViews.add(view);
590:                    }
591:                }
592:                return relatedCreditMemoViews;
593:            }
594:
595:            /**
596:             * Gets the Payment History Payment Request Views for this document.
597:             * 
598:             * @return the list of Payment History Payment Request Views.
599:             */
600:            public List<PaymentRequestView> getPaymentHistoryPaymentRequestViews() {
601:                if (paymentHistoryPaymentRequestViews == null) {
602:                    paymentHistoryPaymentRequestViews = new TypedArrayList(
603:                            PaymentRequestView.class);
604:                    List<PaymentRequestView> tmpViews = SpringContext.getBean(
605:                            PurapService.class).getRelatedViews(
606:                            PaymentRequestView.class,
607:                            accountsPayablePurchasingDocumentLinkIdentifier);
608:                    for (PaymentRequestView view : tmpViews) {
609:                        paymentHistoryPaymentRequestViews.add(view);
610:                    }
611:                }
612:                return paymentHistoryPaymentRequestViews;
613:            }
614:
615:            /**
616:             * Gets the Payment History Credit Memo Views for this document.
617:             * 
618:             * @return the list of Payment History Credit Memo Views.
619:             */
620:            public List<CreditMemoView> getPaymentHistoryCreditMemoViews() {
621:                if (paymentHistoryCreditMemoViews == null) {
622:                    paymentHistoryCreditMemoViews = new TypedArrayList(
623:                            CreditMemoView.class);
624:                    List<CreditMemoView> tmpViews = SpringContext.getBean(
625:                            PurapService.class).getRelatedViews(
626:                            CreditMemoView.class,
627:                            accountsPayablePurchasingDocumentLinkIdentifier);
628:                    for (CreditMemoView view : tmpViews) {
629:                        paymentHistoryCreditMemoViews.add(view);
630:                    }
631:                }
632:                return paymentHistoryCreditMemoViews;
633:            }
634:
635:            /**
636:             * Returns the vendor number for this document.
637:             * 
638:             * @return the vendor number for this document.
639:             * @see org.kuali.module.purap.document.PurchasingAccountsPayableDocument#getVendorNumber()
640:             */
641:            public String getVendorNumber() {
642:                if (StringUtils.isNotEmpty(vendorNumber)) {
643:                    return vendorNumber;
644:                } else if (ObjectUtils.isNotNull(vendorDetail)) {
645:                    return vendorDetail.getVendorNumber();
646:                } else
647:                    return "";
648:            }
649:
650:            public void setVendorNumber(String vendorNumber) {
651:                this .vendorNumber = vendorNumber;
652:            }
653:
654:            public Boolean getOverrideWorkflowButtons() {
655:                return overrideWorkflowButtons;
656:            }
657:
658:            public void setOverrideWorkflowButtons(
659:                    Boolean overrideWorkflowButtons) {
660:                this .overrideWorkflowButtons = overrideWorkflowButtons;
661:            }
662:
663:            public Integer getVendorHeaderGeneratedIdentifier() {
664:                return vendorHeaderGeneratedIdentifier;
665:            }
666:
667:            public void setVendorHeaderGeneratedIdentifier(
668:                    Integer vendorHeaderGeneratedIdentifier) {
669:                this .vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
670:            }
671:
672:            public Integer getVendorDetailAssignedIdentifier() {
673:                return vendorDetailAssignedIdentifier;
674:            }
675:
676:            public void setVendorDetailAssignedIdentifier(
677:                    Integer vendorDetailAssignedIdentifier) {
678:                this .vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
679:            }
680:
681:            public String getVendorCustomerNumber() {
682:                return vendorCustomerNumber;
683:            }
684:
685:            public void setVendorCustomerNumber(String vendorCustomerNumber) {
686:                this .vendorCustomerNumber = vendorCustomerNumber;
687:            }
688:
689:            public Integer getPurapDocumentIdentifier() {
690:                return purapDocumentIdentifier;
691:            }
692:
693:            public void setPurapDocumentIdentifier(Integer identifier) {
694:                this .purapDocumentIdentifier = identifier;
695:            }
696:
697:            public Status getStatus() {
698:                if (ObjectUtils.isNull(this .status)
699:                        && StringUtils.isNotEmpty(this .getStatusCode())) {
700:                    this .refreshReferenceObject(PurapPropertyConstants.STATUS);
701:                }
702:                return status;
703:            }
704:
705:            public void setStatus(Status status) {
706:                this .status = status;
707:            }
708:
709:            public String getStatusCode() {
710:                return statusCode;
711:            }
712:
713:            public void setStatusCode(String statusCode) {
714:                this .statusCode = statusCode;
715:            }
716:
717:            public VendorDetail getVendorDetail() {
718:                return vendorDetail;
719:            }
720:
721:            public void setVendorDetail(VendorDetail vendorDetail) {
722:                this .vendorDetail = vendorDetail;
723:            }
724:
725:            public List getItems() {
726:                return items;
727:            }
728:
729:            public void setItems(List items) {
730:                this .items = items;
731:            }
732:
733:            public String getVendorCityName() {
734:                return vendorCityName;
735:            }
736:
737:            public void setVendorCityName(String vendorCityName) {
738:                this .vendorCityName = vendorCityName;
739:            }
740:
741:            public String getVendorCountryCode() {
742:                return vendorCountryCode;
743:            }
744:
745:            public void setVendorCountryCode(String vendorCountryCode) {
746:                this .vendorCountryCode = vendorCountryCode;
747:            }
748:
749:            public String getVendorLine1Address() {
750:                return vendorLine1Address;
751:            }
752:
753:            public void setVendorLine1Address(String vendorLine1Address) {
754:                this .vendorLine1Address = vendorLine1Address;
755:            }
756:
757:            public String getVendorLine2Address() {
758:                return vendorLine2Address;
759:            }
760:
761:            public void setVendorLine2Address(String vendorLine2Address) {
762:                this .vendorLine2Address = vendorLine2Address;
763:            }
764:
765:            public String getVendorName() {
766:                return vendorName;
767:            }
768:
769:            public void setVendorName(String vendorName) {
770:                this .vendorName = vendorName;
771:            }
772:
773:            public String getVendorPostalCode() {
774:                return vendorPostalCode;
775:            }
776:
777:            public void setVendorPostalCode(String vendorPostalCode) {
778:                this .vendorPostalCode = vendorPostalCode;
779:            }
780:
781:            public String getVendorStateCode() {
782:                return vendorStateCode;
783:            }
784:
785:            public void setVendorStateCode(String vendorStateCode) {
786:                this .vendorStateCode = vendorStateCode;
787:            }
788:
789:            public Integer getVendorAddressGeneratedIdentifier() {
790:                return vendorAddressGeneratedIdentifier;
791:            }
792:
793:            public void setVendorAddressGeneratedIdentifier(
794:                    Integer vendorAddressGeneratedIdentifier) {
795:                this .vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier;
796:            }
797:
798:            public Integer getAccountsPayablePurchasingDocumentLinkIdentifier() {
799:                return accountsPayablePurchasingDocumentLinkIdentifier;
800:            }
801:
802:            public void setAccountsPayablePurchasingDocumentLinkIdentifier(
803:                    Integer accountsPayablePurchasingDocumentLinkIdentifier) {
804:                this .accountsPayablePurchasingDocumentLinkIdentifier = accountsPayablePurchasingDocumentLinkIdentifier;
805:            }
806:
807:            public String[] getBelowTheLineTypes() {
808:                if (this .belowTheLineTypes == null) {
809:                    this .belowTheLineTypes = SpringContext.getBean(
810:                            PurapService.class)
811:                            .getBelowTheLineForDocument(this );
812:                }
813:                return belowTheLineTypes;
814:            }
815:
816:            public Country getVendorCountry() {
817:                return vendorCountry;
818:            }
819:
820:            /**
821:             * Added only to allow for {@link org.kuali.module.purap.util.PurApObjectUtils} class to work correctly.
822:             * 
823:             * @deprecated
824:             */
825:            public void setVendorCountry(Country vendorCountry) {
826:                this .vendorCountry = vendorCountry;
827:            }
828:
829:            public List<SourceAccountingLine> getAccountsForRouting() {
830:                return accountsForRouting;
831:            }
832:
833:            public void setAccountsForRouting(
834:                    List<SourceAccountingLine> accountsForRouting) {
835:                this.accountsForRouting = accountsForRouting;
836:            }
837:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.