001/* 002 * Copyright 2006 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 017package org.kuali.ole.coa.businessobject; 018 019import java.sql.Date; 020import java.util.LinkedHashMap; 021 022import org.apache.commons.lang.StringUtils; 023import org.kuali.ole.sys.context.SpringContext; 024import org.kuali.rice.core.api.mo.common.active.MutableInactivatable; 025import org.kuali.rice.core.api.util.type.KualiDecimal; 026import org.kuali.rice.kew.api.doctype.DocumentTypeService; 027import org.kuali.rice.kew.doctype.bo.DocumentType; 028import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO; 029import org.kuali.rice.kim.api.identity.Person; 030import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 031 032/** 033 * 034 */ 035public class AccountDelegateModelDetail extends PersistableBusinessObjectBase implements MutableInactivatable { 036 037 private String chartOfAccountsCode; 038 private String organizationCode; 039 private String accountDelegateModelName; 040 private String accountDelegateUniversalId; 041 private String financialDocumentTypeCode; 042 private KualiDecimal approvalFromThisAmount; 043 private KualiDecimal approvalToThisAmount; 044 private boolean accountDelegatePrimaryRoutingIndicator; 045 private Date accountDelegateStartDate; 046 private boolean active; 047 048 private Chart chartOfAccounts; 049 private DocumentTypeEBO financialSystemDocumentTypeCode; 050 private Person accountDelegate; 051 052 /** 053 * Default constructor. 054 */ 055 public AccountDelegateModelDetail() { 056 } 057 058 public AccountDelegateModelDetail(AccountDelegateGlobalDetail delegateGlobalDetail) { 059 accountDelegateUniversalId = delegateGlobalDetail.getAccountDelegateUniversalId(); 060 accountDelegatePrimaryRoutingIndicator = delegateGlobalDetail.getAccountDelegatePrimaryRoutingIndicator(); 061 approvalFromThisAmount = delegateGlobalDetail.getApprovalFromThisAmount(); 062 approvalToThisAmount = delegateGlobalDetail.getApprovalToThisAmount(); 063 accountDelegateStartDate = delegateGlobalDetail.getAccountDelegateStartDate(); 064 financialDocumentTypeCode = delegateGlobalDetail.getFinancialDocumentTypeCode(); 065 } 066 067 /** 068 * Gets the chartOfAccountsCode attribute. 069 * 070 * @return Returns the chartOfAccountsCode 071 */ 072 public String getChartOfAccountsCode() { 073 return chartOfAccountsCode; 074 } 075 076 /** 077 * Sets the chartOfAccountsCode attribute. 078 * 079 * @param chartOfAccountsCode The chartOfAccountsCode to set. 080 */ 081 public void setChartOfAccountsCode(String chartOfAccountsCode) { 082 this.chartOfAccountsCode = chartOfAccountsCode; 083 } 084 085 086 /** 087 * Gets the organizationCode attribute. 088 * 089 * @return Returns the organizationCode 090 */ 091 public String getOrganizationCode() { 092 return organizationCode; 093 } 094 095 /** 096 * Sets the organizationCode attribute. 097 * 098 * @param organizationCode The organizationCode to set. 099 */ 100 public void setOrganizationCode(String organizationCode) { 101 this.organizationCode = organizationCode; 102 } 103 104 105 /** 106 * Gets the accountDelegateModelName attribute. 107 * 108 * @return Returns the accountDelegateModelName 109 */ 110 public String getAccountDelegateModelName() { 111 return accountDelegateModelName; 112 } 113 114 /** 115 * Sets the accountDelegateModelName attribute. 116 * 117 * @param accountDelegateModelName The accountDelegateModelName to set. 118 */ 119 public void setAccountDelegateModelName(String organizationRoutingModelName) { 120 this.accountDelegateModelName = organizationRoutingModelName; 121 } 122 123 124 /** 125 * Gets the accountDelegateUniversalId attribute. 126 * 127 * @return Returns the accountDelegateUniversalId 128 */ 129 public String getAccountDelegateUniversalId() { 130 return accountDelegateUniversalId; 131 } 132 133 /** 134 * Sets the accountDelegateUniversalId attribute. 135 * 136 * @param accountDelegateUniversalId The accountDelegateUniversalId to set. 137 */ 138 public void setAccountDelegateUniversalId(String accountDelegateUniversalId) { 139 this.accountDelegateUniversalId = accountDelegateUniversalId; 140 } 141 142 143 /** 144 * Gets the accountDelegate attribute. 145 * 146 * @return Returns the accountDelegate. 147 */ 148 public Person getAccountDelegate() { 149 accountDelegate = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(accountDelegateUniversalId, accountDelegate); 150 return accountDelegate; 151 } 152 153 /** 154 * Sets the accountDelegate attribute value. 155 * 156 * @param accountDelegate The accountDelegate to set. 157 */ 158 public void setAccountDelegate(Person accountDelegate) { 159 this.accountDelegate = accountDelegate; 160 } 161 162 /** 163 * Gets the financialDocumentTypeCode attribute. 164 * 165 * @return Returns the financialDocumentTypeCode 166 */ 167 public String getFinancialDocumentTypeCode() { 168 return financialDocumentTypeCode; 169 } 170 171 /** 172 * Sets the financialDocumentTypeCode attribute. 173 * 174 * @param financialDocumentTypeCode The financialDocumentTypeCode to set. 175 */ 176 public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) { 177 this.financialDocumentTypeCode = financialDocumentTypeCode; 178 } 179 180 /** 181 * Gets the financialSystemDocumentTypeCode attribute. 182 * @return Returns the financialSystemDocumentTypeCode. 183 */ 184 public DocumentTypeEBO getFinancialSystemDocumentTypeCode() { 185 if ( StringUtils.isBlank( financialDocumentTypeCode ) ) { 186 financialSystemDocumentTypeCode = null; 187 } else { 188 if ( financialSystemDocumentTypeCode == null || !StringUtils.equals(financialDocumentTypeCode, financialSystemDocumentTypeCode.getName() ) ) { 189 org.kuali.rice.kew.api.doctype.DocumentType temp = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(financialDocumentTypeCode); 190 if ( temp != null ) { 191 financialSystemDocumentTypeCode = DocumentType.from( temp ); 192 } else { 193 financialSystemDocumentTypeCode = null; 194 } 195 } 196 } 197 return financialSystemDocumentTypeCode; 198 } 199 200 /** 201 * Gets the approvalFromThisAmount attribute. 202 * 203 * @return Returns the approvalFromThisAmount 204 */ 205 public KualiDecimal getApprovalFromThisAmount() { 206 return approvalFromThisAmount; 207 } 208 209 /** 210 * Sets the approvalFromThisAmount attribute. 211 * 212 * @param approvalFromThisAmount The approvalFromThisAmount to set. 213 */ 214 public void setApprovalFromThisAmount(KualiDecimal approvalFromThisAmount) { 215 this.approvalFromThisAmount = approvalFromThisAmount; 216 } 217 218 219 /** 220 * Gets the approvalToThisAmount attribute. 221 * 222 * @return Returns the approvalToThisAmount 223 */ 224 public KualiDecimal getApprovalToThisAmount() { 225 return approvalToThisAmount; 226 } 227 228 /** 229 * Sets the approvalToThisAmount attribute. 230 * 231 * @param approvalToThisAmount The approvalToThisAmount to set. 232 */ 233 public void setApprovalToThisAmount(KualiDecimal approvalToThisAmount) { 234 this.approvalToThisAmount = approvalToThisAmount; 235 } 236 237 238 /** 239 * Gets the accountDelegatePrimaryRoutingIndicator attribute. 240 * 241 * @return Returns the accountDelegatePrimaryRoutingIndicator 242 */ 243 public boolean getAccountDelegatePrimaryRoutingIndicator() { 244 return accountDelegatePrimaryRoutingIndicator; 245 } 246 247 /** 248 * Sets the accountDelegatePrimaryRoutingIndicator attribute. 249 * 250 * @param accountDelegatePrimaryRoutingCode The accountDelegatePrimaryRoutingIndicator to set. 251 */ 252 public void setAccountDelegatePrimaryRoutingIndicator(boolean accountDelegatePrimaryRoutingCode) { 253 this.accountDelegatePrimaryRoutingIndicator = accountDelegatePrimaryRoutingCode; 254 } 255 256 257 /** 258 * Gets the accountDelegateStartDate attribute. 259 * 260 * @return Returns the accountDelegateStartDate 261 */ 262 public Date getAccountDelegateStartDate() { 263 return accountDelegateStartDate; 264 } 265 266 /** 267 * Sets the accountDelegateStartDate attribute. 268 * 269 * @param accountDelegateStartDate The accountDelegateStartDate to set. 270 */ 271 public void setAccountDelegateStartDate(Date accountDelegateStartDate) { 272 this.accountDelegateStartDate = accountDelegateStartDate; 273 } 274 275 /** 276 * Gets the active attribute. 277 * 278 * @return Returns the active. 279 */ 280 @Override 281 public boolean isActive() { 282 return active; 283 } 284 285 /** 286 * Sets the active attribute value. 287 * 288 * @param active The active to set. 289 */ 290 public void setActive(boolean active) { 291 this.active = active; 292 } 293 294 /** 295 * Gets the chartOfAccounts attribute. 296 * 297 * @return Returns the chartOfAccounts 298 */ 299 public Chart getChartOfAccounts() { 300 return chartOfAccounts; 301 } 302 303 /** 304 * Sets the chartOfAccounts attribute. 305 * 306 * @param chartOfAccounts The chartOfAccounts to set. 307 * @deprecated 308 */ 309 public void setChartOfAccounts(Chart chartOfAccounts) { 310 this.chartOfAccounts = chartOfAccounts; 311 } 312 313 /** 314 * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper() 315 */ 316 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() { 317 LinkedHashMap m = new LinkedHashMap(); 318 m.put("chartOfAccountsCode", this.chartOfAccountsCode); 319 m.put("organizationCode", this.organizationCode); 320 m.put("accountDelegateModelName", this.accountDelegateModelName); 321 m.put("accountDelegateUniversalId", this.accountDelegateUniversalId); 322 m.put("financialDocumentTypeCode", this.financialDocumentTypeCode); 323 return m; 324 } 325} 326