View Javadoc
1   /*
2    * Copyright 2006 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.ole.module.cg.businessobject;
18  
19  import java.util.LinkedHashMap;
20  
21  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
22  import org.kuali.rice.core.api.util.type.KualiDecimal;
23  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
24  import org.kuali.rice.krad.util.ObjectUtils;
25  
26  /**
27   * 
28   */
29  public class ProposalSubcontractor extends PersistableBusinessObjectBase implements MutableInactivatable {
30  
31      private String proposalSubcontractorNumber;
32      private Long proposalNumber;
33      private String subcontractorNumber;
34      private KualiDecimal proposalSubcontractorAmount;
35      private String proposalSubcontractorDescription;
36      private boolean active = true;
37  
38      private SubContractor subcontractor;
39  
40      /**
41       * Default constructor.
42       */
43      public ProposalSubcontractor() {
44  
45      }
46  
47      /**
48       * Gets the proposalSubcontractorNumber attribute.
49       * 
50       * @return Returns the proposalSubcontractorNumber
51       */
52      public String getProposalSubcontractorNumber() {
53          return proposalSubcontractorNumber;
54      }
55  
56      /**
57       * Sets the proposalSubcontractorNumber attribute.
58       * 
59       * @param proposalSubcontractorNumber The proposalSubcontractorNumber to set.
60       */
61      public void setProposalSubcontractorNumber(String proposalSubcontractorNumber) {
62          this.proposalSubcontractorNumber = proposalSubcontractorNumber;
63      }
64  
65  
66      /**
67       * Gets the proposalNumber attribute.
68       * 
69       * @return Returns the proposalNumber
70       */
71      public Long getProposalNumber() {
72          return proposalNumber;
73      }
74  
75      /**
76       * Sets the proposalNumber attribute.
77       * 
78       * @param proposalNumber The proposalNumber to set.
79       */
80      public void setProposalNumber(Long proposalNumber) {
81          this.proposalNumber = proposalNumber;
82      }
83  
84  
85      /**
86       * Gets the subcontractorNumber attribute.
87       * 
88       * @return Returns the subcontractorNumber
89       */
90      public String getSubcontractorNumber() {
91          return subcontractorNumber;
92      }
93  
94      /**
95       * Sets the subcontractorNumber attribute.
96       * 
97       * @param subcontractorNumber The subcontractorNumber to set.
98       */
99      public void setSubcontractorNumber(String subcontractorNumber) {
100         this.subcontractorNumber = subcontractorNumber;
101     }
102 
103 
104     /**
105      * Gets the proposalSubcontractorAmount attribute.
106      * 
107      * @return Returns the proposalSubcontractorAmount
108      */
109     public KualiDecimal getProposalSubcontractorAmount() {
110         return proposalSubcontractorAmount;
111     }
112 
113     /**
114      * Sets the proposalSubcontractorAmount attribute.
115      * 
116      * @param proposalSubcontractorAmount The proposalSubcontractorAmount to set.
117      */
118     public void setProposalSubcontractorAmount(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(String proposalSubcontractorDescription) {
137         this.proposalSubcontractorDescription = proposalSubcontractorDescription;
138     }
139 
140     /**
141      * Gets the active attribute.
142      * 
143      * @return Returns the active.
144      */
145     public boolean isActive() {
146         return active;
147     }
148 
149     /**
150      * Sets the active attribute value.
151      * 
152      * @param active The active to set.
153      */
154     public void setActive(boolean active) {
155         this.active = active;
156     }
157 
158     /**
159      * @return Returns the subcontractor.
160      */
161     public SubContractor getSubcontractor() {
162         return subcontractor;
163     }
164 
165     /**
166      * @param subcontractor The subcontractor to set.
167      * @deprecated
168      */
169     public void setSubcontractor(SubContractor subcontractor) {
170         this.subcontractor = subcontractor;
171     }
172 
173     /**
174      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
175      */
176     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
177         LinkedHashMap m = new LinkedHashMap();
178         m.put("proposalSubcontractorNumber", this.proposalSubcontractorNumber);
179         if (this.proposalNumber != null) {
180             m.put("proposalNumber", this.proposalNumber.toString());
181         }
182         m.put("subcontractorNumber", this.subcontractorNumber);
183         return m;
184     }
185 
186     /**
187      * This can be displayed by Proposal.xml lookup results.
188      * 
189      * @see Object#toString()
190      */
191     @Override
192     public String toString() {
193         // todo: get "nonexistent" from ApplicationResources.properties via OLEKeyConstants?
194         String name = ObjectUtils.isNull(getSubcontractor()) ? "nonexistent" : getSubcontractor().getSubcontractorName();
195         String description = getProposalSubcontractorDescription() == null ? "" : " " + getProposalSubcontractorDescription();
196         return name + " " + getProposalSubcontractorAmount() + description;
197     }
198 }