001: /*
002: * Copyright 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.kfs.bo;
017:
018: import java.io.Serializable;
019: import java.util.LinkedHashMap;
020:
021: import org.kuali.core.bo.TransientBusinessObjectBase;
022: import org.kuali.core.util.KualiDecimal;
023: import org.kuali.module.chart.bo.Account;
024:
025: /**
026: * This class holds respnsibility information pertaining to an account specifically whether or not the responsibility is of type
027: * Fiscal Officer, Primary Delegate of Fiscal Officer, or Secondary Delegate of Fiscal Officer, and if it is one of the delegated
028: * responsibility types, then there is additional information about the responsibility such as dollar range and document type
029: */
030: public class AccountResponsibility extends TransientBusinessObjectBase
031: implements Serializable {
032:
033: private static final long serialVersionUID = 3101634819409319387L;
034: public static final int FISCAL_OFFICER_RESPONSIBILITY = 1;
035: public static final int DELEGATED_RESPONSIBILITY = 2;
036:
037: private Account account;
038: private int accountResponsibilityType;
039: private KualiDecimal minimumDollarAmount;
040: private KualiDecimal maximumDollarAmount;
041: private String documentTypeId;
042:
043: public AccountResponsibility() {
044: }
045:
046: /**
047: * Constructor that allows us to create and pop on same line in other files
048: *
049: * @param accountResponsibilityType
050: * @param minimumDollarAmount
051: * @param maximumDollarAmount
052: * @param documentTypeId
053: */
054: public AccountResponsibility(int accountResponsibilityType,
055: KualiDecimal minimumDollarAmount,
056: KualiDecimal maximumDollarAmount, String documentTypeId,
057: Account account) {
058: if (!isValidResponsibilityType(accountResponsibilityType)) {
059: throw new IllegalArgumentException(
060: "invalid accountResponsibilityType passed in");
061: }
062: this .accountResponsibilityType = accountResponsibilityType;
063: this .minimumDollarAmount = minimumDollarAmount;
064: this .maximumDollarAmount = maximumDollarAmount;
065: this .documentTypeId = documentTypeId;
066: this .account = account;
067: }
068:
069: private boolean isValidResponsibilityType(int type) {
070: return type == FISCAL_OFFICER_RESPONSIBILITY
071: || type == DELEGATED_RESPONSIBILITY;
072: }
073:
074: public Account getAccount() {
075: return account;
076: }
077:
078: public void setAccount(Account account) {
079: this .account = account;
080: }
081:
082: public int getAccountResponsibilityType() {
083: return accountResponsibilityType;
084: }
085:
086: public void setAccountResponsibilityType(
087: int accountResponsibilityType) {
088: this .accountResponsibilityType = accountResponsibilityType;
089: }
090:
091: public String getDocumentTypeId() {
092: return documentTypeId;
093: }
094:
095: public void setDocumentTypeId(String documentTypeId) {
096: this .documentTypeId = documentTypeId;
097: }
098:
099: public KualiDecimal getMaximumDollarAmount() {
100: return maximumDollarAmount;
101: }
102:
103: public void setMaximumDollarAmount(KualiDecimal maximumDollarAmount) {
104: this .maximumDollarAmount = maximumDollarAmount;
105: }
106:
107: public KualiDecimal getMinimumDollarAmount() {
108: return minimumDollarAmount;
109: }
110:
111: public void setMinimumDollarAmount(KualiDecimal minimumDollarAmount) {
112: this .minimumDollarAmount = minimumDollarAmount;
113: }
114:
115: /**
116: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
117: */
118: @Override
119: protected LinkedHashMap toStringMapper() {
120: LinkedHashMap m = new LinkedHashMap();
121: if (account != null) {
122: m.put("accountNumber", this .account.getAccountNumber());
123: }
124: m.put("accountResponsibilityType",
125: this .accountResponsibilityType);
126: m.put("minimumDollarAmount", this .minimumDollarAmount);
127: m.put("maximumDollarAmount", this .maximumDollarAmount);
128: m.put("documentTypeId", this.documentTypeId);
129: return m;
130: }
131:
132: }
|