001// ______________________________________________________
002// Generated by sql2java - https://github.com/10km/sql2java 
003// JDBC driver used at code generation time: com.mysql.jdbc.Driver
004// template: manager.interface.java.vm
005// ______________________________________________________
006package net.gdface.facedb.db;
007import gu.sql2java.TableManager;
008import gu.sql2java.exception.ObjectRetrievalException;
009import gu.sql2java.exception.RuntimeDaoException;
010
011/**
012 * Interface to handle database calls (save, load, count, etc...) for the fd_image table.<br>
013 * Remarks: 图像信息存储表,用于存储系统中所有用到的图像数据,表中只包含图像基本信息,图像二进制源数据存在在fd_store中(md5对应)
014 * @author guyadong
015 */
016public interface IImageManager extends TableManager<ImageBean>
017{  
018    //////////////////////////////////////
019    // PRIMARY KEY METHODS
020    //////////////////////////////////////
021
022    //1
023    /**
024     * Loads a {@link ImageBean} from the fd_image using primary key fields.
025     *
026     * @param md5 String - PK# 1
027     * @return a unique ImageBean or {@code null} if not found
028     * @throws RuntimeDaoException
029     */
030    public ImageBean loadByPrimaryKey(String md5)throws RuntimeDaoException;
031
032    //1.1
033    /**
034     * Loads a {@link ImageBean} from the fd_image using primary key fields.
035     *
036     * @param md5 String - PK# 1
037     * @return a unique ImageBean
038     * @throws ObjectRetrievalException if not found
039     * @throws RuntimeDaoException
040     */
041    public ImageBean loadByPrimaryKeyChecked(String md5) throws RuntimeDaoException,ObjectRetrievalException;
042    
043    //1.4
044    /**
045     * check if contains row with primary key fields.
046     * @param md5 String - PK# 1
047     * @return true if this fd_image contains row with primary key fields.
048     * @throws RuntimeDaoException
049     */
050    public boolean existsPrimaryKey(String md5)throws RuntimeDaoException;
051    //1.4.1
052    /**
053     * Check duplicated row by primary keys,if row exists throw exception
054     * @param md5 primary keys
055     * @return md5
056     * @throws RuntimeDaoException
057     * @throws ObjectRetrievalException
058     */
059    public String checkDuplicate(String md5)throws RuntimeDaoException,ObjectRetrievalException;
060    //1.8
061    /**
062     * Loads {@link ImageBean} from the fd_image using primary key fields.
063     *
064     * @param keys primary keys array
065     * @return list of ImageBean
066     * @throws RuntimeDaoException
067     */
068    public java.util.List<ImageBean> loadByPrimaryKey(String... keys)throws RuntimeDaoException;
069    //1.9
070    /**
071     * Loads {@link ImageBean} from the fd_image using primary key fields.
072     *
073     * @param keys primary keys collection
074     * @return list of ImageBean
075     * @throws RuntimeDaoException
076     */
077    public java.util.List<ImageBean> loadByPrimaryKey(java.util.Collection<String> keys)throws RuntimeDaoException;
078    //2
079    /**
080     * Delete row according to its primary keys.<br>
081     * all keys must not be null
082     *
083     * @param md5 String - PK# 1
084     * @return the number of deleted rows
085     * @throws RuntimeDaoException
086     */
087    public int deleteByPrimaryKey(String md5)throws RuntimeDaoException;
088    //2.2
089    /**
090     * Delete rows according to primary key.<br>
091     *
092     * @param keys primary keys array
093     * @return the number of deleted rows
094     * @throws RuntimeDaoException
095     * @see #delete(gu.sql2java.BaseBean)
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     * @see #delete(gu.sql2java.BaseBean)
106     */
107    public int deleteByPrimaryKey(java.util.Collection<String> keys)throws RuntimeDaoException;
108 
109
110    //////////////////////////////////////
111    // GET/SET IMPORTED KEY BEAN METHOD
112    //////////////////////////////////////
113    //3.1 GET IMPORTED
114    /**
115     * Retrieves the {@link FaceBean} object from the fd_face.image_md5 field.<BR>
116     * FK_NAME : fd_face_ibfk_1 
117     * @param bean the {@link ImageBean}
118     * @return the associated {@link FaceBean} beans or {@code null} if {@code bean} is {@code null}
119     * @throws RuntimeDaoException
120     */
121    public FaceBean[] getFaceBeansByImageMd5(ImageBean bean)throws RuntimeDaoException;
122    
123    //3.1.2 GET IMPORTED
124    /**
125     * Retrieves the {@link FaceBean} object from the fd_face.image_md5 field.<BR>
126     * FK_NAME : fd_face_ibfk_1 
127     * @param md5OfImage String - PK# 1
128     * @return the associated {@link FaceBean} beans or {@code null} if {@code bean} is {@code null}
129     * @throws RuntimeDaoException
130     */
131    public FaceBean[] getFaceBeansByImageMd5(String md5OfImage)throws RuntimeDaoException;
132    
133    //3.2 GET IMPORTED
134    /**
135     * see also #getFaceBeansByImageMd5AsList(ImageBean,int,int)
136     * @param bean
137     * @return import bean list
138     * @throws RuntimeDaoException
139     */
140    public java.util.List<FaceBean> getFaceBeansByImageMd5AsList(ImageBean bean)throws RuntimeDaoException;
141
142    //3.2.2 GET IMPORTED
143    /**
144     * Retrieves the {@link FaceBean} object from fd_face.image_md5 field.<BR>
145     * FK_NAME:fd_face_ibfk_1
146     * @param md5OfImage String - PK# 1
147     * @return the associated {@link FaceBean} beans 
148     * @throws RuntimeDaoException
149     */
150    public java.util.List<FaceBean> getFaceBeansByImageMd5AsList(String md5OfImage)throws RuntimeDaoException;
151    //3.2.3 DELETE IMPORTED
152    /**
153     * delete the associated {@link FaceBean} objects from fd_face.image_md5 field.<BR>
154     * FK_NAME:fd_face_ibfk_1
155     * @param md5OfImage String - PK# 1
156     * @return the number of deleted rows
157     * @throws RuntimeDaoException
158     */
159    public int deleteFaceBeansByImageMd5(String md5OfImage)throws RuntimeDaoException;
160    //3.2.4 GET IMPORTED
161    /**
162     * Retrieves the {@link FaceBean} object from fd_face.image_md5 field.<BR>
163     * FK_NAME:fd_face_ibfk_1
164     * @param bean the {@link ImageBean}
165     * @param startRow the start row to be used (first row = 1, last row=-1)
166     * @param numRows the number of rows to be retrieved (all rows = a negative number)
167     * @return the associated {@link FaceBean} beans or empty list if {@code bean} is {@code null}
168     * @throws RuntimeDaoException
169     */
170    public java.util.List<FaceBean> getFaceBeansByImageMd5AsList(ImageBean bean,int startRow,int numRows)throws RuntimeDaoException;    
171    //3.3 SET IMPORTED
172    /**
173     * set  the {@link FaceBean} object array associate to ImageBean by the fd_face.image_md5 field.<BR>
174     * FK_NAME : fd_face_ibfk_1 
175     * @param bean the referenced {@link ImageBean}
176     * @param importedBeans imported beans from fd_face
177     * @return importedBeans always
178     * @see IFaceManager#setReferencedByImageMd5(FaceBean, ImageBean)
179     * @throws RuntimeDaoException
180     */
181    public FaceBean[] setFaceBeansByImageMd5(ImageBean bean , FaceBean[] importedBeans)throws RuntimeDaoException;
182
183    //3.4 SET IMPORTED
184    /**
185     * set  the {@link FaceBean} object java.util.Collection associate to ImageBean by the fd_face.image_md5 field.<BR>
186     * FK_NAME:fd_face_ibfk_1
187     * @param bean the referenced {@link ImageBean} 
188     * @param importedBeans imported beans from fd_face 
189     * @return importedBeans always
190     * @see IFaceManager#setReferencedByImageMd5(FaceBean, ImageBean)
191     * @throws RuntimeDaoException
192     */
193    public <C extends java.util.Collection<FaceBean>> C setFaceBeansByImageMd5(ImageBean bean , C importedBeans)throws RuntimeDaoException;
194
195    //3.5 SYNC SAVE 
196    /**
197     * Save the ImageBean bean and referenced beans and imported beans into the database.
198     *
199     * @param bean the {@link ImageBean} bean to be saved
200         * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
201     * @return the inserted or updated {@link ImageBean} bean
202     * @throws RuntimeDaoException
203     */
204    public ImageBean save(ImageBean bean
205        
206        , FaceBean[] impFaceByImageMd5 )throws RuntimeDaoException;
207    //3.6 SYNC SAVE AS TRANSACTION
208    /**
209     * Transaction version for sync save<br>
210     * see also {@link #save(ImageBean , FaceBean[] )}
211     * @param bean the {@link ImageBean} bean to be saved
212         * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
213     * @return the inserted or updated {@link ImageBean} bean
214     * @throws RuntimeDaoException
215     */
216    public ImageBean saveAsTransaction(final ImageBean bean
217        
218        ,final FaceBean[] impFaceByImageMd5 )throws RuntimeDaoException;
219    //3.7 SYNC SAVE 
220    /**
221     * Save the ImageBean bean and referenced beans and imported beans into the database.
222     *
223     * @param bean the {@link ImageBean} bean to be saved
224         * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
225     * @return the inserted or updated {@link ImageBean} bean
226     * @throws RuntimeDaoException
227     */
228    public ImageBean save(ImageBean bean
229        
230        , java.util.Collection<FaceBean> impFaceByImageMd5 )throws RuntimeDaoException;
231    //3.8 SYNC SAVE AS TRANSACTION
232    /**
233     * Transaction version for sync save<br>
234     * see also {@link #save(ImageBean , java.util.Collection )}
235     * @param bean the {@link ImageBean} bean to be saved
236         * @param impFaceByImageMd5 the {@link FaceBean} bean refer to {@link ImageBean} 
237     * @return the inserted or updated {@link ImageBean} bean
238     * @throws RuntimeDaoException
239     */
240    public ImageBean saveAsTransaction(final ImageBean bean
241        
242        ,final  java.util.Collection<FaceBean> impFaceByImageMd5 )throws RuntimeDaoException;
243  
244    //45
245    /**
246     * return a primary key list from {@link ImageBean} array
247     * @param beans
248     * @return primary key list
249     */
250    public java.util.List<String> toPrimaryKeyList(ImageBean... beans);
251    //46
252    /**
253     * return a primary key list from {@link ImageBean} collection
254     * @param beans
255     * @return primary key list
256     */
257    public java.util.List<String> toPrimaryKeyList(java.util.Collection<ImageBean> beans);
258
259}