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
35 package fr.paris.lutece.plugins.modulenotifygrumappingmanager.business;
36
37 import fr.paris.lutece.portal.service.plugin.Plugin;
38 import fr.paris.lutece.util.sql.DAOUtil;
39
40 import java.util.ArrayList;
41 import java.util.List;
42
43
44
45
46
47 public final class NotifygruMappingManagerDAO implements INotifygruMappingManagerDAO
48 {
49
50 private static final String SQL_QUERY_NEW_PK = "SELECT max( id_notifygrumappingmanager ) FROM workflow_task_notify_gru_mapping_manager";
51 private static final String SQL_QUERY_SELECT = "SELECT id_notifygrumappingmanager, beanKey, connection_id, customer_id, mobilePhoneNumber, fixedPhoneNumber, email, demandetype, demand_reference FROM workflow_task_notify_gru_mapping_manager WHERE id_notifygrumappingmanager = ?";
52 private static final String SQL_QUERY_SELECT_BY_KEY = "SELECT id_notifygrumappingmanager, beanKey, connection_id, customer_id, mobilePhoneNumber, fixedPhoneNumber, email, demandetype, demand_reference FROM workflow_task_notify_gru_mapping_manager WHERE beanKey = ?";
53 private static final String SQL_QUERY_INSERT = "INSERT INTO workflow_task_notify_gru_mapping_manager ( id_notifygrumappingmanager, beanKey, connection_id, customer_id, mobilePhoneNumber, fixedPhoneNumber, email, demandetype, demand_reference ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? ) ";
54 private static final String SQL_QUERY_DELETE = "DELETE FROM workflow_task_notify_gru_mapping_manager WHERE id_notifygrumappingmanager = ? ";
55 private static final String SQL_QUERY_UPDATE = "UPDATE workflow_task_notify_gru_mapping_manager SET id_notifygrumappingmanager = ?, beanKey = ?, connection_id = ?, customer_id = ?, mobilePhoneNumber = ?, fixedPhoneNumber = ?, email = ?, demandetype = ?, demand_reference = ? WHERE id_notifygrumappingmanager = ?";
56 private static final String SQL_QUERY_SELECTALL = "SELECT id_notifygrumappingmanager, beanKey, connection_id, customer_id, mobilePhoneNumber, fixedPhoneNumber, email, demandetype, demand_reference FROM workflow_task_notify_gru_mapping_manager";
57 private static final String SQL_QUERY_SELECTALL_ID = "SELECT id_notifygrumappingmanager FROM workflow_task_notify_gru_mapping_manager";
58
59
60
61
62
63
64
65
66 public int newPrimaryKey( Plugin plugin )
67 {
68 int nKey = 1;
69 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_NEW_PK, plugin ) )
70 {
71 daoUtil.executeQuery( );
72
73 if ( daoUtil.next( ) )
74 {
75 nKey = daoUtil.getInt( 1 ) + 1;
76 }
77 }
78
79 return nKey;
80 }
81
82
83
84
85 @Override
86 public void insert( NotifygruMappingManager notifygruMappingManager, Plugin plugin )
87 {
88 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, plugin ) )
89 {
90 notifygruMappingManager.setId( newPrimaryKey( plugin ) );
91
92 int nIndex = 1;
93 daoUtil.setInt( nIndex++, notifygruMappingManager.getId( ) );
94
95 daoUtil.setString( nIndex++, notifygruMappingManager.getBeanKey( ) );
96 daoUtil.setInt( nIndex++, notifygruMappingManager.getConnectionId( ) );
97 daoUtil.setInt( nIndex++, notifygruMappingManager.getCustomerId( ) );
98 daoUtil.setInt( nIndex++, notifygruMappingManager.getMobilePhoneNumber( ) );
99 daoUtil.setInt( nIndex++, notifygruMappingManager.getFixedPhoneNumber( ) );
100 daoUtil.setInt( nIndex++, notifygruMappingManager.getEmail( ) );
101 daoUtil.setInt( nIndex++, notifygruMappingManager.getDemandeTypeId( ) );
102 daoUtil.setInt( nIndex++, notifygruMappingManager.getDemandReference( ) );
103
104 daoUtil.executeUpdate( );
105 }
106 }
107
108
109
110
111 @Override
112 public NotifygruMappingManager load( int nKey, Plugin plugin )
113 {
114 NotifygruMappingManager notifygruMappingManager = null;
115 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT, plugin ) )
116 {
117 daoUtil.setInt( 1, nKey );
118 daoUtil.executeQuery( );
119
120 if ( daoUtil.next( ) )
121 {
122 int nIndex = 1;
123 notifygruMappingManager = new NotifygruMappingManager( );
124 notifygruMappingManager.setId( daoUtil.getInt( nIndex++ ) );
125 notifygruMappingManager.setBeanKey( daoUtil.getString( nIndex++ ) );
126 notifygruMappingManager.setConnectionId( daoUtil.getInt( nIndex++ ) );
127 notifygruMappingManager.setCustomerId( daoUtil.getInt( nIndex++ ) );
128 notifygruMappingManager.setMobilePhoneNumber( daoUtil.getInt( nIndex++ ) );
129 notifygruMappingManager.setFixedPhoneNumber( daoUtil.getInt( nIndex++ ) );
130 notifygruMappingManager.setEmail( daoUtil.getInt( nIndex++ ) );
131 notifygruMappingManager.setDemandeTypeId( daoUtil.getInt( nIndex++ ) );
132 notifygruMappingManager.setDemandReference( daoUtil.getInt( nIndex++ ) );
133 }
134 }
135 return notifygruMappingManager;
136 }
137
138
139
140
141 @Override
142 public NotifygruMappingManager load( String strKey, Plugin plugin )
143 {
144 NotifygruMappingManager notifygruMappingManager = null;
145 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_BY_KEY, plugin ) )
146 {
147 daoUtil.setString( 1, strKey );
148 daoUtil.executeQuery( );
149
150 if ( daoUtil.next( ) )
151 {
152 int nIndex = 1;
153 notifygruMappingManager = new NotifygruMappingManager( );
154 notifygruMappingManager.setId( daoUtil.getInt( nIndex++ ) );
155 notifygruMappingManager.setBeanKey( daoUtil.getString( nIndex++ ) );
156 notifygruMappingManager.setConnectionId( daoUtil.getInt( nIndex++ ) );
157 notifygruMappingManager.setCustomerId( daoUtil.getInt( nIndex++ ) );
158 notifygruMappingManager.setMobilePhoneNumber( daoUtil.getInt( nIndex++ ) );
159 notifygruMappingManager.setFixedPhoneNumber( daoUtil.getInt( nIndex++ ) );
160 notifygruMappingManager.setEmail( daoUtil.getInt( nIndex++ ) );
161 notifygruMappingManager.setDemandeTypeId( daoUtil.getInt( nIndex++ ) );
162 notifygruMappingManager.setDemandReference( daoUtil.getInt( nIndex++ ) );
163 }
164 }
165 return notifygruMappingManager;
166 }
167
168
169
170
171 @Override
172 public void delete( int nKey, Plugin plugin )
173 {
174 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE, plugin ) )
175 {
176 daoUtil.setInt( 1, nKey );
177 daoUtil.executeUpdate( );
178 }
179 }
180
181
182
183
184 @Override
185 public void store( NotifygruMappingManager notifygruMappingManager, Plugin plugin )
186 {
187 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE, plugin ) )
188 {
189 int nIndex = 1;
190 daoUtil.setInt( nIndex++, notifygruMappingManager.getId( ) );
191 daoUtil.setString( nIndex++, notifygruMappingManager.getBeanKey( ) );
192 daoUtil.setInt( nIndex++, notifygruMappingManager.getConnectionId( ) );
193 daoUtil.setInt( nIndex++, notifygruMappingManager.getCustomerId( ) );
194 daoUtil.setInt( nIndex++, notifygruMappingManager.getMobilePhoneNumber( ) );
195 daoUtil.setInt( nIndex++, notifygruMappingManager.getFixedPhoneNumber( ) );
196 daoUtil.setInt( nIndex++, notifygruMappingManager.getEmail( ) );
197 daoUtil.setInt( nIndex++, notifygruMappingManager.getDemandeTypeId( ) );
198 daoUtil.setInt( nIndex++, notifygruMappingManager.getDemandReference( ) );
199 daoUtil.setInt( nIndex, notifygruMappingManager.getId( ) );
200
201 daoUtil.executeUpdate( );
202 }
203 }
204
205
206
207
208 @Override
209 public List<NotifygruMappingManager> selectNotifygruMappingManagersList( Plugin plugin )
210 {
211 List<NotifygruMappingManager> notifygruMappingManagerList = new ArrayList<>( );
212 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL, plugin ) )
213 {
214 daoUtil.executeQuery( );
215
216 while ( daoUtil.next( ) )
217 {
218 NotifygruMappingManagersiness/NotifygruMappingManager.html#NotifygruMappingManager">NotifygruMappingManager notifygruMappingManager = new NotifygruMappingManager( );
219 int nIndex = 1;
220 notifygruMappingManager.setId( daoUtil.getInt( nIndex++ ) );
221 notifygruMappingManager.setBeanKey( daoUtil.getString( nIndex++ ) );
222 notifygruMappingManager.setConnectionId( daoUtil.getInt( nIndex++ ) );
223 notifygruMappingManager.setCustomerId( daoUtil.getInt( nIndex++ ) );
224 notifygruMappingManager.setMobilePhoneNumber( daoUtil.getInt( nIndex++ ) );
225 notifygruMappingManager.setFixedPhoneNumber( daoUtil.getInt( nIndex++ ) );
226 notifygruMappingManager.setEmail( daoUtil.getInt( nIndex++ ) );
227 notifygruMappingManager.setDemandeTypeId( daoUtil.getInt( nIndex++ ) );
228 notifygruMappingManager.setDemandReference( daoUtil.getInt( nIndex++ ) );
229
230 notifygruMappingManagerList.add( notifygruMappingManager );
231 }
232 }
233 return notifygruMappingManagerList;
234 }
235
236
237
238
239 @Override
240 public List<Integer> selectIdNotifygruMappingManagersList( Plugin plugin )
241 {
242 List<Integer> notifygruMappingManagerList = new ArrayList<>( );
243 try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL_ID, plugin ) )
244 {
245 daoUtil.executeQuery( );
246
247 while ( daoUtil.next( ) )
248 {
249 notifygruMappingManagerList.add( daoUtil.getInt( 1 ) );
250 }
251 }
252 return notifygruMappingManagerList;
253 }
254 }