1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.position;
17
18 import org.kuali.kpme.core.api.position.PositionBase;
19 import org.kuali.kpme.core.api.position.PositionBaseContract;
20 import org.kuali.kpme.core.bo.HrKeyedBusinessObject;
21 import org.kuali.kpme.core.groupkey.HrGroupKeyBo;
22 import org.kuali.rice.core.api.mo.ModelObjectUtils;
23
24 import com.google.common.collect.ImmutableList;
25 import com.google.common.collect.ImmutableMap;
26
27 public class PositionBaseBo extends HrKeyedBusinessObject implements PositionBaseContract {
28
29 protected static class KeyFields {
30 public static final String POSITION_NUMBER = "positionNumber";
31 }
32
33
34 private static final long serialVersionUID = -3258249005786874634L;
35
36 public static final ImmutableList<String> BUSINESS_KEYS = new ImmutableList.Builder<String>()
37 .add(KeyFields.POSITION_NUMBER)
38 .build();
39
40
41 private String hrPositionId;
42 private String positionNumber;
43 private String description;
44
45 @Override
46 public ImmutableMap<String, Object> getBusinessKeyValuesMap() {
47 return new ImmutableMap.Builder<String, Object>()
48 .put(KeyFields.POSITION_NUMBER, this.getPositionNumber())
49 .build();
50 }
51
52
53 @Override
54 public String getId() {
55 return getHrPositionId();
56 }
57
58 @Override
59 public void setId(String id) {
60 setHrPositionId(id);
61 }
62
63 @Override
64 public String getUniqueKey() {
65 return positionNumber;
66 }
67
68 public String getHrPositionId() {
69 return hrPositionId;
70 }
71
72 public void setHrPositionId(String hrPositionId) {
73 this.hrPositionId = hrPositionId;
74 }
75
76 public String getPositionNumber() {
77 return positionNumber;
78 }
79
80 public void setPositionNumber(String positionNumber) {
81 this.positionNumber = positionNumber;
82 }
83
84 public String getDescription() {
85 return description;
86 }
87
88 public void setDescription(String description) {
89 this.description = description;
90 }
91
92 public static PositionBaseBo from(PositionBase im) {
93 if (im == null) {
94 return null;
95 }
96
97 PositionBaseBo retVal = new PositionBaseBo();
98 retVal.setHrPositionId(im.getHrPositionId());
99 retVal.setPositionNumber(im.getPositionNumber());
100 retVal.setGroupKeyCode(im.getGroupKeyCode());
101 retVal.setGroupKey(HrGroupKeyBo.from(im.getGroupKey()));
102 retVal.setDescription(im.getDescription());
103 copyCommonFields(retVal, im);
104
105 retVal.setId(im.getId());
106 retVal.setEffectiveLocalDate(im.getEffectiveLocalDate());
107
108 return retVal;
109 }
110
111 public static PositionBase to(PositionBaseBo bo) {
112 if (bo == null) {
113 return null;
114 }
115 return PositionBase.Builder.create(bo).build();
116 }
117
118 public static final ModelObjectUtils.Transformer<PositionBaseBo, PositionBase> toImmutable = new ModelObjectUtils.Transformer<PositionBaseBo, PositionBase>() {
119 public PositionBase transform(PositionBaseBo input) {
120 return PositionBaseBo.to(input);
121 };
122 };
123
124 public static final ModelObjectUtils.Transformer<PositionBase, PositionBaseBo> toBo = new ModelObjectUtils.Transformer<PositionBase, PositionBaseBo>() {
125 public PositionBaseBo transform(PositionBase input) {
126 return PositionBaseBo.from(input);
127 };
128 };
129
130 }