001: /*
002: * Copyright 2006-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:
017: package org.kuali.module.cg.bo;
018:
019: import java.util.LinkedHashMap;
020:
021: import org.kuali.core.bo.Inactivateable;
022: import org.kuali.core.bo.PersistableBusinessObjectBase;
023: import org.kuali.module.chart.bo.Chart;
024: import org.kuali.module.chart.bo.Org;
025:
026: /**
027: * Represents a relationship between a {@link Proposal} and an {@Org}.
028: */
029: public class ProposalOrganization extends PersistableBusinessObjectBase
030: implements Primaryable, Inactivateable {
031:
032: private String chartOfAccountsCode;
033: private String organizationCode;
034: private Long proposalNumber;
035: private boolean proposalPrimaryOrganizationIndicator;
036: private boolean active = true;
037:
038: private Org organization;
039: private Chart chartOfAccounts;
040:
041: /**
042: * Default constructor.
043: */
044: public ProposalOrganization() {
045: }
046:
047: /**
048: * Gets the chartOfAccountsCode attribute.
049: *
050: * @return Returns the chartOfAccountsCode
051: */
052: public String getChartOfAccountsCode() {
053: return chartOfAccountsCode;
054: }
055:
056: /**
057: * Sets the chartOfAccountsCode attribute.
058: *
059: * @param chartOfAccountsCode The chartOfAccountsCode to set.
060: */
061: public void setChartOfAccountsCode(String chartOfAccountsCode) {
062: this .chartOfAccountsCode = chartOfAccountsCode;
063: }
064:
065: /**
066: * Gets the organizationCode attribute.
067: *
068: * @return Returns the organizationCode
069: */
070: public String getOrganizationCode() {
071: return organizationCode;
072: }
073:
074: /**
075: * Sets the organizationCode attribute.
076: *
077: * @param organizationCode The organizationCode to set.
078: */
079: public void setOrganizationCode(String organizationCode) {
080: this .organizationCode = organizationCode;
081: }
082:
083: /**
084: * Gets the proposalNumber attribute.
085: *
086: * @return Returns the proposalNumber
087: */
088: public Long getProposalNumber() {
089: return proposalNumber;
090: }
091:
092: /**
093: * Sets the proposalNumber attribute.
094: *
095: * @param proposalNumber The proposalNumber to set.
096: */
097: public void setProposalNumber(Long proposalNumber) {
098: this .proposalNumber = proposalNumber;
099: }
100:
101: /**
102: * @return Returns the proposalPrimaryOrganizationIndicator.
103: */
104: public boolean isProposalPrimaryOrganizationIndicator() {
105: return proposalPrimaryOrganizationIndicator;
106: }
107:
108: /**
109: * @see Primaryable#isPrimary()
110: */
111: public boolean isPrimary() {
112: return isProposalPrimaryOrganizationIndicator();
113: }
114:
115: /**
116: * @param proposalPrimaryOrganizationIndicator The proposalPrimaryOrganizationIndicator to set.
117: */
118: public void setProposalPrimaryOrganizationIndicator(
119: boolean proposalPrimaryOrganizationIndicator) {
120: this .proposalPrimaryOrganizationIndicator = proposalPrimaryOrganizationIndicator;
121: }
122:
123: /**
124: * Gets the active attribute.
125: *
126: * @return Returns the active attribute.
127: */
128: public boolean isActive() {
129: return active;
130: }
131:
132: /**
133: * Sets the active attribute value.
134: *
135: * @param active true if the instance is active, false otherwise
136: */
137: public void setActive(boolean active) {
138: this .active = active;
139: }
140:
141: /**
142: * Gets the organization attribute.
143: *
144: * @return Returns the organization
145: */
146: public Org getOrganization() {
147: return organization;
148: }
149:
150: /**
151: * Sets the organization attribute.
152: *
153: * @param organization The organization to set.
154: * @deprecated
155: */
156: public void setOrganization(Org organization) {
157: this .organization = organization;
158: }
159:
160: /**
161: * Gets the chartOfAccounts attribute.
162: *
163: * @return Returns the chartOfAccounts
164: */
165: public Chart getChartOfAccounts() {
166: return chartOfAccounts;
167: }
168:
169: /**
170: * Sets the chartOfAccounts attribute.
171: *
172: * @param chartOfAccounts The chartOfAccounts to set.
173: * @deprecated
174: */
175: public void setChartOfAccounts(Chart chartOfAccounts) {
176: this .chartOfAccounts = chartOfAccounts;
177: }
178:
179: /**
180: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
181: */
182: protected LinkedHashMap toStringMapper() {
183: LinkedHashMap m = new LinkedHashMap();
184: m.put("chartOfAccountsCode", this .chartOfAccountsCode);
185: m.put("organizationCode", this .organizationCode);
186: if (this .proposalNumber != null) {
187: m.put("proposalNumber", this .proposalNumber.toString());
188: }
189: return m;
190: }
191:
192: /**
193: * This can be displayed by Proposal.xml lookup results.
194: *
195: * @see Object#toString()
196: */
197: @Override
198: public String toString() {
199: // todo: get "primary" and "secondary" from ApplicationResources.properties via KFSKeyConstants?
200: return getChartOfAccountsCode()
201: + "-"
202: + getOrganizationCode()
203: + " "
204: + (isProposalPrimaryOrganizationIndicator() ? "primary"
205: : "secondary");
206: }
207:
208: }
|