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.core.util.KualiDecimal;
024: import org.kuali.core.util.ObjectUtils;
025:
026: /**
027: *
028: */
029: public class ProposalSubcontractor extends
030: PersistableBusinessObjectBase implements Inactivateable {
031:
032: private String proposalSubcontractorNumber;
033: private Long proposalNumber;
034: private String subcontractorNumber;
035: private KualiDecimal proposalSubcontractorAmount;
036: private String proposalSubcontractorDescription;
037: private boolean active = true;
038:
039: private Subcontractor subcontractor;
040:
041: /**
042: * Default constructor.
043: */
044: public ProposalSubcontractor() {
045:
046: }
047:
048: /**
049: * Gets the proposalSubcontractorNumber attribute.
050: *
051: * @return Returns the proposalSubcontractorNumber
052: */
053: public String getProposalSubcontractorNumber() {
054: return proposalSubcontractorNumber;
055: }
056:
057: /**
058: * Sets the proposalSubcontractorNumber attribute.
059: *
060: * @param proposalSubcontractorNumber The proposalSubcontractorNumber to set.
061: */
062: public void setProposalSubcontractorNumber(
063: String proposalSubcontractorNumber) {
064: this .proposalSubcontractorNumber = proposalSubcontractorNumber;
065: }
066:
067: /**
068: * Gets the proposalNumber attribute.
069: *
070: * @return Returns the proposalNumber
071: */
072: public Long getProposalNumber() {
073: return proposalNumber;
074: }
075:
076: /**
077: * Sets the proposalNumber attribute.
078: *
079: * @param proposalNumber The proposalNumber to set.
080: */
081: public void setProposalNumber(Long proposalNumber) {
082: this .proposalNumber = proposalNumber;
083: }
084:
085: /**
086: * Gets the subcontractorNumber attribute.
087: *
088: * @return Returns the subcontractorNumber
089: */
090: public String getSubcontractorNumber() {
091: return subcontractorNumber;
092: }
093:
094: /**
095: * Sets the subcontractorNumber attribute.
096: *
097: * @param subcontractorNumber The subcontractorNumber to set.
098: */
099: public void setSubcontractorNumber(String subcontractorNumber) {
100: this .subcontractorNumber = subcontractorNumber;
101: }
102:
103: /**
104: * Gets the proposalSubcontractorAmount attribute.
105: *
106: * @return Returns the proposalSubcontractorAmount
107: */
108: public KualiDecimal getProposalSubcontractorAmount() {
109: return proposalSubcontractorAmount;
110: }
111:
112: /**
113: * Sets the proposalSubcontractorAmount attribute.
114: *
115: * @param proposalSubcontractorAmount The proposalSubcontractorAmount to set.
116: */
117: public void setProposalSubcontractorAmount(
118: KualiDecimal proposalSubcontractorAmount) {
119: this .proposalSubcontractorAmount = proposalSubcontractorAmount;
120: }
121:
122: /**
123: * Gets the proposalSubcontractorDescription attribute.
124: *
125: * @return Returns the proposalSubcontractorDescription.
126: */
127: public String getProposalSubcontractorDescription() {
128: return proposalSubcontractorDescription;
129: }
130:
131: /**
132: * Sets the proposalSubcontractorDescription attribute value.
133: *
134: * @param proposalSubcontractorDescription The proposalSubcontractorDescription to set.
135: */
136: public void setProposalSubcontractorDescription(
137: String proposalSubcontractorDescription) {
138: this .proposalSubcontractorDescription = proposalSubcontractorDescription;
139: }
140:
141: /**
142: * Gets the active attribute.
143: *
144: * @return Returns the active.
145: */
146: public boolean isActive() {
147: return active;
148: }
149:
150: /**
151: * Sets the active attribute value.
152: *
153: * @param active The active to set.
154: */
155: public void setActive(boolean active) {
156: this .active = active;
157: }
158:
159: /**
160: * @return Returns the subcontractor.
161: */
162: public Subcontractor getSubcontractor() {
163: return subcontractor;
164: }
165:
166: /**
167: * @param subcontractor The subcontractor to set.
168: * @deprecated
169: */
170: public void setSubcontractor(Subcontractor subcontractor) {
171: this .subcontractor = subcontractor;
172: }
173:
174: /**
175: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
176: */
177: protected LinkedHashMap toStringMapper() {
178: LinkedHashMap m = new LinkedHashMap();
179: m.put("proposalSubcontractorNumber",
180: this .proposalSubcontractorNumber);
181: if (this .proposalNumber != null) {
182: m.put("proposalNumber", this .proposalNumber.toString());
183: }
184: m.put("subcontractorNumber", this .subcontractorNumber);
185: return m;
186: }
187:
188: /**
189: * This can be displayed by Proposal.xml lookup results.
190: *
191: * @see Object#toString()
192: */
193: @Override
194: public String toString() {
195: // todo: get "nonexistent" from ApplicationResources.properties via KFSKeyConstants?
196: String name = ObjectUtils.isNull(getSubcontractor()) ? "nonexistent"
197: : getSubcontractor().getSubcontractorName();
198: String description = getProposalSubcontractorDescription() == null ? ""
199: : " " + getProposalSubcontractorDescription();
200: return name + " " + getProposalSubcontractorAmount()
201: + description;
202: }
203: }
|