001    /*
002     * Copyright 2011 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    
017    package org.kuali.kfs.module.cg.businessobject;
018    
019    import java.util.LinkedHashMap;
020    
021    import org.kuali.kfs.coa.businessobject.Chart;
022    import org.kuali.kfs.coa.businessobject.Organization;
023    import org.kuali.rice.kns.bo.Inactivateable;
024    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
025    
026    /**
027     * This class represents an association between an award and an organization. It's like a reference to the organization from the
028     * award. This way an award can maintain a collection of these references instead of owning organizations directly.
029     */
030    public class AwardOrganization extends PersistableBusinessObjectBase implements Primaryable, Inactivateable {
031    
032        private String chartOfAccountsCode;
033        private String organizationCode;
034        private Long proposalNumber;
035        private boolean awardPrimaryOrganizationIndicator;
036        private boolean active = true;
037    
038        private Chart chartOfAccounts;
039        private Organization organization;
040    
041        /**
042         * Default no-args constructor.
043         */
044        public AwardOrganization() {
045    
046        }
047    
048        /**
049         * Gets the chartOfAccountsCode attribute.
050         * 
051         * @return Returns the chartOfAccountsCode
052         */
053        public String getChartOfAccountsCode() {
054            return chartOfAccountsCode;
055        }
056    
057        /**
058         * Sets the chartOfAccountsCode attribute.
059         * 
060         * @param chartOfAccountsCode The chartOfAccountsCode to set.
061         */
062        public void setChartOfAccountsCode(String chartOfAccountsCode) {
063            this.chartOfAccountsCode = chartOfAccountsCode;
064        }
065    
066        /**
067         * Gets the organizationCode attribute.
068         * 
069         * @return Returns the organizationCode
070         */
071        public String getOrganizationCode() {
072            return organizationCode;
073        }
074    
075        /**
076         * Sets the organizationCode attribute.
077         * 
078         * @param organizationCode The organizationCode to set.
079         */
080        public void setOrganizationCode(String organizationCode) {
081            this.organizationCode = organizationCode;
082        }
083    
084        /**
085         * Gets the proposalNumber attribute.
086         * 
087         * @return Returns the proposalNumber
088         */
089        public Long getProposalNumber() {
090            return proposalNumber;
091        }
092    
093        /**
094         * Sets the proposalNumber attribute.
095         * 
096         * @param proposalNumber The proposalNumber to set.
097         */
098        public void setProposalNumber(Long proposalNumber) {
099            this.proposalNumber = proposalNumber;
100        }
101    
102        /**
103         * Gets the awardPrimaryOrganizationIndicator attribute.
104         * 
105         * @return Returns the awardPrimaryOrganizationIndicator
106         */
107        public boolean isAwardPrimaryOrganizationIndicator() {
108            return awardPrimaryOrganizationIndicator;
109        }
110    
111        /**
112         * Sets the awardPrimaryOrganizationIndicator attribute.
113         * 
114         * @param awardPrimaryOrganizationIndicator The awardPrimaryOrganizationIndicator to set.
115         */
116        public void setAwardPrimaryOrganizationIndicator(boolean awardPrimaryOrganizationIndicator) {
117            this.awardPrimaryOrganizationIndicator = awardPrimaryOrganizationIndicator;
118        }
119    
120        /**
121         * Gets the chartOfAccounts attribute.
122         * 
123         * @return Returns the chartOfAccounts
124         */
125        public Chart getChartOfAccounts() {
126            return chartOfAccounts;
127        }
128    
129        /**
130         * Sets the chartOfAccounts attribute.
131         * 
132         * @param chartOfAccounts The chartOfAccounts to set.
133         * @deprecated Setter is required by OJB, but should not be used to modify this attribute. This attribute is set on the initial
134         *             creation of the object and should not be changed.
135         */
136        @Deprecated
137        public void setChartOfAccounts(Chart chartOfAccounts) {
138            this.chartOfAccounts = chartOfAccounts;
139        }
140    
141        /**
142         * Gets the organization attribute.
143         * 
144         * @return Returns the organization
145         */
146        public Organization getOrganization() {
147            return organization;
148        }
149    
150        /**
151         * Sets the organization attribute.
152         * 
153         * @param organization The organization to set.
154         * @deprecated Setter is required by OJB, but should not be used to modify this attribute. This attribute is set on the initial
155         *             creation of the object and should not be changed.
156         */
157        @Deprecated
158        public void setOrganization(Organization organization) {
159            this.organization = organization;
160        }
161    
162        /**
163         * @see Primaryable#isPrimary()
164         */
165        public boolean isPrimary() {
166            return isAwardPrimaryOrganizationIndicator();
167        }
168    
169        /**
170         * @see org.kuali.rice.kns.bo.Inactivateable#isActive()
171         */
172        public boolean isActive() {
173            return active;
174        }
175    
176        /**
177         * @see org.kuali.rice.kns.bo.Inactivateable#setActive(boolean)
178         */
179        public void setActive(boolean active) {
180            this.active = active;
181        }
182    
183        /**
184         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
185         */
186        @SuppressWarnings("unchecked")
187        @Override
188        protected LinkedHashMap toStringMapper() {
189            LinkedHashMap m = new LinkedHashMap();
190            m.put("chartOfAccountsCode", this.chartOfAccountsCode);
191            m.put("organizationCode", this.organizationCode);
192            if (this.proposalNumber != null) {
193                m.put("proposalNumber", this.proposalNumber.toString());
194            }
195            return m;
196        }
197    }