001/*
002 * Copyright 2006 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
017package org.kuali.ole.coa.businessobject;
018
019import java.util.ArrayList;
020import java.util.LinkedHashMap;
021import java.util.List;
022
023import org.apache.log4j.Logger;
024import org.kuali.ole.sys.context.SpringContext;
025import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
026import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
027import org.kuali.rice.krad.service.BusinessObjectService;
028
029/**
030 * 
031 */
032public class AccountDelegateModel extends PersistableBusinessObjectBase implements MutableInactivatable {
033    private static final Logger LOG = Logger.getLogger(AccountDelegateModel.class);
034
035    private String chartOfAccountsCode;
036    private String organizationCode;
037    private String accountDelegateModelName;
038    private boolean active;
039    private List<AccountDelegateModelDetail> accountDelegateModelDetails;
040
041    private Organization organization;
042    private Chart chartOfAccounts;
043
044    /**
045     * Default constructor.
046     */
047    public AccountDelegateModel() {
048        accountDelegateModelDetails = new ArrayList<AccountDelegateModelDetail>();
049    }
050
051    /**
052     * Gets the chartOfAccountsCode attribute.
053     * 
054     * @return Returns the chartOfAccountsCode
055     */
056    public String getChartOfAccountsCode() {
057        return chartOfAccountsCode;
058    }
059
060    /**
061     * Sets the chartOfAccountsCode attribute.
062     * 
063     * @param chartOfAccountsCode The chartOfAccountsCode to set.
064     */
065    public void setChartOfAccountsCode(String chartOfAccountsCode) {
066        this.chartOfAccountsCode = chartOfAccountsCode;
067    }
068
069
070    /**
071     * Gets the organizationCode attribute.
072     * 
073     * @return Returns the organizationCode
074     */
075    public String getOrganizationCode() {
076        return organizationCode;
077    }
078
079    /**
080     * Sets the organizationCode attribute.
081     * 
082     * @param organizationCode The organizationCode to set.
083     */
084    public void setOrganizationCode(String organizationCode) {
085        this.organizationCode = organizationCode;
086    }
087
088
089    /**
090     * Gets the accountDelegateModelName attribute.
091     * 
092     * @return Returns the accountDelegateModelName
093     */
094    public String getAccountDelegateModelName() {
095        return accountDelegateModelName;
096    }
097
098    /**
099     * Sets the accountDelegateModelName attribute.
100     * 
101     * @param accountDelegateModelName The accountDelegateModelName to set.
102     */
103    public void setAccountDelegateModelName(String organizationRoutingModelName) {
104        this.accountDelegateModelName = organizationRoutingModelName;
105    }
106
107
108    /**
109     * Gets the organization attribute.
110     * 
111     * @return Returns the organization
112     */
113    public Organization getOrganization() {
114        return organization;
115    }
116
117    /**
118     * Sets the organization attribute.
119     * 
120     * @param organization The organization to set.
121     * @deprecated
122     */
123    public void setOrganization(Organization organization) {
124        this.organization = organization;
125    }
126
127    /**
128     * Gets the chartOfAccounts attribute.
129     * 
130     * @return Returns the chartOfAccounts
131     */
132    public Chart getChartOfAccounts() {
133        return chartOfAccounts;
134    }
135
136    /**
137     * Sets the chartOfAccounts attribute.
138     * 
139     * @param chartOfAccounts The chartOfAccounts to set.
140     * @deprecated
141     */
142    public void setChartOfAccounts(Chart chartOfAccounts) {
143        this.chartOfAccounts = chartOfAccounts;
144    }
145
146    /**
147     * Gets the accountDelegateModelDetails attribute.
148     * 
149     * @return Returns the accountDelegateModelDetails.
150     */
151    public List<AccountDelegateModelDetail> getAccountDelegateModelDetails() {
152        return accountDelegateModelDetails;
153    }
154
155    /**
156     * Sets the accountDelegateModelDetails attribute value.
157     * 
158     * @param accountDelegateModelDetails The accountDelegateModelDetails to set.
159     */
160    public void setAccountDelegateModelDetails(List<AccountDelegateModelDetail> organizationRoutingModel) {
161        this.accountDelegateModelDetails = organizationRoutingModel;
162    }
163
164    /**
165     * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
166     */
167    protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
168        LinkedHashMap m = new LinkedHashMap();
169        m.put("chartOfAccountsCode", this.chartOfAccountsCode);
170        m.put("organizationCode", this.organizationCode);
171        m.put("accountDelegateModelName", this.accountDelegateModelName);
172        return m;
173    }
174
175    /**
176     * @see org.kuali.rice.krad.bo.PersistableBusinessObjectBase#linkEditableUserFields()
177     */
178    @Override
179    public void linkEditableUserFields() {
180        super.linkEditableUserFields();
181        if (this == null) {
182            throw new IllegalArgumentException("parameter passed in was null");
183        }
184        List bos = new ArrayList();
185        bos.addAll(getAccountDelegateModelDetails());
186        SpringContext.getBean(BusinessObjectService.class).linkUserFields(bos);
187    }
188
189    /**
190     * Gets the active attribute. 
191     * @return Returns the active.
192     */
193    public boolean isActive() {
194        return active;
195    }
196
197    /**
198     * Sets the active attribute value.
199     * @param active The active to set.
200     */
201    public void setActive(boolean active) {
202        this.active = active;
203    }
204}