1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.ole.coa.businessobject;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.ole.sys.businessobject.Building;
24 import org.kuali.ole.sys.context.SpringContext;
25 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
26 import org.kuali.rice.krad.service.KualiModuleService;
27 import org.kuali.rice.krad.service.ModuleService;
28 import org.kuali.rice.location.api.LocationConstants;
29 import org.kuali.rice.location.framework.campus.CampusEbo;
30
31 public class AccountDescription extends PersistableBusinessObjectBase {
32
33 private static final long serialVersionUID = 6233459415790165510L;
34
35 protected String chartOfAccountsCode;
36 protected String accountNumber;
37 protected String campusDescription;
38 protected String organizationDescription;
39 protected String responsibilityCenterDescription;
40 protected String campusCode;
41 protected String buildingCode;
42
43 protected CampusEbo campus;
44 protected Building building;
45
46 public String getChartOfAccountsCode() {
47 return chartOfAccountsCode;
48 }
49
50 public void setChartOfAccountsCode(String chartOfAccountsCode) {
51 this.chartOfAccountsCode = chartOfAccountsCode;
52 }
53
54 public String getAccountNumber() {
55 return accountNumber;
56 }
57
58 public void setAccountNumber(String accountNumber) {
59 this.accountNumber = accountNumber;
60 }
61
62 public String getCampusDescription() {
63 return campusDescription;
64 }
65
66 public void setCampusDescription(String campusDescription) {
67 this.campusDescription = campusDescription;
68 }
69
70 public String getOrganizationDescription() {
71 return organizationDescription;
72 }
73
74 public void setOrganizationDescription(String organizationDescription) {
75 this.organizationDescription = organizationDescription;
76 }
77
78 public String getResponsibilityCenterDescription() {
79 return responsibilityCenterDescription;
80 }
81
82 public void setResponsibilityCenterDescription(String responsibilityCenterDescription) {
83 this.responsibilityCenterDescription = responsibilityCenterDescription;
84 }
85
86 public String getCampusCode() {
87 return campusCode;
88 }
89
90 public void setCampusCode(String campusCode) {
91 this.campusCode = campusCode;
92 }
93
94 public String getBuildingCode() {
95 return buildingCode;
96 }
97
98 public void setBuildingCode(String buildingCode) {
99 this.buildingCode = buildingCode;
100 }
101
102 public Building getBuilding() {
103 return building;
104 }
105
106 public void setBuilding(Building building) {
107 this.building = building;
108 }
109
110 public CampusEbo getCampus() {
111 if ( StringUtils.isBlank(campusCode) ) {
112 campus = null;
113 } else {
114 if ( campus == null || !StringUtils.equals( campus.getCode(),campusCode) ) {
115 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class);
116 if ( moduleService != null ) {
117 Map<String,Object> keys = new HashMap<String, Object>(1);
118 keys.put(LocationConstants.PrimaryKeyConstants.CODE, campusCode);
119 campus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys);
120 } else {
121 throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed." );
122 }
123 }
124 }
125 return campus;
126 }
127
128 public void setCampus(CampusEbo campus) {
129 this.campus = campus;
130 }
131 }