1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.edl.impl.extract;
17
18 import javax.persistence.CascadeType;
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.FetchType;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.ManyToOne;
26 import javax.persistence.Table;
27 import javax.persistence.Version;
28
29 import org.kuali.rice.edl.framework.extract.FieldDTO;
30 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
31
32 import java.io.Serializable;
33
34
35
36
37
38
39
40
41 @Entity
42 @Table(name="KREW_EDL_FLD_DMP_T")
43 public class Fields implements Serializable {
44
45
46
47 @Id
48 @GeneratedValue(generator="KREW_EDL_FLD_DMP_S")
49 @PortableSequenceGenerator(name = "KREW_EDL_FLD_DMP_S")
50 @Column(name="EDL_FIELD_DMP_ID")
51 private Long fieldId;
52
53 @Column(name="DOC_HDR_ID")
54 private String docId;
55
56 @Column(name="FLD_NM")
57 private String fieldName;
58
59 @Column(name="FLD_VAL")
60 private String fieldValue;
61
62 @Version
63 @Column(name="VER_NBR")
64 private Integer lockVerNbr;
65
66 @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST})
67 @JoinColumn(name="DOC_HDR_ID", insertable=false, updatable=false)
68 private Dump dump;
69
70
71
72
73
74 public Long getFieldId() {
75 return fieldId;
76 }
77
78
79
80
81
82 public void setFieldId(Long fieldId) {
83 this.fieldId = fieldId;
84 }
85
86
87
88
89
90 public String getDocId() {
91 return docId;
92 }
93
94
95
96
97
98 public void setDocId(final String docId) {
99 this.docId = docId;
100 }
101
102
103
104
105
106 public String getFieldValue() {
107 return fieldValue;
108 }
109
110
111
112
113
114 public void setFieldValue(final String fieldValue) {
115 this.fieldValue = fieldValue;
116 }
117
118
119
120
121
122 public String getFieldName() {
123 return fieldName;
124 }
125
126
127
128
129
130 public void setFieldName(final String filedName) {
131 this.fieldName = filedName;
132 }
133
134
135
136
137
138 public Integer getLockVerNbr() {
139 return lockVerNbr;
140 }
141
142
143
144
145
146 public void setLockVerNbr(final Integer lockVerNbr) {
147 this.lockVerNbr = lockVerNbr;
148 }
149
150
151
152
153
154 public Dump getDump() {
155 return dump;
156 }
157
158
159
160
161
162 public void setDump(final Dump dump) {
163 this.dump = dump;
164 }
165
166
167
168
169
170
171 public static FieldDTO to(Fields field) {
172 if (field == null) {
173 return null;
174 }
175 FieldDTO fieldDTO = new FieldDTO();
176 fieldDTO.setDocId(field.getDocId());
177 fieldDTO.setFieldName(field.getFieldName());
178 fieldDTO.setFieldValue(field.getFieldValue());
179 fieldDTO.setLockVerNbr(field.getLockVerNbr());
180 return fieldDTO;
181 }
182
183
184
185
186
187
188
189 public static Fields from(FieldDTO fieldDTO, Dump dump) {
190 if (fieldDTO == null) {
191 return null;
192 }
193 Fields fields = new Fields();
194 fields.setDump(dump);
195 fields.setDocId(fieldDTO.getDocId());
196 fields.setFieldName(fieldDTO.getFiledName());
197 fields.setFieldValue(fieldDTO.getFieldValue());
198 fields.setLockVerNbr(fieldDTO.getLockVerNbr());
199 return fields;
200 }
201 }
202