View Javadoc

1   /*
2    * Copyright 2007-2010 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.test.document;
17  
18  import java.util.ArrayList;
19  import java.util.LinkedHashMap;
20  import java.util.List;
21  
22  import org.kuali.rice.kns.document.SessionDocument;
23  import org.kuali.rice.kns.document.TransactionalDocumentBase;
24  import org.kuali.rice.kns.test.document.bo.Account;
25  
26  /*
27  * This is a test copy of AccountRequestDocument that has been modified to allow for custom lock descriptors.
28  * 
29  */
30  
31  public class AccountRequestDocumentWithCyclicalReference extends TransactionalDocumentBase implements SessionDocument {
32  
33      private String requester;
34      private String reason1;
35      private String reason2;
36      private String requestType;
37      private String accountTypeCode;
38  
39      private AccountRequestDocumentWithCyclicalReference child;
40      private AccountRequestDocumentWithCyclicalReference parent;
41      
42      private List<Account> accounts;
43  
44      public AccountRequestDocumentWithCyclicalReference() {
45          accounts = new ArrayList<Account>();
46      }
47  
48      @Override
49      protected LinkedHashMap toStringMapper() {
50          LinkedHashMap<String, String> meMap = new LinkedHashMap<String, String>();
51          meMap.put("requester", getRequester());
52          meMap.put("reason1", getReason1());
53          meMap.put("reason2", getReason2());
54          return meMap;
55      }
56  
57      public String getReason2() {
58          return reason2;
59      }
60  
61      public void setReason2(String reason2) {
62          this.reason2 = reason2;
63      }
64  
65      public String getReason1() {
66          return reason1;
67      }
68  
69      public void setReason1(String reason1) {
70          this.reason1 = reason1;
71      }
72  
73      public String getRequester() {
74          return requester;
75      }
76  
77      public void setRequester(String requester) {
78          this.requester = requester;
79      }
80  
81      public List<Account> getAccounts() {
82          return accounts;
83      }
84  
85      public void setAccounts(List<Account> accounts) {
86          this.accounts = accounts;
87      }
88  
89      public Account getAccount(int index) {
90          while(accounts.size() - 1 < index) {
91              accounts.add(new Account());
92          }
93          return accounts.get(index);
94      }
95  
96      public String getRequestType() {
97          return requestType;
98      }
99  
100     public void setRequestType(String requestType) {
101         this.requestType = requestType;
102     }
103 
104     public void setAccountTypeCode(String accountType) {
105         this.accountTypeCode = accountType;
106     }
107 
108     public String getAccountTypeCode() {
109         return accountTypeCode;
110     }
111 
112 	public AccountRequestDocumentWithCyclicalReference getChild() {
113 		return this.child;
114 	}
115 
116 	public void setChild(AccountRequestDocumentWithCyclicalReference child) {
117 		this.child = child;
118 	}
119 
120 	public AccountRequestDocumentWithCyclicalReference getParent() {
121 		return this.parent;
122 	}
123 
124 	public void setParent(AccountRequestDocumentWithCyclicalReference parent) {
125 		this.parent = parent;
126 	}
127 
128 }