1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.impl.peopleflow;
17
18 import org.kuali.rice.core.api.mo.common.Versioned;
19 import org.kuali.rice.kew.api.repository.type.KewAttributeDefinition;
20 import org.kuali.rice.kew.impl.type.KewAttributeDefinitionBo;
21 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
22
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.GeneratedValue;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.ManyToOne;
29 import javax.persistence.Table;
30 import javax.persistence.Version;
31 import java.io.Serializable;
32
33 @Entity
34 @Table(name = "KREW_PPL_FLW_ATTR_T")
35 public class PeopleFlowAttributeBo implements Serializable, Versioned {
36
37 @Id
38 @GeneratedValue(generator = "KREW_PPL_FLW_ATTR_S")
39 @PortableSequenceGenerator(name = "KREW_PPL_FLW_ATTR_S")
40 @Column(name="PPL_FLW_ATTR_ID", nullable = false)
41 private String id;
42
43 @Column(name="ATTR_VAL")
44 private String value;
45
46 @Version
47 @Column(name="VER_NBR", nullable = false)
48 private Long versionNumber;
49
50 @ManyToOne
51 @JoinColumn(name = "PPL_FLW_ID", nullable = false)
52 private PeopleFlowBo peopleFlow;
53
54 @ManyToOne
55 @JoinColumn(name="ATTR_DEFN_ID", nullable = false)
56 private KewAttributeDefinitionBo attributeDefinition;
57
58 public static PeopleFlowAttributeBo from(KewAttributeDefinition attributeDefinition, String id, PeopleFlowBo peopleFlow,
59 String value) {
60
61 if (null == attributeDefinition) {
62 return null;
63 }
64
65 PeopleFlowAttributeBo peopleFlowAttributeBo = new PeopleFlowAttributeBo();
66 peopleFlowAttributeBo.setId(id);
67 peopleFlowAttributeBo.setPeopleFlow(peopleFlow);
68 peopleFlowAttributeBo.setValue(value);
69 peopleFlowAttributeBo.setAttributeDefinition(KewAttributeDefinitionBo.from(attributeDefinition));
70
71 return peopleFlowAttributeBo;
72 }
73
74
75
76
77 public PeopleFlowAttributeBo() { }
78
79
80
81
82
83 public String getId() {
84 return id;
85 }
86
87
88
89
90 public void setId(String id) {
91 this.id = id;
92 }
93
94 public PeopleFlowBo getPeopleFlow() {
95 return peopleFlow;
96 }
97
98 public void setPeopleFlow(PeopleFlowBo peopleFlow) {
99 this.peopleFlow = peopleFlow;
100 }
101
102
103
104
105
106 public String getValue() {
107 return value;
108 }
109
110
111
112
113 public void setValue(String value) {
114 this.value = value;
115 }
116
117
118
119
120
121 public Long getVersionNumber() {
122 return versionNumber;
123 }
124
125
126
127
128 public void setVersionNumber(Long versionNumber) {
129 this.versionNumber = versionNumber;
130 }
131
132
133
134
135
136 public KewAttributeDefinitionBo getAttributeDefinition() {
137 return attributeDefinition;
138 }
139
140
141
142
143 public void setAttributeDefinition(KewAttributeDefinitionBo attributeDefinition) {
144 this.attributeDefinition = attributeDefinition;
145 }
146
147
148
149
150
151 public String getAttributeDefinitionId() {
152 if (null != this.attributeDefinition) {
153 return this.attributeDefinition.getId();
154 } else {
155 return null;
156 }
157 }
158 }