commit | author | age
|
a18bfa
|
1 |
package cn.autoform.util.form.mapper; |
Z |
2 |
|
|
3 |
import cn.autoform.db.entity.FormFieldAttrEntity; |
|
4 |
import cn.autoform.db.entity.FormFieldEntity; |
|
5 |
import cn.autoform.db.entity.form.FormCpnAttr; |
|
6 |
import cn.autoform.db.entity.form.FormCpnAttr.Custom; |
|
7 |
import cn.autoform.db.entity.form.FormCpnInfo; |
|
8 |
import java.util.ArrayList; |
|
9 |
import java.util.List; |
|
10 |
import javax.annotation.Generated; |
|
11 |
|
|
12 |
@Generated( |
|
13 |
value = "org.mapstruct.ap.MappingProcessor", |
|
14 |
date = "2020-05-18T19:31:08+0800", |
|
15 |
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_65 (Oracle Corporation)" |
|
16 |
) |
|
17 |
public class FormCpnInfoMapperImpl implements FormCpnInfoMapper { |
|
18 |
|
|
19 |
@Override |
|
20 |
public FormFieldEntity of(FormCpnInfo formCpnInfo) { |
|
21 |
if ( formCpnInfo == null ) { |
|
22 |
return null; |
|
23 |
} |
|
24 |
|
|
25 |
FormFieldEntity formFieldEntity = new FormFieldEntity(); |
|
26 |
|
|
27 |
String masterData = formCpnInfoTagAttributeMasterData( formCpnInfo ); |
|
28 |
if ( masterData != null ) { |
|
29 |
formFieldEntity.setMasterData( masterData ); |
|
30 |
} |
|
31 |
formFieldEntity.setParentsubFormNum( formCpnInfo.getParentsubFormNum() ); |
|
32 |
Boolean visible = formCpnInfoTagAttributeVisible( formCpnInfo ); |
|
33 |
if ( visible != null ) { |
|
34 |
formFieldEntity.setVisible( visible ); |
|
35 |
} |
|
36 |
String alias = formCpnInfoTagAttributeAlias( formCpnInfo ); |
|
37 |
if ( alias != null ) { |
|
38 |
formFieldEntity.setFieldKey( alias ); |
|
39 |
} |
|
40 |
Boolean editable = formCpnInfoTagAttributeEditable( formCpnInfo ); |
|
41 |
if ( editable != null ) { |
|
42 |
formFieldEntity.setEditable( editable ); |
|
43 |
} |
|
44 |
formFieldEntity.setColumnOrderNum( formCpnInfo.getColumnOrderNum() ); |
|
45 |
List<FormFieldAttrEntity> customArr = formCpnInfoTagAttributeCustomArr( formCpnInfo ); |
|
46 |
List<FormFieldAttrEntity> list = customArr; |
|
47 |
if ( list != null ) { |
|
48 |
formFieldEntity.setFieldAttr( new ArrayList<FormFieldAttrEntity>( list ) ); |
|
49 |
} |
|
50 |
else { |
|
51 |
formFieldEntity.setFieldAttr( null ); |
|
52 |
} |
|
53 |
if ( formCpnInfo.getTagType() != null ) { |
|
54 |
formFieldEntity.setFieldtype( formCpnInfo.getTagType().name() ); |
|
55 |
} |
|
56 |
String title = formCpnInfoTagAttributeTitle( formCpnInfo ); |
|
57 |
if ( title != null ) { |
|
58 |
formFieldEntity.setTitle( title ); |
|
59 |
} |
|
60 |
List<Custom> custom = formCpnInfoTagAttributeCustom( formCpnInfo ); |
|
61 |
List<Custom> list1 = custom; |
|
62 |
if ( list1 != null ) { |
|
63 |
formFieldEntity.setDataSourceData( new ArrayList<Object>( list1 ) ); |
|
64 |
} |
|
65 |
else { |
|
66 |
formFieldEntity.setDataSourceData( null ); |
|
67 |
} |
|
68 |
formFieldEntity.setFieldOrderNum( formCpnInfo.getFieldOrderNum() ); |
|
69 |
String chooseForm = formCpnInfoTagAttributeChooseForm( formCpnInfo ); |
|
70 |
if ( chooseForm != null ) { |
|
71 |
formFieldEntity.setValue( chooseForm ); |
|
72 |
} |
|
73 |
String datasourcetype = formCpnInfoTagAttributeDatasourcetype( formCpnInfo ); |
|
74 |
if ( datasourcetype != null ) { |
|
75 |
formFieldEntity.setDataSourceType( datasourcetype ); |
|
76 |
} |
|
77 |
formFieldEntity.setFieldId( formCpnInfo.getTagId() ); |
|
78 |
|
|
79 |
formFieldEntity.setFieldset( cn.autoform.util.tool.JSONTool.toJson(formCpnInfo) ); |
|
80 |
formFieldEntity.setTenantID( cn.autoform.util.thread.ThreadData.get(cn.autoform.util.thread.Keys.TENANT_ID) ); |
|
81 |
|
|
82 |
return formFieldEntity; |
|
83 |
} |
|
84 |
|
|
85 |
private String formCpnInfoTagAttributeMasterData(FormCpnInfo formCpnInfo) { |
|
86 |
if ( formCpnInfo == null ) { |
|
87 |
return null; |
|
88 |
} |
|
89 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
90 |
if ( tagAttribute == null ) { |
|
91 |
return null; |
|
92 |
} |
|
93 |
String masterData = tagAttribute.getMasterData(); |
|
94 |
if ( masterData == null ) { |
|
95 |
return null; |
|
96 |
} |
|
97 |
return masterData; |
|
98 |
} |
|
99 |
|
|
100 |
private Boolean formCpnInfoTagAttributeVisible(FormCpnInfo formCpnInfo) { |
|
101 |
if ( formCpnInfo == null ) { |
|
102 |
return null; |
|
103 |
} |
|
104 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
105 |
if ( tagAttribute == null ) { |
|
106 |
return null; |
|
107 |
} |
|
108 |
Boolean visible = tagAttribute.getVisible(); |
|
109 |
if ( visible == null ) { |
|
110 |
return null; |
|
111 |
} |
|
112 |
return visible; |
|
113 |
} |
|
114 |
|
|
115 |
private String formCpnInfoTagAttributeAlias(FormCpnInfo formCpnInfo) { |
|
116 |
if ( formCpnInfo == null ) { |
|
117 |
return null; |
|
118 |
} |
|
119 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
120 |
if ( tagAttribute == null ) { |
|
121 |
return null; |
|
122 |
} |
|
123 |
String alias = tagAttribute.getAlias(); |
|
124 |
if ( alias == null ) { |
|
125 |
return null; |
|
126 |
} |
|
127 |
return alias; |
|
128 |
} |
|
129 |
|
|
130 |
private Boolean formCpnInfoTagAttributeEditable(FormCpnInfo formCpnInfo) { |
|
131 |
if ( formCpnInfo == null ) { |
|
132 |
return null; |
|
133 |
} |
|
134 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
135 |
if ( tagAttribute == null ) { |
|
136 |
return null; |
|
137 |
} |
|
138 |
Boolean editable = tagAttribute.getEditable(); |
|
139 |
if ( editable == null ) { |
|
140 |
return null; |
|
141 |
} |
|
142 |
return editable; |
|
143 |
} |
|
144 |
|
|
145 |
private List<FormFieldAttrEntity> formCpnInfoTagAttributeCustomArr(FormCpnInfo formCpnInfo) { |
|
146 |
if ( formCpnInfo == null ) { |
|
147 |
return null; |
|
148 |
} |
|
149 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
150 |
if ( tagAttribute == null ) { |
|
151 |
return null; |
|
152 |
} |
|
153 |
List<FormFieldAttrEntity> customArr = tagAttribute.getCustomArr(); |
|
154 |
if ( customArr == null ) { |
|
155 |
return null; |
|
156 |
} |
|
157 |
return customArr; |
|
158 |
} |
|
159 |
|
|
160 |
private String formCpnInfoTagAttributeTitle(FormCpnInfo formCpnInfo) { |
|
161 |
if ( formCpnInfo == null ) { |
|
162 |
return null; |
|
163 |
} |
|
164 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
165 |
if ( tagAttribute == null ) { |
|
166 |
return null; |
|
167 |
} |
|
168 |
String title = tagAttribute.getTitle(); |
|
169 |
if ( title == null ) { |
|
170 |
return null; |
|
171 |
} |
|
172 |
return title; |
|
173 |
} |
|
174 |
|
|
175 |
private List<Custom> formCpnInfoTagAttributeCustom(FormCpnInfo formCpnInfo) { |
|
176 |
if ( formCpnInfo == null ) { |
|
177 |
return null; |
|
178 |
} |
|
179 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
180 |
if ( tagAttribute == null ) { |
|
181 |
return null; |
|
182 |
} |
|
183 |
List<Custom> custom = tagAttribute.getCustom(); |
|
184 |
if ( custom == null ) { |
|
185 |
return null; |
|
186 |
} |
|
187 |
return custom; |
|
188 |
} |
|
189 |
|
|
190 |
private String formCpnInfoTagAttributeChooseForm(FormCpnInfo formCpnInfo) { |
|
191 |
if ( formCpnInfo == null ) { |
|
192 |
return null; |
|
193 |
} |
|
194 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
195 |
if ( tagAttribute == null ) { |
|
196 |
return null; |
|
197 |
} |
|
198 |
String chooseForm = tagAttribute.getChooseForm(); |
|
199 |
if ( chooseForm == null ) { |
|
200 |
return null; |
|
201 |
} |
|
202 |
return chooseForm; |
|
203 |
} |
|
204 |
|
|
205 |
private String formCpnInfoTagAttributeDatasourcetype(FormCpnInfo formCpnInfo) { |
|
206 |
if ( formCpnInfo == null ) { |
|
207 |
return null; |
|
208 |
} |
|
209 |
FormCpnAttr tagAttribute = formCpnInfo.getTagAttribute(); |
|
210 |
if ( tagAttribute == null ) { |
|
211 |
return null; |
|
212 |
} |
|
213 |
String datasourcetype = tagAttribute.getDatasourcetype(); |
|
214 |
if ( datasourcetype == null ) { |
|
215 |
return null; |
|
216 |
} |
|
217 |
return datasourcetype; |
|
218 |
} |
|
219 |
} |