001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.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/ecl2.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.kfs.coa.businessobject;
018
019 import java.util.ArrayList;
020 import java.util.LinkedHashMap;
021 import java.util.List;
022
023 import org.apache.log4j.Logger;
024 import org.kuali.kfs.sys.context.SpringContext;
025 import org.kuali.rice.kns.bo.Inactivateable;
026 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
027 import org.kuali.rice.kns.service.BusinessObjectService;
028 import org.kuali.rice.kns.util.TypedArrayList;
029
030 /**
031 *
032 */
033 public class AccountDelegateModel extends PersistableBusinessObjectBase implements Inactivateable {
034 private static final Logger LOG = Logger.getLogger(AccountDelegateModel.class);
035
036 private String chartOfAccountsCode;
037 private String organizationCode;
038 private String accountDelegateModelName;
039 private boolean active;
040 private List<AccountDelegateModelDetail> accountDelegateModelDetails;
041
042 private Organization organization;
043 private Chart chartOfAccounts;
044
045 /**
046 * Default constructor.
047 */
048 public AccountDelegateModel() {
049 accountDelegateModelDetails = new TypedArrayList(AccountDelegateModelDetail.class);
050 }
051
052 /**
053 * Gets the chartOfAccountsCode attribute.
054 *
055 * @return Returns the chartOfAccountsCode
056 */
057 public String getChartOfAccountsCode() {
058 return chartOfAccountsCode;
059 }
060
061 /**
062 * Sets the chartOfAccountsCode attribute.
063 *
064 * @param chartOfAccountsCode The chartOfAccountsCode to set.
065 */
066 public void setChartOfAccountsCode(String chartOfAccountsCode) {
067 this.chartOfAccountsCode = chartOfAccountsCode;
068 }
069
070
071 /**
072 * Gets the organizationCode attribute.
073 *
074 * @return Returns the organizationCode
075 */
076 public String getOrganizationCode() {
077 return organizationCode;
078 }
079
080 /**
081 * Sets the organizationCode attribute.
082 *
083 * @param organizationCode The organizationCode to set.
084 */
085 public void setOrganizationCode(String organizationCode) {
086 this.organizationCode = organizationCode;
087 }
088
089
090 /**
091 * Gets the accountDelegateModelName attribute.
092 *
093 * @return Returns the accountDelegateModelName
094 */
095 public String getAccountDelegateModelName() {
096 return accountDelegateModelName;
097 }
098
099 /**
100 * Sets the accountDelegateModelName attribute.
101 *
102 * @param accountDelegateModelName The accountDelegateModelName to set.
103 */
104 public void setAccountDelegateModelName(String organizationRoutingModelName) {
105 this.accountDelegateModelName = organizationRoutingModelName;
106 }
107
108
109 /**
110 * Gets the organization attribute.
111 *
112 * @return Returns the organization
113 */
114 public Organization getOrganization() {
115 return organization;
116 }
117
118 /**
119 * Sets the organization attribute.
120 *
121 * @param organization The organization to set.
122 * @deprecated
123 */
124 public void setOrganization(Organization organization) {
125 this.organization = organization;
126 }
127
128 /**
129 * Gets the chartOfAccounts attribute.
130 *
131 * @return Returns the chartOfAccounts
132 */
133 public Chart getChartOfAccounts() {
134 return chartOfAccounts;
135 }
136
137 /**
138 * Sets the chartOfAccounts attribute.
139 *
140 * @param chartOfAccounts The chartOfAccounts to set.
141 * @deprecated
142 */
143 public void setChartOfAccounts(Chart chartOfAccounts) {
144 this.chartOfAccounts = chartOfAccounts;
145 }
146
147 /**
148 * Gets the accountDelegateModelDetails attribute.
149 *
150 * @return Returns the accountDelegateModelDetails.
151 */
152 public List<AccountDelegateModelDetail> getAccountDelegateModelDetails() {
153 return accountDelegateModelDetails;
154 }
155
156 /**
157 * Sets the accountDelegateModelDetails attribute value.
158 *
159 * @param accountDelegateModelDetails The accountDelegateModelDetails to set.
160 */
161 public void setAccountDelegateModelDetails(List<AccountDelegateModelDetail> organizationRoutingModel) {
162 this.accountDelegateModelDetails = organizationRoutingModel;
163 }
164
165 /**
166 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
167 */
168 protected LinkedHashMap toStringMapper() {
169 LinkedHashMap m = new LinkedHashMap();
170 m.put("chartOfAccountsCode", this.chartOfAccountsCode);
171 m.put("organizationCode", this.organizationCode);
172 m.put("accountDelegateModelName", this.accountDelegateModelName);
173 return m;
174 }
175
176 /**
177 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#linkEditableUserFields()
178 */
179 @Override
180 public void linkEditableUserFields() {
181 super.linkEditableUserFields();
182 if (this == null) {
183 throw new IllegalArgumentException("parameter passed in was null");
184 }
185 List bos = new ArrayList();
186 bos.addAll(getAccountDelegateModelDetails());
187 SpringContext.getBean(BusinessObjectService.class).linkUserFields(bos);
188 }
189
190 /**
191 * Gets the active attribute.
192 * @return Returns the active.
193 */
194 public boolean isActive() {
195 return active;
196 }
197
198 /**
199 * Sets the active attribute value.
200 * @param active The active to set.
201 */
202 public void setActive(boolean active) {
203 this.active = active;
204 }
205 }