View Javadoc

1   /**
2    * Copyright 2004-2013 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  package org.kuali.kfs.coa.businessobject;
17  
18  import java.util.LinkedHashMap;
19  
20  import org.apache.commons.lang.StringUtils;
21  import org.kuali.rice.core.api.mo.common.active.Inactivatable;
22  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23  
24  /**
25   *
26   */
27  public class Chart extends PersistableBusinessObjectBase implements Inactivatable {
28  
29      private static final long serialVersionUID = 4129020803214027609L;
30  
31      private String finChartOfAccountDescription;
32      private boolean active;
33      private String chartOfAccountsCode;
34  
35      /**
36       * Default no-arg constructor.
37       */
38      public Chart() {
39      }
40  
41      /**
42       * Gets the finChartOfAccountDescription attribute.
43       *
44       * @return Returns the finChartOfAccountDescription
45       */
46      public String getFinChartOfAccountDescription() {
47          return finChartOfAccountDescription;
48      }
49  
50      /**
51       * Sets the finChartOfAccountDescription attribute.
52       *
53       * @param finChartOfAccountDescription The finChartOfAccountDescription to set.
54       */
55      public void setFinChartOfAccountDescription(String finChartOfAccountDescription) {
56          this.finChartOfAccountDescription = finChartOfAccountDescription;
57      }
58  
59      /**
60       * Gets the active attribute.
61       *
62       * @return Returns the active
63       */
64      public boolean isActive() {
65          return active;
66      }
67  
68      /**
69       * Sets the active attribute.
70       *
71       * @param active The active to set.
72       */
73      public void setActive(boolean active) {
74          this.active = active;
75      }
76  
77      /**
78       * Gets the chartOfAccountsCode attribute.
79       *
80       * @return Returns the chartOfAccountsCode.
81       */
82      public String getChartOfAccountsCode() {
83          return chartOfAccountsCode;
84      }
85  
86      /**
87       * Sets the chartOfAccountsCode attribute value.
88       *
89       * @param chartOfAccountsCode The chartOfAccountsCode to set.
90       */
91      public void setChartOfAccountsCode(String chartOfAccountsCode) {
92          this.chartOfAccountsCode = chartOfAccountsCode;
93      }
94  
95  
96      /**
97       * @return Returns the code and description in format: xx - xxxxxxxxxxxxxxxx
98       */
99      public String getCodeAndDescription() {
100         if (StringUtils.isNotBlank(getChartOfAccountsCode()) && StringUtils.isNotBlank(getFinChartOfAccountDescription()))
101             return getChartOfAccountsCode() + " - " + getFinChartOfAccountDescription();
102         else
103             return "";
104     }
105 
106     public String getCode() {
107         return this.chartOfAccountsCode;
108     }
109 
110     public String getName() {
111         return this.finChartOfAccountDescription;
112     }
113 
114     /**
115      * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
116      */
117     protected LinkedHashMap toStringMapper() {
118         LinkedHashMap m = new LinkedHashMap();
119 
120         m.put("chartOfAccountsCode", this.chartOfAccountsCode);
121 
122         return m;
123     }
124 }
125