001// ______________________________________________________
002// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 
003// modified by guyadong from
004// sql2java original version https://sourceforge.net/projects/sql2java/ 
005// JDBC driver used at code generation time: com.mysql.jdbc.Driver
006// template: manager.interface.java.vm
007// ______________________________________________________
008package net.gdface.facelog.db;
009import net.gdface.facelog.db.exception.ObjectRetrievalException;
010import net.gdface.facelog.db.exception.RuntimeDaoException;
011
012/**
013 * Interface to handle database calls (save, load, count, etc...) for the fl_device table.<br>
014 * Remarks: 前端设备基本信息
015 * @author guyadong
016 */
017public interface IDeviceManager extends TableManager<DeviceBean>
018{  
019    //////////////////////////////////////
020    // PRIMARY KEY METHODS
021    //////////////////////////////////////
022
023    //1
024    /**
025     * Loads a {@link DeviceBean} from the fl_device using primary key fields.
026     *
027     * @param id Integer - PK# 1
028     * @return a unique DeviceBean or {@code null} if not found
029     * @throws RuntimeDaoException
030     */
031    public DeviceBean loadByPrimaryKey(Integer id)throws RuntimeDaoException;
032
033    //1.1
034    /**
035     * Loads a {@link DeviceBean} from the fl_device using primary key fields.
036     *
037     * @param id Integer - PK# 1
038     * @return a unique DeviceBean
039     * @throws ObjectRetrievalException if not found
040     * @throws RuntimeDaoException
041     */
042    public DeviceBean loadByPrimaryKeyChecked(Integer id) throws RuntimeDaoException,ObjectRetrievalException;
043    
044    //1.4
045    /**
046     * Returns true if this fl_device contains row with primary key fields.
047     * @param id Integer - PK# 1
048     * @return
049     * @throws RuntimeDaoException
050     */
051    public boolean existsPrimaryKey(Integer id)throws RuntimeDaoException;
052    //1.4.1
053    /**
054     * Check duplicated row by primary keys,if row exists throw exception
055     * @param id Integer
056     * @return 
057     * @throws RuntimeDaoException
058     * @throws ObjectRetrievalException
059     */
060    public Integer checkDuplicate(Integer id)throws RuntimeDaoException,ObjectRetrievalException;
061    //1.8
062    /**
063     * Loads {@link DeviceBean} from the fl_device using primary key fields.
064     *
065     * @param keys primary keys array
066     * @return list of DeviceBean
067     * @throws RuntimeDaoException
068     */
069    public java.util.List<DeviceBean> loadByPrimaryKey(int... keys)throws RuntimeDaoException;
070    //1.9
071    /**
072     * Loads {@link DeviceBean} from the fl_device using primary key fields.
073     *
074     * @param keys primary keys collection
075     * @return list of DeviceBean
076     * @throws RuntimeDaoException
077     */
078    public java.util.List<DeviceBean> loadByPrimaryKey(java.util.Collection<Integer> keys)throws RuntimeDaoException;
079    //2
080    /**
081     * Delete row according to its primary keys.<br>
082     * all keys must not be null
083     *
084     * @param id Integer - PK# 1
085     * @return the number of deleted rows
086     * @throws RuntimeDaoException
087     */
088    public int deleteByPrimaryKey(Integer id)throws RuntimeDaoException;
089    //2.2
090    /**
091     * Delete rows according to primary key.<br>
092     *
093     * @param keys primary keys array
094     * @return the number of deleted rows
095     * @throws RuntimeDaoException
096     */
097    public int deleteByPrimaryKey(int... keys)throws RuntimeDaoException;
098    //2.3
099    /**
100     * Delete rows according to primary key.<br>
101     *
102     * @param keys primary keys collection
103     * @return the number of deleted rows
104     * @throws RuntimeDaoException
105     */
106    public int deleteByPrimaryKey(java.util.Collection<Integer> keys)throws RuntimeDaoException;
107    //2.4
108    /**
109     * Delete beans.<br>
110     *
111     * @param beans DeviceBean collection wille be deleted
112     * @return the number of deleted rows
113     * @throws RuntimeDaoException
114     */
115    public int delete(DeviceBean... beans)throws RuntimeDaoException;
116    //2.5
117    /**
118     * Delete beans.<br>
119     *
120     * @param beans DeviceBean collection wille be deleted
121     * @return the number of deleted rows
122     * @throws RuntimeDaoException
123     */
124    public int delete(java.util.Collection<DeviceBean> beans)throws RuntimeDaoException;
125 
126
127    //////////////////////////////////////
128    // GET/SET IMPORTED KEY BEAN METHOD
129    //////////////////////////////////////
130    //3.1 GET IMPORTED
131    /**
132     * Retrieves the {@link ImageBean} object from the fl_image.device_id field.<BR>
133     * FK_NAME : fl_image_ibfk_1 
134     * @param bean the {@link DeviceBean}
135     * @return the associated {@link ImageBean} beans or {@code null} if {@code bean} is {@code null}
136     * @throws RuntimeDaoException
137     */
138    public ImageBean[] getImageBeansByDeviceId(DeviceBean bean)throws RuntimeDaoException;
139    
140    //3.1.2 GET IMPORTED
141    /**
142     * Retrieves the {@link ImageBean} object from the fl_image.device_id field.<BR>
143     * FK_NAME : fl_image_ibfk_1 
144     * @param idOfDevice Integer - PK# 1
145     * @return the associated {@link ImageBean} beans or {@code null} if {@code bean} is {@code null}
146     * @throws RuntimeDaoException
147     */
148    public ImageBean[] getImageBeansByDeviceId(Integer idOfDevice)throws RuntimeDaoException;
149    
150    //3.2 GET IMPORTED
151    /**
152     * see also #getImageBeansByDeviceIdAsList(DeviceBean,int,int)
153     * @param bean
154     * @return
155     * @throws RuntimeDaoException
156     */
157    public java.util.List<ImageBean> getImageBeansByDeviceIdAsList(DeviceBean bean)throws RuntimeDaoException;
158
159    //3.2.2 GET IMPORTED
160    /**
161     * Retrieves the {@link ImageBean} object from fl_image.device_id field.<BR>
162     * FK_NAME:fl_image_ibfk_1
163     * @param idOfDevice Integer - PK# 1
164     * @return the associated {@link ImageBean} beans 
165     * @throws RuntimeDaoException
166     */
167    public java.util.List<ImageBean> getImageBeansByDeviceIdAsList(Integer idOfDevice)throws RuntimeDaoException;
168    //3.2.3 DELETE IMPORTED
169    /**
170     * delete the associated {@link ImageBean} objects from fl_image.device_id field.<BR>
171     * FK_NAME:fl_image_ibfk_1
172     * @param idOfDevice Integer - PK# 1
173     * @return the number of deleted rows
174     * @throws RuntimeDaoException
175     */
176    public int deleteImageBeansByDeviceId(Integer idOfDevice)throws RuntimeDaoException;
177    //3.2.4 GET IMPORTED
178    /**
179     * Retrieves the {@link ImageBean} object from fl_image.device_id field.<BR>
180     * FK_NAME:fl_image_ibfk_1
181     * @param bean the {@link DeviceBean}
182     * @param startRow the start row to be used (first row = 1, last row=-1)
183     * @param numRows the number of rows to be retrieved (all rows = a negative number)
184     * @return the associated {@link ImageBean} beans or empty list if {@code bean} is {@code null}
185     * @throws RuntimeDaoException
186     */
187    public java.util.List<ImageBean> getImageBeansByDeviceIdAsList(DeviceBean bean,int startRow,int numRows)throws RuntimeDaoException;    
188    //3.3 SET IMPORTED
189    /**
190     * set  the {@link ImageBean} object array associate to DeviceBean by the fl_image.device_id field.<BR>
191     * FK_NAME : fl_image_ibfk_1 
192     * @param bean the referenced {@link DeviceBean}
193     * @param importedBeans imported beans from fl_image
194     * @return importedBeans always
195     * @see IImageManager#setReferencedByDeviceId(ImageBean, DeviceBean)
196     * @throws RuntimeDaoException
197     */
198    public ImageBean[] setImageBeansByDeviceId(DeviceBean bean , ImageBean[] importedBeans)throws RuntimeDaoException;
199
200    //3.4 SET IMPORTED
201    /**
202     * set  the {@link ImageBean} object java.util.Collection associate to DeviceBean by the fl_image.device_id field.<BR>
203     * FK_NAME:fl_image_ibfk_1
204     * @param bean the referenced {@link DeviceBean} 
205     * @param importedBeans imported beans from fl_image 
206     * @return importedBeans always
207     * @see IImageManager#setReferencedByDeviceId(ImageBean, DeviceBean)
208     * @throws RuntimeDaoException
209     */
210    public <C extends java.util.Collection<ImageBean>> C setImageBeansByDeviceId(DeviceBean bean , C importedBeans)throws RuntimeDaoException;
211
212    //3.1 GET IMPORTED
213    /**
214     * Retrieves the {@link LogBean} object from the fl_log.device_id field.<BR>
215     * FK_NAME : fl_log_ibfk_2 
216     * @param bean the {@link DeviceBean}
217     * @return the associated {@link LogBean} beans or {@code null} if {@code bean} is {@code null}
218     * @throws RuntimeDaoException
219     */
220    public LogBean[] getLogBeansByDeviceId(DeviceBean bean)throws RuntimeDaoException;
221    
222    //3.1.2 GET IMPORTED
223    /**
224     * Retrieves the {@link LogBean} object from the fl_log.device_id field.<BR>
225     * FK_NAME : fl_log_ibfk_2 
226     * @param idOfDevice Integer - PK# 1
227     * @return the associated {@link LogBean} beans or {@code null} if {@code bean} is {@code null}
228     * @throws RuntimeDaoException
229     */
230    public LogBean[] getLogBeansByDeviceId(Integer idOfDevice)throws RuntimeDaoException;
231    
232    //3.2 GET IMPORTED
233    /**
234     * see also #getLogBeansByDeviceIdAsList(DeviceBean,int,int)
235     * @param bean
236     * @return
237     * @throws RuntimeDaoException
238     */
239    public java.util.List<LogBean> getLogBeansByDeviceIdAsList(DeviceBean bean)throws RuntimeDaoException;
240
241    //3.2.2 GET IMPORTED
242    /**
243     * Retrieves the {@link LogBean} object from fl_log.device_id field.<BR>
244     * FK_NAME:fl_log_ibfk_2
245     * @param idOfDevice Integer - PK# 1
246     * @return the associated {@link LogBean} beans 
247     * @throws RuntimeDaoException
248     */
249    public java.util.List<LogBean> getLogBeansByDeviceIdAsList(Integer idOfDevice)throws RuntimeDaoException;
250    //3.2.3 DELETE IMPORTED
251    /**
252     * delete the associated {@link LogBean} objects from fl_log.device_id field.<BR>
253     * FK_NAME:fl_log_ibfk_2
254     * @param idOfDevice Integer - PK# 1
255     * @return the number of deleted rows
256     * @throws RuntimeDaoException
257     */
258    public int deleteLogBeansByDeviceId(Integer idOfDevice)throws RuntimeDaoException;
259    //3.2.4 GET IMPORTED
260    /**
261     * Retrieves the {@link LogBean} object from fl_log.device_id field.<BR>
262     * FK_NAME:fl_log_ibfk_2
263     * @param bean the {@link DeviceBean}
264     * @param startRow the start row to be used (first row = 1, last row=-1)
265     * @param numRows the number of rows to be retrieved (all rows = a negative number)
266     * @return the associated {@link LogBean} beans or empty list if {@code bean} is {@code null}
267     * @throws RuntimeDaoException
268     */
269    public java.util.List<LogBean> getLogBeansByDeviceIdAsList(DeviceBean bean,int startRow,int numRows)throws RuntimeDaoException;    
270    //3.3 SET IMPORTED
271    /**
272     * set  the {@link LogBean} object array associate to DeviceBean by the fl_log.device_id field.<BR>
273     * FK_NAME : fl_log_ibfk_2 
274     * @param bean the referenced {@link DeviceBean}
275     * @param importedBeans imported beans from fl_log
276     * @return importedBeans always
277     * @see ILogManager#setReferencedByDeviceId(LogBean, DeviceBean)
278     * @throws RuntimeDaoException
279     */
280    public LogBean[] setLogBeansByDeviceId(DeviceBean bean , LogBean[] importedBeans)throws RuntimeDaoException;
281
282    //3.4 SET IMPORTED
283    /**
284     * set  the {@link LogBean} object java.util.Collection associate to DeviceBean by the fl_log.device_id field.<BR>
285     * FK_NAME:fl_log_ibfk_2
286     * @param bean the referenced {@link DeviceBean} 
287     * @param importedBeans imported beans from fl_log 
288     * @return importedBeans always
289     * @see ILogManager#setReferencedByDeviceId(LogBean, DeviceBean)
290     * @throws RuntimeDaoException
291     */
292    public <C extends java.util.Collection<LogBean>> C setLogBeansByDeviceId(DeviceBean bean , C importedBeans)throws RuntimeDaoException;
293
294    //3.5 SYNC SAVE 
295    /**
296     * Save the DeviceBean bean and referenced beans and imported beans into the database.
297     *
298     * @param bean the {@link DeviceBean} bean to be saved
299     * @param refDevicegroupByGroupId the {@link DeviceGroupBean} bean referenced by {@link DeviceBean} 
300     * @param impImageByDeviceId the {@link ImageBean} bean refer to {@link DeviceBean} 
301     * @param impLogByDeviceId the {@link LogBean} bean refer to {@link DeviceBean} 
302     * @return the inserted or updated {@link DeviceBean} bean
303     * @throws RuntimeDaoException
304     */
305    public DeviceBean save(DeviceBean bean
306        , DeviceGroupBean refDevicegroupByGroupId 
307        , ImageBean[] impImageByDeviceId , LogBean[] impLogByDeviceId )throws RuntimeDaoException;
308    //3.6 SYNC SAVE AS TRANSACTION
309    /**
310     * Transaction version for sync save<br>
311     * see also {@link #save(DeviceBean , DeviceGroupBean , ImageBean[] , LogBean[] )}
312     * @param bean the {@link DeviceBean} bean to be saved
313     * @param refDevicegroupByGroupId the {@link DeviceGroupBean} bean referenced by {@link DeviceBean} 
314     * @param impImageByDeviceId the {@link ImageBean} bean refer to {@link DeviceBean} 
315     * @param impLogByDeviceId the {@link LogBean} bean refer to {@link DeviceBean} 
316     * @return the inserted or updated {@link DeviceBean} bean
317     * @throws RuntimeDaoException
318     */
319    public DeviceBean saveAsTransaction(final DeviceBean bean
320        ,final DeviceGroupBean refDevicegroupByGroupId 
321        ,final ImageBean[] impImageByDeviceId ,final LogBean[] impLogByDeviceId )throws RuntimeDaoException;
322    //3.7 SYNC SAVE 
323    /**
324     * Save the DeviceBean bean and referenced beans and imported beans into the database.
325     *
326     * @param bean the {@link DeviceBean} bean to be saved
327     * @param refDevicegroupByGroupId the {@link DeviceGroupBean} bean referenced by {@link DeviceBean} 
328     * @param impImageByDeviceId the {@link ImageBean} bean refer to {@link DeviceBean} 
329     * @param impLogByDeviceId the {@link LogBean} bean refer to {@link DeviceBean} 
330     * @return the inserted or updated {@link DeviceBean} bean
331     * @throws RuntimeDaoException
332     */
333    public DeviceBean save(DeviceBean bean
334        , DeviceGroupBean refDevicegroupByGroupId 
335        , java.util.Collection<ImageBean> impImageByDeviceId , java.util.Collection<LogBean> impLogByDeviceId )throws RuntimeDaoException;
336    //3.8 SYNC SAVE AS TRANSACTION
337    /**
338     * Transaction version for sync save<br>
339     * see also {@link #save(DeviceBean , DeviceGroupBean , java.util.Collection , java.util.Collection )}
340     * @param bean the {@link DeviceBean} bean to be saved
341     * @param refDevicegroupByGroupId the {@link DeviceGroupBean} bean referenced by {@link DeviceBean} 
342     * @param impImageByDeviceId the {@link ImageBean} bean refer to {@link DeviceBean} 
343     * @param impLogByDeviceId the {@link LogBean} bean refer to {@link DeviceBean} 
344     * @return the inserted or updated {@link DeviceBean} bean
345     * @throws RuntimeDaoException
346     */
347    public DeviceBean saveAsTransaction(final DeviceBean bean
348        ,final DeviceGroupBean refDevicegroupByGroupId 
349        ,final  java.util.Collection<ImageBean> impImageByDeviceId ,final  java.util.Collection<LogBean> impLogByDeviceId )throws RuntimeDaoException;
350      //////////////////////////////////////
351    // GET/SET FOREIGN KEY BEAN METHOD
352    //////////////////////////////////////
353    //5.1 GET REFERENCED VALUE
354    /**
355     * Retrieves the {@link DeviceGroupBean} object referenced by {@link DeviceBean#getGroupId}() field.<br>
356     * FK_NAME : fl_device_ibfk_1
357     * @param bean the {@link DeviceBean}
358     * @return the associated {@link DeviceGroupBean} bean or {@code null} if {@code bean} is {@code null}
359     * @throws RuntimeDaoException
360     */
361    public DeviceGroupBean getReferencedByGroupId(DeviceBean bean)throws RuntimeDaoException;
362
363    //5.2 SET REFERENCED 
364    /**
365     * Associates the {@link DeviceBean} object to the {@link DeviceGroupBean} object by {@link DeviceBean#getGroupId}() field.
366     *
367     * @param bean the {@link DeviceBean} object to use
368     * @param beanToSet the {@link DeviceGroupBean} object to associate to the {@link DeviceBean}
369     * @return always beanToSet saved
370     * @throws RuntimeDaoException
371     */
372    public DeviceGroupBean setReferencedByGroupId(DeviceBean bean, DeviceGroupBean beanToSet)throws RuntimeDaoException;
373    //_____________________________________________________________________
374    //
375    // USING INDICES
376    //_____________________________________________________________________
377
378
379    /**
380     * Retrieves an unique DeviceBean using the mac index.
381     * 
382     * @param mac the mac column's value filter
383     * @return an DeviceBean,otherwise null if not found or exists null in input arguments
384     * @throws RuntimeDaoException
385     */
386    public DeviceBean loadByIndexMac(String mac)throws RuntimeDaoException;
387    /**
388     * Retrieves an unique DeviceBean using the mac index.
389     * 
390     * @param mac the mac column's value filter. must not be null
391     * @return an DeviceBean
392     * @throws NullPointerException exists null in input arguments
393     * @throws ObjectRetrievalException if not found
394     * @throws RuntimeDaoException
395     */
396    public DeviceBean loadByIndexMacChecked(String mac)throws RuntimeDaoException,ObjectRetrievalException;
397    /**
398     * Retrieves an unique DeviceBean for each mac index.
399     *
400     * @param indexs index array
401     * @return an list of DeviceBean
402     * @throws RuntimeDaoException
403     */
404    public java.util.List<DeviceBean> loadByIndexMac(String... indexs)throws RuntimeDaoException;
405    /**
406     * Retrieves an unique DeviceBean for each mac index.
407     *
408     * @param indexs index collection
409     * @return an list of DeviceBean
410     * @throws RuntimeDaoException
411     */
412    public java.util.List<DeviceBean> loadByIndexMac(java.util.Collection<String> indexs)throws RuntimeDaoException;
413    /**
414     * Deletes rows for each mac index.
415     *
416     * @param indexs index array
417     * @return the number of deleted rows
418     * @throws RuntimeDaoException
419     */
420    public int deleteByIndexMac(String... indexs)throws RuntimeDaoException;
421    /**
422     * Deletes rows for each mac index.
423     *
424     * @param indexs index collection
425     * @return the number of deleted rows
426     * @throws RuntimeDaoException
427     */
428    public int deleteByIndexMac(java.util.Collection<String> indexs)throws RuntimeDaoException;
429
430    /**
431     * Deletes rows using the mac index.
432     *
433     * @param mac the mac column's value filter.
434     * @return the number of deleted objects
435     * @throws RuntimeDaoException
436     */
437    public int deleteByIndexMac(String mac)throws RuntimeDaoException;
438    
439
440    /**
441     * Retrieves an unique DeviceBean using the serial_no index.
442     * 
443     * @param serialNo the serial_no column's value filter
444     * @return an DeviceBean,otherwise null if not found or exists null in input arguments
445     * @throws RuntimeDaoException
446     */
447    public DeviceBean loadByIndexSerialNo(String serialNo)throws RuntimeDaoException;
448    /**
449     * Retrieves an unique DeviceBean using the serial_no index.
450     * 
451     * @param serialNo the serial_no column's value filter. must not be null
452     * @return an DeviceBean
453     * @throws NullPointerException exists null in input arguments
454     * @throws ObjectRetrievalException if not found
455     * @throws RuntimeDaoException
456     */
457    public DeviceBean loadByIndexSerialNoChecked(String serialNo)throws RuntimeDaoException,ObjectRetrievalException;
458    /**
459     * Retrieves an unique DeviceBean for each serial_no index.
460     *
461     * @param indexs index array
462     * @return an list of DeviceBean
463     * @throws RuntimeDaoException
464     */
465    public java.util.List<DeviceBean> loadByIndexSerialNo(String... indexs)throws RuntimeDaoException;
466    /**
467     * Retrieves an unique DeviceBean for each serial_no index.
468     *
469     * @param indexs index collection
470     * @return an list of DeviceBean
471     * @throws RuntimeDaoException
472     */
473    public java.util.List<DeviceBean> loadByIndexSerialNo(java.util.Collection<String> indexs)throws RuntimeDaoException;
474    /**
475     * Deletes rows for each serial_no index.
476     *
477     * @param indexs index array
478     * @return the number of deleted rows
479     * @throws RuntimeDaoException
480     */
481    public int deleteByIndexSerialNo(String... indexs)throws RuntimeDaoException;
482    /**
483     * Deletes rows for each serial_no index.
484     *
485     * @param indexs index collection
486     * @return the number of deleted rows
487     * @throws RuntimeDaoException
488     */
489    public int deleteByIndexSerialNo(java.util.Collection<String> indexs)throws RuntimeDaoException;
490
491    /**
492     * Deletes rows using the serial_no index.
493     *
494     * @param serialNo the serial_no column's value filter.
495     * @return the number of deleted objects
496     * @throws RuntimeDaoException
497     */
498    public int deleteByIndexSerialNo(String serialNo)throws RuntimeDaoException;
499    
500
501     /**
502     * Retrieves an array of DeviceBean using the group_id index.
503     *
504     * @param groupId the group_id column's value filter.
505     * @return an array of DeviceBean
506     * @throws RuntimeDaoException
507     */
508    public DeviceBean[] loadByIndexGroupId(Integer groupId)throws RuntimeDaoException;
509    
510    /**
511     * Retrieves a list of DeviceBean using the group_id index.
512     *
513     * @param groupId the group_id column's value filter.
514     * @return a list of DeviceBean
515     * @throws RuntimeDaoException
516     */
517    public java.util.List<DeviceBean> loadByIndexGroupIdAsList(Integer groupId)throws RuntimeDaoException;
518
519    /**
520     * Deletes rows using the group_id index.
521     *
522     * @param groupId the group_id column's value filter.
523     * @return the number of deleted objects
524     * @throws RuntimeDaoException
525     */
526    public int deleteByIndexGroupId(Integer groupId)throws RuntimeDaoException;
527    
528
529    //45
530    /**
531     * return a primary key list from {@link DeviceBean} array
532     * @param beans
533     * @return
534     */
535    public java.util.List<Integer> toPrimaryKeyList(DeviceBean... beans);
536    //46
537    /**
538     * return a primary key list from {@link DeviceBean} collection
539     * @param beans
540     * @return
541     */
542    public java.util.List<Integer> toPrimaryKeyList(java.util.Collection<DeviceBean> beans);
543
544}