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.bc.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.kfs.module.bc.document.service.BudgetConstructionOrganizationReportsService; 024 import org.kuali.kfs.sys.context.SpringContext; 025 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; 026 027 /** 028 * 029 */ 030 public class BudgetConstructionPullup extends PersistableBusinessObjectBase { 031 032 private String chartOfAccountsCode; 033 private String organizationCode; 034 private String reportsToChartOfAccountsCode; 035 private String reportsToOrganizationCode; 036 private Integer pullFlag; 037 private String principalId; 038 039 public boolean isLeaf; 040 041 private Chart chartOfAccounts; 042 private Organization organization; 043 private Organization reportsToOrganization; 044 private Chart reportsToChartOfAccounts; 045 046 /** 047 * Default constructor. 048 */ 049 public BudgetConstructionPullup() { 050 pullFlag = new Integer(0); 051 } 052 053 /** 054 * Gets the chartOfAccountsCode attribute. 055 * 056 * @return Returns the chartOfAccountsCode 057 */ 058 public String getChartOfAccountsCode() { 059 return chartOfAccountsCode; 060 } 061 062 /** 063 * Sets the chartOfAccountsCode attribute. 064 * 065 * @param chartOfAccountsCode The chartOfAccountsCode to set. 066 */ 067 public void setChartOfAccountsCode(String chartOfAccountsCode) { 068 this.chartOfAccountsCode = chartOfAccountsCode; 069 } 070 071 072 /** 073 * Gets the organizationCode attribute. 074 * 075 * @return Returns the organizationCode 076 */ 077 public String getOrganizationCode() { 078 return organizationCode; 079 } 080 081 /** 082 * Sets the organizationCode attribute. 083 * 084 * @param organizationCode The organizationCode to set. 085 */ 086 public void setOrganizationCode(String organizationCode) { 087 this.organizationCode = organizationCode; 088 } 089 090 091 /** 092 * Gets the reportsToChartOfAccountsCode attribute. 093 * 094 * @return Returns the reportsToChartOfAccountsCode 095 */ 096 public String getReportsToChartOfAccountsCode() { 097 return reportsToChartOfAccountsCode; 098 } 099 100 /** 101 * Sets the reportsToChartOfAccountsCode attribute. 102 * 103 * @param reportsToChartOfAccountsCode The reportsToChartOfAccountsCode to set. 104 */ 105 public void setReportsToChartOfAccountsCode(String reportsToChartOfAccountsCode) { 106 this.reportsToChartOfAccountsCode = reportsToChartOfAccountsCode; 107 } 108 109 110 /** 111 * Gets the reportsToOrganizationCode attribute. 112 * 113 * @return Returns the reportsToOrganizationCode 114 */ 115 public String getReportsToOrganizationCode() { 116 return reportsToOrganizationCode; 117 } 118 119 /** 120 * Sets the reportsToOrganizationCode attribute. 121 * 122 * @param reportsToOrganizationCode The reportsToOrganizationCode to set. 123 */ 124 public void setReportsToOrganizationCode(String reportsToOrganizationCode) { 125 this.reportsToOrganizationCode = reportsToOrganizationCode; 126 } 127 128 129 /** 130 * Gets the pullFlag attribute. 131 * 132 * @return Returns the pullFlag 133 */ 134 public Integer getPullFlag() { 135 return pullFlag; 136 } 137 138 /** 139 * Sets the pullFlag attribute. 140 * 141 * @param pullFlag The pullFlag to set. 142 */ 143 public void setPullFlag(Integer pullFlag) { 144 this.pullFlag = pullFlag; 145 } 146 147 148 /** 149 * Gets the principalId attribute. 150 * 151 * @return Returns the principalId. 152 */ 153 public String getPrincipalId() { 154 return principalId; 155 } 156 157 /** 158 * Sets the principalId attribute value. 159 * 160 * @param principalId The principalId to set. 161 */ 162 public void setPrincipalId(String principalId) { 163 this.principalId = principalId; 164 } 165 166 /** 167 * Gets the isLeaf attribute. 168 * 169 * @return Returns the isLeaf. 170 */ 171 public boolean isLeaf() { 172 return SpringContext.getBean(BudgetConstructionOrganizationReportsService.class).isLeafOrg(this.chartOfAccountsCode, this.organizationCode); 173 } 174 175 /** 176 * Gets the chartOfAccounts attribute. 177 * 178 * @return Returns the chartOfAccounts 179 */ 180 public Chart getChartOfAccounts() { 181 return chartOfAccounts; 182 } 183 184 /** 185 * Sets the chartOfAccounts attribute. 186 * 187 * @param chartOfAccounts The chartOfAccounts to set. 188 * @deprecated 189 */ 190 public void setChartOfAccounts(Chart chartOfAccounts) { 191 this.chartOfAccounts = chartOfAccounts; 192 } 193 194 /** 195 * Gets the organization attribute. 196 * 197 * @return Returns the organization 198 */ 199 public Organization getOrganization() { 200 return organization; 201 } 202 203 /** 204 * Sets the organization attribute. 205 * 206 * @param organization The organization to set. 207 * @deprecated 208 */ 209 public void setOrganization(Organization organization) { 210 this.organization = organization; 211 } 212 213 /** 214 * Gets the reportsToOrganization attribute. 215 * 216 * @return Returns the reportsToOrganization 217 */ 218 public Organization getReportsToOrganization() { 219 return reportsToOrganization; 220 } 221 222 /** 223 * Sets the reportsToOrganization attribute. 224 * 225 * @param reportsToOrganization The reportsToOrganization to set. 226 * @deprecated 227 */ 228 public void setReportsToOrganization(Organization reportsToOrganization) { 229 this.reportsToOrganization = reportsToOrganization; 230 } 231 232 /** 233 * Gets the reportsToChartOfAccounts attribute. 234 * 235 * @return Returns the reportsToChartOfAccounts 236 */ 237 public Chart getReportsToChartOfAccounts() { 238 return reportsToChartOfAccounts; 239 } 240 241 /** 242 * Sets the reportsToChartOfAccounts attribute. 243 * 244 * @param reportsToChartOfAccounts The reportsToChartOfAccounts to set. 245 * @deprecated 246 */ 247 public void setReportsToChartOfAccounts(Chart reportsToChartOfAccounts) { 248 this.reportsToChartOfAccounts = reportsToChartOfAccounts; 249 } 250 251 /** 252 * @see java.lang.Object#equals(java.lang.Object) 253 */ 254 @Override 255 public boolean equals(Object obj) { 256 boolean isEqual = true; 257 if (obj == null || !(obj instanceof BudgetConstructionPullup)) { 258 isEqual = false; 259 } 260 else { 261 if (!this.toString().equals(obj.toString())) { 262 isEqual = false; 263 } 264 } 265 266 return isEqual; 267 } 268 269 /** 270 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 271 */ 272 protected LinkedHashMap toStringMapper() { 273 LinkedHashMap m = new LinkedHashMap(); 274 m.put("principalId", this.principalId); 275 m.put("chartOfAccountsCode", this.chartOfAccountsCode); 276 m.put("organizationCode", this.organizationCode); 277 return m; 278 } 279 } 280