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_image table.<br>
014 * Remarks: 图像信息存储表,用于存储系统中所有用到的图像数据,表中只包含图像基本信息,图像二进制源数据存在在fl_store中(md5对应)
015 * @author guyadong
016 */
017public interface IImageManager extends TableManager<ImageBean>
018{  
019    //////////////////////////////////////
020    // PRIMARY KEY METHODS
021    //////////////////////////////////////
022
023    //1
024    /**
025     * Loads a {@link ImageBean} from the fl_image using primary key fields.
026     *
027     * @param md5 String - PK# 1
028     * @return a unique ImageBean or {@code null} if not found
029     * @throws RuntimeDaoException
030     */
031    public ImageBean loadByPrimaryKey(String md5)throws RuntimeDaoException;
032
033    //1.1
034    /**
035     * Loads a {@link ImageBean} from the fl_image using primary key fields.
036     *
037     * @param md5 String - PK# 1
038     * @return a unique ImageBean
039     * @throws ObjectRetrievalException if not found
040     * @throws RuntimeDaoException
041     */
042    public ImageBean loadByPrimaryKeyChecked(String md5) throws RuntimeDaoException,ObjectRetrievalException;
043    
044    //1.4
045    /**
046     * Returns true if this fl_image contains row with primary key fields.
047     * @param md5 String - PK# 1
048     * @return
049     * @throws RuntimeDaoException
050     */
051    public boolean existsPrimaryKey(String md5)throws RuntimeDaoException;
052    //1.4.1
053    /**
054     * Check duplicated row by primary keys,if row exists throw exception
055     * @param md5 String
056     * @return 
057     * @throws RuntimeDaoException
058     * @throws ObjectRetrievalException
059     */
060    public String checkDuplicate(String md5)throws RuntimeDaoException,ObjectRetrievalException;
061    //1.8
062    /**
063     * Loads {@link ImageBean} from the fl_image using primary key fields.
064     *
065     * @param keys primary keys array
066     * @return list of ImageBean
067     * @throws RuntimeDaoException
068     */
069    public java.util.List<ImageBean> loadByPrimaryKey(String... keys)throws RuntimeDaoException;
070    //1.9
071    /**
072     * Loads {@link ImageBean} from the fl_image using primary key fields.
073     *
074     * @param keys primary keys collection
075     * @return list of ImageBean
076     * @throws RuntimeDaoException
077     */
078    public java.util.List<ImageBean> loadByPrimaryKey(java.util.Collection<String> 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 md5 String - PK# 1
085     * @return the number of deleted rows
086     * @throws RuntimeDaoException
087     */
088    public int deleteByPrimaryKey(String md5)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(String... 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<String> keys)throws RuntimeDaoException;
107    //2.4
108    /**
109     * Delete beans.<br>
110     *
111     * @param beans ImageBean collection wille be deleted
112     * @return the number of deleted rows
113     * @throws RuntimeDaoException
114     */
115    public int delete(ImageBean... beans)throws RuntimeDaoException;
116    //2.5
117    /**
118     * Delete beans.<br>
119     *
120     * @param beans ImageBean collection wille be deleted
121     * @return the number of deleted rows
122     * @throws RuntimeDaoException
123     */
124    public int delete(java.util.Collection<ImageBean> beans)throws RuntimeDaoException;
125 
126
127    //////////////////////////////////////
128    // GET/SET IMPORTED KEY BEAN METHOD
129    //////////////////////////////////////
130    //3.1 GET IMPORTED
131    /**
132     * Retrieves the {@link FaceBean} object from the fl_face.image_md5 field.<BR>
133     * FK_NAME : fl_face_ibfk_1 
134     * @param bean the {@link ImageBean}
135     * @return the associated {@link FaceBean} beans or {@code null} if {@code bean} is {@code null}
136     * @throws RuntimeDaoException
137     */
138    public FaceBean[] getFaceBeansByImageMd5(ImageBean bean)throws RuntimeDaoException;
139    
140    //3.1.2 GET IMPORTED
141    /**
142     * Retrieves the {@link FaceBean} object from the fl_face.image_md5 field.<BR>
143     * FK_NAME : fl_face_ibfk_1 
144     * @param md5OfImage String - PK# 1
145     * @return the associated {@link FaceBean} beans or {@code null} if {@code bean} is {@code null}
146     * @throws RuntimeDaoException
147     */
148    public FaceBean[] getFaceBeansByImageMd5(String md5OfImage)throws RuntimeDaoException;
149    
150    //3.2 GET IMPORTED
151    /**
152     * see also #getFaceBeansByImageMd5AsList(ImageBean,int,int)
153     * @param bean
154     * @return
155     * @throws RuntimeDaoException
156     */
157    public java.util.List<FaceBean> getFaceBeansByImageMd5AsList(ImageBean bean)throws RuntimeDaoException;
158
159    //3.2.2 GET IMPORTED
160    /**
161     * Retrieves the {@link FaceBean} object from fl_face.image_md5 field.<BR>
162     * FK_NAME:fl_face_ibfk_1
163     * @param md5OfImage String - PK# 1
164     * @return the associated {@link FaceBean} beans 
165     * @throws RuntimeDaoException
166     */
167    public java.util.List<FaceBean> getFaceBeansByImageMd5AsList(String md5OfImage)throws RuntimeDaoException;
168    //3.2.3 DELETE IMPORTED
169    /**
170     * delete the associated {@link FaceBean} objects from fl_face.image_md5 field.<BR>
171     * FK_NAME:fl_face_ibfk_1
172     * @param md5OfImage String - PK# 1
173     * @return the number of deleted rows
174     * @throws RuntimeDaoException
175     */
176    public int deleteFaceBeansByImageMd5(String md5OfImage)throws RuntimeDaoException;
177    //3.2.4 GET IMPORTED
178    /**
179     * Retrieves the {@link FaceBean} object from fl_face.image_md5 field.<BR>
180     * FK_NAME:fl_face_ibfk_1
181     * @param bean the {@link ImageBean}
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 FaceBean} beans or empty list if {@code bean} is {@code null}
185     * @throws RuntimeDaoException
186     */
187    public java.util.List<FaceBean> getFaceBeansByImageMd5AsList(ImageBean bean,int startRow,int numRows)throws RuntimeDaoException;    
188    //3.3 SET IMPORTED
189    /**
190     * set  the {@link FaceBean} object array associate to ImageBean by the fl_face.image_md5 field.<BR>
191     * FK_NAME : fl_face_ibfk_1 
192     * @param bean the referenced {@link ImageBean}
193     * @param importedBeans imported beans from fl_face
194     * @return importedBeans always
195     * @see IFaceManager#setReferencedByImageMd5(FaceBean, ImageBean)
196     * @throws RuntimeDaoException
197     */
198    public FaceBean[] setFaceBeansByImageMd5(ImageBean bean , FaceBean[] importedBeans)throws RuntimeDaoException;
199
200    //3.4 SET IMPORTED
201    /**
202     * set  the {@link FaceBean} object java.util.Collection associate to ImageBean by the fl_face.image_md5 field.<BR>
203     * FK_NAME:fl_face_ibfk_1
204     * @param bean the referenced {@link ImageBean} 
205     * @param importedBeans imported beans from fl_face 
206     * @return importedBeans always
207     * @see IFaceManager#setReferencedByImageMd5(FaceBean, ImageBean)
208     * @throws RuntimeDaoException
209     */
210    public <C extends java.util.Collection<FaceBean>> C setFaceBeansByImageMd5(ImageBean bean , C importedBeans)throws RuntimeDaoException;
211
212    //3.1 GET IMPORTED
213    /**
214     * Retrieves the {@link PersonBean} object from the fl_person.image_md5 field.<BR>
215     * FK_NAME : fl_person_ibfk_2 
216     * @param bean the {@link ImageBean}
217     * @return the associated {@link PersonBean} beans or {@code null} if {@code bean} is {@code null}
218     * @throws RuntimeDaoException
219     */
220    public PersonBean[] getPersonBeansByImageMd5(ImageBean bean)throws RuntimeDaoException;
221    
222    //3.1.2 GET IMPORTED
223    /**
224     * Retrieves the {@link PersonBean} object from the fl_person.image_md5 field.<BR>
225     * FK_NAME : fl_person_ibfk_2 
226     * @param md5OfImage String - PK# 1
227     * @return the associated {@link PersonBean} beans or {@code null} if {@code bean} is {@code null}
228     * @throws RuntimeDaoException
229     */
230    public PersonBean[] getPersonBeansByImageMd5(String md5OfImage)throws RuntimeDaoException;
231    
232    //3.2 GET IMPORTED
233    /**
234     * see also #getPersonBeansByImageMd5AsList(ImageBean,int,int)
235     * @param bean
236     * @return
237     * @throws RuntimeDaoException
238     */
239    public java.util.List<PersonBean> getPersonBeansByImageMd5AsList(ImageBean bean)throws RuntimeDaoException;
240
241    //3.2.2 GET IMPORTED
242    /**
243     * Retrieves the {@link PersonBean} object from fl_person.image_md5 field.<BR>
244     * FK_NAME:fl_person_ibfk_2
245     * @param md5OfImage String - PK# 1
246     * @return the associated {@link PersonBean} beans 
247     * @throws RuntimeDaoException
248     */
249    public java.util.List<PersonBean> getPersonBeansByImageMd5AsList(String md5OfImage)throws RuntimeDaoException;
250    //3.2.3 DELETE IMPORTED
251    /**
252     * delete the associated {@link PersonBean} objects from fl_person.image_md5 field.<BR>
253     * FK_NAME:fl_person_ibfk_2
254     * @param md5OfImage String - PK# 1
255     * @return the number of deleted rows
256     * @throws RuntimeDaoException
257     */
258    public int deletePersonBeansByImageMd5(String md5OfImage)throws RuntimeDaoException;
259    //3.2.4 GET IMPORTED
260    /**
261     * Retrieves the {@link PersonBean} object from fl_person.image_md5 field.<BR>
262     * FK_NAME:fl_person_ibfk_2
263     * @param bean the {@link ImageBean}
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 PersonBean} beans or empty list if {@code bean} is {@code null}
267     * @throws RuntimeDaoException
268     */
269    public java.util.List<PersonBean> getPersonBeansByImageMd5AsList(ImageBean bean,int startRow,int numRows)throws RuntimeDaoException;    
270    //3.3 SET IMPORTED
271    /**
272     * set  the {@link PersonBean} object array associate to ImageBean by the fl_person.image_md5 field.<BR>
273     * FK_NAME : fl_person_ibfk_2 
274     * @param bean the referenced {@link ImageBean}
275     * @param importedBeans imported beans from fl_person
276     * @return importedBeans always
277     * @see IPersonManager#setReferencedByImageMd5(PersonBean, ImageBean)
278     * @throws RuntimeDaoException
279     */
280    public PersonBean[] setPersonBeansByImageMd5(ImageBean bean , PersonBean[] importedBeans)throws RuntimeDaoException;
281
282    //3.4 SET IMPORTED
283    /**
284     * set  the {@link PersonBean} object java.util.Collection associate to ImageBean by the fl_person.image_md5 field.<BR>
285     * FK_NAME:fl_person_ibfk_2
286     * @param bean the referenced {@link ImageBean} 
287     * @param importedBeans imported beans from fl_person 
288     * @return importedBeans always
289     * @see IPersonManager#setReferencedByImageMd5(PersonBean, ImageBean)
290     * @throws RuntimeDaoException
291     */
292    public <C extends java.util.Collection<PersonBean>> C setPersonBeansByImageMd5(ImageBean bean , C importedBeans)throws RuntimeDaoException;
293
294    //3.5 SYNC SAVE 
295    /**
296     * Save the ImageBean bean and referenced beans and imported beans into the database.
297     *
298     * @param bean the {@link ImageBean} bean to be saved
299     * @param refDeviceByDeviceId the {@link DeviceBean} bean referenced by {@link ImageBean} 
300     * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
301     * @param impPersonByImageMd5 the {@link PersonBean} bean refer to {@link ImageBean} 
302     * @return the inserted or updated {@link ImageBean} bean
303     * @throws RuntimeDaoException
304     */
305    public ImageBean save(ImageBean bean
306        , DeviceBean refDeviceByDeviceId 
307        , FaceBean[] impFaceByImageMd5 , PersonBean[] impPersonByImageMd5 )throws RuntimeDaoException;
308    //3.6 SYNC SAVE AS TRANSACTION
309    /**
310     * Transaction version for sync save<br>
311     * see also {@link #save(ImageBean , DeviceBean , FaceBean[] , PersonBean[] )}
312     * @param bean the {@link ImageBean} bean to be saved
313     * @param refDeviceByDeviceId the {@link DeviceBean} bean referenced by {@link ImageBean} 
314     * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
315     * @param impPersonByImageMd5 the {@link PersonBean} bean refer to {@link ImageBean} 
316     * @return the inserted or updated {@link ImageBean} bean
317     * @throws RuntimeDaoException
318     */
319    public ImageBean saveAsTransaction(final ImageBean bean
320        ,final DeviceBean refDeviceByDeviceId 
321        ,final FaceBean[] impFaceByImageMd5 ,final PersonBean[] impPersonByImageMd5 )throws RuntimeDaoException;
322    //3.7 SYNC SAVE 
323    /**
324     * Save the ImageBean bean and referenced beans and imported beans into the database.
325     *
326     * @param bean the {@link ImageBean} bean to be saved
327     * @param refDeviceByDeviceId the {@link DeviceBean} bean referenced by {@link ImageBean} 
328     * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
329     * @param impPersonByImageMd5 the {@link PersonBean} bean refer to {@link ImageBean} 
330     * @return the inserted or updated {@link ImageBean} bean
331     * @throws RuntimeDaoException
332     */
333    public ImageBean save(ImageBean bean
334        , DeviceBean refDeviceByDeviceId 
335        , java.util.Collection<FaceBean> impFaceByImageMd5 , java.util.Collection<PersonBean> impPersonByImageMd5 )throws RuntimeDaoException;
336    //3.8 SYNC SAVE AS TRANSACTION
337    /**
338     * Transaction version for sync save<br>
339     * see also {@link #save(ImageBean , DeviceBean , java.util.Collection , java.util.Collection )}
340     * @param bean the {@link ImageBean} bean to be saved
341     * @param refDeviceByDeviceId the {@link DeviceBean} bean referenced by {@link ImageBean} 
342     * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
343     * @param impPersonByImageMd5 the {@link PersonBean} bean refer to {@link ImageBean} 
344     * @return the inserted or updated {@link ImageBean} bean
345     * @throws RuntimeDaoException
346     */
347    public ImageBean saveAsTransaction(final ImageBean bean
348        ,final DeviceBean refDeviceByDeviceId 
349        ,final  java.util.Collection<FaceBean> impFaceByImageMd5 ,final  java.util.Collection<PersonBean> impPersonByImageMd5 )throws RuntimeDaoException;
350      //////////////////////////////////////
351    // GET/SET FOREIGN KEY BEAN METHOD
352    //////////////////////////////////////
353    //5.1 GET REFERENCED VALUE
354    /**
355     * Retrieves the {@link DeviceBean} object referenced by {@link ImageBean#getDeviceId}() field.<br>
356     * FK_NAME : fl_image_ibfk_1
357     * @param bean the {@link ImageBean}
358     * @return the associated {@link DeviceBean} bean or {@code null} if {@code bean} is {@code null}
359     * @throws RuntimeDaoException
360     */
361    public DeviceBean getReferencedByDeviceId(ImageBean bean)throws RuntimeDaoException;
362
363    //5.2 SET REFERENCED 
364    /**
365     * Associates the {@link ImageBean} object to the {@link DeviceBean} object by {@link ImageBean#getDeviceId}() field.
366     *
367     * @param bean the {@link ImageBean} object to use
368     * @param beanToSet the {@link DeviceBean} object to associate to the {@link ImageBean}
369     * @return always beanToSet saved
370     * @throws RuntimeDaoException
371     */
372    public DeviceBean setReferencedByDeviceId(ImageBean bean, DeviceBean beanToSet)throws RuntimeDaoException;
373    //_____________________________________________________________________
374    //
375    // USING INDICES
376    //_____________________________________________________________________
377
378
379     /**
380     * Retrieves an array of ImageBean using the device_id index.
381     *
382     * @param deviceId the device_id column's value filter.
383     * @return an array of ImageBean
384     * @throws RuntimeDaoException
385     */
386    public ImageBean[] loadByIndexDeviceId(Integer deviceId)throws RuntimeDaoException;
387    
388    /**
389     * Retrieves a list of ImageBean using the device_id index.
390     *
391     * @param deviceId the device_id column's value filter.
392     * @return a list of ImageBean
393     * @throws RuntimeDaoException
394     */
395    public java.util.List<ImageBean> loadByIndexDeviceIdAsList(Integer deviceId)throws RuntimeDaoException;
396
397    /**
398     * Deletes rows using the device_id index.
399     *
400     * @param deviceId the device_id column's value filter.
401     * @return the number of deleted objects
402     * @throws RuntimeDaoException
403     */
404    public int deleteByIndexDeviceId(Integer deviceId)throws RuntimeDaoException;
405    
406
407    //45
408    /**
409     * return a primary key list from {@link ImageBean} array
410     * @param beans
411     * @return
412     */
413    public java.util.List<String> toPrimaryKeyList(ImageBean... beans);
414    //46
415    /**
416     * return a primary key list from {@link ImageBean} collection
417     * @param beans
418     * @return
419     */
420    public java.util.List<String> toPrimaryKeyList(java.util.Collection<ImageBean> beans);
421
422}