View Javadoc

1   /*
2    * Created on Apr 14, 2005
3    *
4    */
5   package org.kuali.ole.module.purap.exception;
6   
7   import org.kuali.ole.coa.businessobject.Account;
8   
9   import java.io.Serializable;
10  import java.util.ArrayList;
11  import java.util.Iterator;
12  import java.util.List;
13  
14  
15  /**
16   * @author tdurkin
17   */
18  public class PaymentRequestInitializationValidationErrors implements Serializable {
19  
20      //    public List errorMessages = new ArrayList();
21      private List expiredAccounts = new ArrayList();
22      private List closedAccounts = new ArrayList();
23      private Integer purchaseOrderNumberToUse;
24      public boolean canAutoClosePO = false;
25  
26      private List<PREQCreationFailure> PREQCreationFailures = new ArrayList<PREQCreationFailure>();
27  
28      public void addPREQCreationFailure(String rejectReasonCode,
29                                         String extraDescription) {
30  
31          PREQCreationFailure rejectReason = new PREQCreationFailure();
32          rejectReason.setRejectReasonCode(rejectReasonCode);
33          rejectReason.setExtraDescription(extraDescription);
34          PREQCreationFailures.add(rejectReason);
35      }
36  
37      public PREQCreationFailure[] getPREQCreationFailures() {
38          if (PREQCreationFailures.size() > 0) {
39              PREQCreationFailure[] rejectReasons = new PREQCreationFailure[this.PREQCreationFailures.size()];
40              return this.PREQCreationFailures.toArray(rejectReasons);
41          } else {
42              return null;
43          }
44      }
45  
46      public void addExpiredAccount(Account expiredAccount) {
47          expiredAccounts.add(new AccountContinuation(expiredAccount));
48      }
49  
50      public void addClosedAccount(Account closedAccount) {
51          closedAccounts.add(new AccountContinuation(closedAccount));
52      }
53  
54      public void addExpiredAccount(AccountContinuation expiredAccount) {
55          expiredAccounts.add(expiredAccount);
56      }
57  
58      public void addClosedAccount(AccountContinuation closedAccount) {
59          closedAccounts.add(closedAccount);
60      }
61  
62      public boolean isClosedAccountsValid() {
63          return this.isListMembersValid(closedAccounts);
64      }
65  
66      public boolean isExpiredAccountsValid() {
67          return this.isListMembersValid(expiredAccounts);
68      }
69  
70      public boolean isListMembersValid(List l) {
71          for (Iterator i = l.iterator(); i.hasNext(); ) {
72              AccountContinuation acctCont = (AccountContinuation) i.next();
73              if (acctCont.getReplacementAccountValid() == null || acctCont.getReplacementAccountValid().equals(Boolean.FALSE)) {
74                  return false;
75              }
76          }
77          return true;
78      }
79  
80      public Integer getPurchaseOrderNumberToUse() {
81          return purchaseOrderNumberToUse;
82      }
83  
84      public void setPurchaseOrderNumberToUse(Integer purchaseOrderNumberToUse) {
85          this.purchaseOrderNumberToUse = purchaseOrderNumberToUse;
86      }
87  
88      public boolean isCanAutoClosePO() {
89          return canAutoClosePO;
90      }
91  
92      public void setCanAutoClosePO(boolean canAutoClosePO) {
93          this.canAutoClosePO = canAutoClosePO;
94      }
95  
96      public class AccountContinuation implements Serializable {
97  
98          private String accountFinancialChartOfAccountsCode;
99          private String accountAccountNumber;
100         private String replacementFinancialChartOfAccountsCode;
101         private String replacementAccountNumber;
102         private Boolean replacementAccountValid;
103 
104         public AccountContinuation(Account account) {
105             this.accountFinancialChartOfAccountsCode = account.getChartOfAccountsCode();
106             this.accountAccountNumber = account.getAccountNumber();
107             this.replacementFinancialChartOfAccountsCode = account.getContinuationFinChrtOfAcctCd();
108             this.replacementAccountNumber = account.getContinuationAccountNumber();
109         }
110 
111         public void setAccountFinancialChartOfAccountsCode(String accountFinancialChartOfAccountsCode) {
112             this.accountFinancialChartOfAccountsCode = accountFinancialChartOfAccountsCode;
113         }
114 
115         public String getAccountFinancialChartOfAccountsCode() {
116             return accountFinancialChartOfAccountsCode;
117         }
118 
119         public void setAccountAccountNumber(String accountAccountNumber) {
120             this.accountAccountNumber = accountAccountNumber;
121         }
122 
123         public String getAccountAccountNumber() {
124             return accountAccountNumber;
125         }
126 
127         public void setReplacementFinancialChartOfAccountsCode(String continuationFinancialChartOfAccountsCode) {
128             this.replacementFinancialChartOfAccountsCode = continuationFinancialChartOfAccountsCode;
129         }
130 
131         public String getReplacementFinancialChartOfAccountsCode() {
132             return replacementFinancialChartOfAccountsCode;
133         }
134 
135         public void setReplacementAccountNumber(String continuationAccountNumber) {
136             this.replacementAccountNumber = continuationAccountNumber;
137         }
138 
139         public String getReplacementAccountNumber() {
140             return replacementAccountNumber;
141         }
142 
143         public Boolean getReplacementAccountValid() {
144             return replacementAccountValid;
145         }
146 
147         public void setReplacementAccountValid(Boolean replacementAccountValid) {
148             this.replacementAccountValid = replacementAccountValid;
149         }
150     }
151 
152     public final class PREQCreationFailure {
153 
154         private String rejectReasonCode;
155         private String extraDescription;
156 
157         public String getExtraDescription() {
158             return extraDescription;
159         }
160 
161         public void setExtraDescription(String extraDescription) {
162             this.extraDescription = extraDescription;
163         }
164 
165         public String getRejectReasonCode() {
166             return rejectReasonCode;
167         }
168 
169         public void setRejectReasonCode(String rejectReasonCode) {
170             this.rejectReasonCode = rejectReasonCode;
171         }
172 
173     }
174 }