1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.bo.derived;
17
18 import org.joda.time.LocalDate;
19 import org.kuali.kpme.core.api.bo.derived.HrKeyedBusinessObjectDerivedContract;
20 import org.kuali.kpme.core.bo.HrBusinessObject;
21 import org.kuali.kpme.core.groupkey.HrGroupKeyBo;
22 import org.kuali.kpme.core.institution.InstitutionBo;
23 import org.kuali.kpme.core.location.LocationBo;
24 import org.kuali.kpme.core.service.HrServiceLocator;
25
26 public abstract class HrKeyedBusinessObjectDerived<O extends HrBusinessObject> extends HrBusinessObjectDerived<O> implements HrKeyedBusinessObjectDerivedContract {
27
28 private static final long serialVersionUID = -4676316817255855400L;
29
30 protected String groupKeyCode;
31 protected transient HrGroupKeyBo groupKey;
32
33 @Override
34 public String getGroupKeyCode() {
35 return groupKeyCode;
36 }
37
38 public void setGroupKeyCode(String groupKeyCode) {
39 this.groupKeyCode = groupKeyCode;
40 }
41
42
43 @Override
44 public HrGroupKeyBo getGroupKey() {
45
46 LocalDate asOfDate = LocalDate.now();
47 if(this.getEffectiveLocalDateOfOwner() != null) {
48 asOfDate = this.getEffectiveLocalDateOfOwner();
49 }
50
51 if (groupKey == null) {
52 groupKey = HrGroupKeyBo.from(HrServiceLocator.getHrGroupKeyService().getHrGroupKey(getGroupKeyCode(), asOfDate));
53 }
54
55 return groupKey;
56 }
57
58 public void setGroupKey(HrGroupKeyBo groupKey) {
59 this.groupKey = groupKey;
60 }
61
62
63
64
65
66
67 public LocationBo getLocationObj() {
68 HrGroupKeyBo grpKey = getGroupKey();
69 if(grpKey != null) {
70 return grpKey.getLocation();
71 }
72 return null;
73 }
74
75
76
77
78
79
80 public InstitutionBo getInstitutionObj() {
81 HrGroupKeyBo grpKey = getGroupKey();
82 if(grpKey != null) {
83 return grpKey.getInstitution();
84 }
85 return null;
86 }
87
88
89
90
91
92 public String getInstitution() {
93 HrGroupKeyBo grpKey = getGroupKey();
94 if(grpKey != null) {
95 return grpKey.getInstitutionCode();
96 }
97 return null;
98 }
99
100
101
102
103
104
105 public String getLocation() {
106
107 HrGroupKeyBo grpKey = getGroupKey();
108 if(grpKey != null) {
109 return grpKey.getLocationId();
110 }
111 return null;
112 }
113
114 }