1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.codewizard.business;
35
36 import fr.paris.lutece.plugins.codewizard.service.JavaTypeService;
37 import java.util.ArrayList;
38 import java.util.List;
39
40
41
42
43 public class BusinessObject
44 {
45
46 private String _strPackageName;
47 private String _strClassName;
48 private String _strTable;
49 private String _strIdColumnName;
50 private String _strPluginName;
51 private List<ObjectAttribute> _attributes = new ArrayList<ObjectAttribute>( );
52
53
54
55
56
57
58
59 public void setPackageName( String strPackageName )
60 {
61 _strPackageName = strPackageName;
62 }
63
64
65
66
67
68
69 public String getPackageName( )
70 {
71 return _strPackageName;
72 }
73
74
75
76
77
78
79
80 public void setClassName( String strClassName )
81 {
82 _strClassName = strClassName;
83 }
84
85
86
87
88
89
90 public String getClassName( )
91 {
92 return _strClassName;
93 }
94
95
96
97
98
99
100
101 public void setTable( String strTable )
102 {
103 _strTable = strTable;
104 }
105
106
107
108
109
110
111 public String getTable( )
112 {
113 return _strTable;
114 }
115
116
117
118
119
120
121
122 public void setIdColumnName( String strIdColumnName )
123 {
124 _strIdColumnName = strIdColumnName;
125 }
126
127
128
129
130
131
132 public String getIdColumnName( )
133 {
134 return _strIdColumnName;
135 }
136
137
138
139
140
141
142 public void addAttribute( ObjectAttribute attribute )
143 {
144 _attributes.add( attribute );
145 }
146
147
148
149
150
151
152 public String getSelectSQLRequest( )
153 {
154 return null;
155 }
156
157
158
159
160
161
162 public List<ObjectAttribute> getAttributes( )
163 {
164 return _attributes;
165 }
166
167
168
169
170
171 public List<ObjectAttribute> getDaoAttributes( )
172 {
173 List<ObjectAttribute> list = new ArrayList<>();
174 for( ObjectAttribute attribute : _attributes )
175 {
176 if( attribute.isDaoType() )
177 {
178 list.add( attribute );
179 }
180 }
181 return list;
182 }
183
184
185
186
187
188 public List<String> getImports( )
189 {
190 List<String> list = new ArrayList<>();
191 for( ObjectAttribute attribute : _attributes )
192 {
193 String strImport = JavaTypeService.getImport( attribute.getType() );
194 if( strImport != null )
195 {
196 list.add( strImport );
197 }
198 }
199 return list;
200 }
201
202
203
204
205
206
207 public String getInstanceName( )
208 {
209 String strInstanceName = _strClassName.substring( 0, 1 ).toLowerCase( ) + _strClassName.substring( 1, _strClassName.length( ) );
210
211 return strInstanceName;
212 }
213
214
215
216
217
218
219 public String getPluginName( )
220 {
221 return _strPluginName;
222 }
223
224
225
226
227
228
229
230 public void setPluginName( String strPluginName )
231 {
232 _strPluginName = strPluginName;
233 }
234 }