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.forms.modules.template.service;
35
36 import java.util.List;
37
38 import fr.paris.lutece.plugins.forms.business.Control;
39 import fr.paris.lutece.plugins.forms.business.ControlMapping;
40 import fr.paris.lutece.plugins.forms.business.FormDisplay;
41 import fr.paris.lutece.plugins.forms.business.Group;
42 import fr.paris.lutece.plugins.forms.business.Question;
43 import fr.paris.lutece.plugins.forms.business.Step;
44 import fr.paris.lutece.plugins.forms.modules.template.business.Template;
45 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateControlHome;
46 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateDisplayHome;
47 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateEntryHome;
48 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateFieldHome;
49 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateGroupHome;
50 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateQuestionHome;
51 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateReferenceItemFieldHome;
52 import fr.paris.lutece.plugins.forms.modules.template.business.TemplateStepHome;
53 import fr.paris.lutece.plugins.forms.service.IFormDatabaseService;
54 import fr.paris.lutece.plugins.genericattributes.business.Entry;
55 import fr.paris.lutece.plugins.genericattributes.business.Field;
56
57 public class TemplateDatabaseService implements IFormDatabaseService
58 {
59 public static final String BEAN_NAME = "forms-template.templateDatabaseService";
60
61 @Override
62 public void createFormDisplay( FormDisplay formDisplay )
63 {
64 TemplateDisplayHome.create( formDisplay );
65 }
66
67 @Override
68 public List<Question> getListQuestionByForm( int nIdTemplate )
69 {
70 return TemplateQuestionHome.getQuestionsListByStep( nIdTemplate );
71 }
72
73 @Override
74 public Question findQuestionByPrimaryKey( int idQuestion )
75 {
76 return TemplateQuestionHome.findByPrimaryKey( idQuestion );
77 }
78
79 @Override
80 public Entry findEntryByPrimaryKey( int idEntry )
81 {
82 return TemplateEntryHome.findByPrimaryKey( idEntry );
83 }
84
85 @Override
86 public void updateField( Field field )
87 {
88 TemplateFieldHome.update( field );
89 }
90
91 @Override
92 public Field findFieldByPrimaryKey( int idField )
93 {
94 return TemplateFieldHome.findByPrimaryKey( idField );
95 }
96
97 @Override
98 public void updateQuestion( Question question )
99 {
100 TemplateQuestionHome.update( question );
101 }
102
103 @Override
104 public void createGroup( Group group )
105 {
106 TemplateGroupHome.create( group );
107 }
108
109 @Override
110 public void updateGroup( Group group )
111 {
112 TemplateGroupHome.update( group );
113 }
114
115 @Override
116 public Group findGroupByPrimaryKey( int idGroup )
117 {
118 return TemplateGroupHome.findByPrimaryKey( idGroup );
119 }
120
121 @Override
122 public FormDisplay findDisplayByPrimaryKey( int idDisplay )
123 {
124 return TemplateDisplayHome.findByPrimaryKey( idDisplay );
125 }
126
127 @Override
128 public void createEntry( Entry entry )
129 {
130 TemplateEntryHome.create( entry );
131 }
132
133 @Override
134 public void createField( Field field )
135 {
136 TemplateFieldHome.create( field );
137 }
138
139 @Override
140 public void createQuestion( Question question )
141 {
142 TemplateQuestionHome.create( question );
143 }
144
145 @Override
146 public Step findStepByPrimaryKey( int idStep )
147 {
148 return TemplateStepHome.findByPrimaryKey( idStep );
149 }
150
151 @Override
152 public void updateEntry( Entry entry )
153 {
154 TemplateEntryHome.update( entry );
155 }
156
157 @Override
158 public List<FormDisplay> getFormDisplayListByParent( int nIdStep, int nIdParent )
159 {
160 return TemplateDisplayHome.getFormDisplayListByParent( nIdStep, nIdParent );
161 }
162
163 @Override
164 public void updateFormDisplay( FormDisplay formDisplay )
165 {
166 TemplateDisplayHome.update( formDisplay );
167 }
168
169 @Override
170 public Entry copyEntry( Entry entry )
171 {
172 return TemplateEntryHome.copy( entry );
173 }
174
175 @Override
176 public List<Control> getControlByQuestion( int nIdQuestion )
177 {
178 return TemplateControlHome.getControlByQuestion( nIdQuestion );
179 }
180
181 @Override
182 public FormDisplay getFormDisplayByFormStepAndComposite( int nIdForm, int nIdStep, int nIdComposite )
183 {
184 return TemplateDisplayHome.getFormDisplayByStepAndComposite( nIdStep, nIdComposite );
185 }
186
187 @Override
188 public void createControl( Control control )
189 {
190 TemplateControlHome.create( control );
191 }
192
193 @Override
194 public List<Group> getGroupsListByIdStepList( List<Integer> idStepList )
195 {
196 return TemplateGroupHome.getGroupsListByIdStepList( idStepList );
197 }
198
199 @Override
200 public List<Question> getQuestionsListByStep( int nIdStep )
201 {
202 return TemplateQuestionHome.getQuestionsListByStep( nIdStep );
203 }
204
205 @Override
206 public Integer findIdReferenceItemByIdField( int idField )
207 {
208 return TemplateReferenceItemFieldHome.findIdItemByIdField( idField );
209 }
210
211 @Override
212 public List<ControlMapping> getControlMappingListByIdControl( int nIdControl )
213 {
214 return TemplateControlHome.getControlMappingListByIdControl( nIdControl );
215 }
216
217 @Override
218 public void createStep( Step step )
219 {
220 Templateins/forms/modules/template/business/Template.html#Template">Template template = new Template( );
221 template.setTitle( step.getTitle( ) );
222 template.setDescription( step.getDescription( ) );
223 TemplateStepHome.create( template );
224 }
225
226 @Override
227 public void createMappingControl( int nIdcontrol, int nIdQuestion, String strValue )
228 {
229 TemplateControlHome.createMappingControl( nIdcontrol, nIdQuestion, strValue );
230 }
231 }