OSDN Git Service

DBFluteのClassificationに対応
[ea2ddl/ea2ddl.git] / ea2ddl-dao / src / main / java / jp / sourceforge / ea2ddl / dao / bsbhv / BsTObjectBhv.java
1 package jp.sourceforge.ea2ddl.dao.bsbhv;
2
3
4 import java.util.List;
5
6 import jp.sourceforge.ea2ddl.dao.allcommon.*;
7 import jp.sourceforge.ea2ddl.dao.allcommon.bhv.load.LoadReferrerOption;
8 import jp.sourceforge.ea2ddl.dao.allcommon.bhv.setup.ConditionBeanSetupper;
9 import jp.sourceforge.ea2ddl.dao.allcommon.bhv.setup.ValueLabelSetupper;
10 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.ConditionBean;
11 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.ListResultBean;
12 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.ResultBeanBuilder;
13 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingHandler;
14 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingInvoker;
15 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingBean;
16 import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingResultBean;
17 import jp.sourceforge.ea2ddl.dao.allcommon.dbmeta.DBMeta;
18 import jp.sourceforge.ea2ddl.dao.exbhv.*;
19 import jp.sourceforge.ea2ddl.dao.exdao.*;
20 import jp.sourceforge.ea2ddl.dao.exentity.*;
21 import jp.sourceforge.ea2ddl.dao.bsentity.dbmeta.*;
22 import jp.sourceforge.ea2ddl.dao.cbean.*;
23
24
25 /**
26  * The behavior of t_object.
27  * <pre>
28  * [primary-key]
29  *     Object_ID
30  * 
31  * [column]
32  *     Object_ID, Object_Type, Diagram_ID, Name, Alias, Author, Version, Note, Package_ID, Stereotype, NType, Complexity, Effort, Style, Backcolor, BorderStyle, BorderWidth, Fontcolor, Bordercolor, CreatedDate, ModifiedDate, Status, Tagged, PDATA1, PDATA2, PDATA3, PDATA4, PDATA5, Concurrency, Visibility, Persistence, Cardinality, GenType, GenFile, Header1, Header2, Phase, Scope, GenOption, GenLinks, Classifier, ea_guid, ParentID, RunState, Classifier_guid, TPos, IsRoot, IsLeaf, IsSpec, IsActive, StateFlags, PackageFlags, Multiplicity, StyleEx, ActionFlags, EventFlags
33  * 
34  * [sequence]
35  *     
36  * 
37  * [identity]
38  *     
39  * 
40  * [version-no]
41  *     
42  * 
43  * [foreign-table]
44  *     
45  * 
46  * [referrer-table]
47  *     t_objectproperties, t_attribute, t_operation, t_connector
48  * 
49  * [foreign-property]
50  *     
51  * 
52  * [referrer-property]
53  *     tObjectpropertiesList, tAttributeList, tOperationList, tConnectorByStartObjectIdList, tConnectorByEndObjectIdList
54  * </pre>
55  * @author DBFlute(AutoGenerator)
56  */
57 public abstract class BsTObjectBhv extends jp.sourceforge.ea2ddl.dao.allcommon.bhv.AbstractBehaviorWritable {
58
59     // ===================================================================================
60     //                                                                          Definition
61     //                                                                          ==========
62     /*df:BehaviorQueryPathBegin*/
63     public static final String PATH_selectList = "selectList";
64     public static final String PATH_selectTableById = "selectTableById";
65     /*df:BehaviorQueryPathEnd*/
66
67     // ===================================================================================
68     //                                                                           Attribute
69     //                                                                           =========
70     protected TObjectDao _dao;
71
72     // ===================================================================================
73     //                                                                          Table name
74     //                                                                          ==========
75     /** @return The name on database of table. (NotNull) */
76     public String getTableDbName() { return "t_object"; }
77
78     // ===================================================================================
79     //                                                                              DBMeta
80     //                                                                              ======
81     /** @return The meta data of the database. (NotNull) */
82     public DBMeta getDBMeta() { return TObjectDbm.getInstance(); }
83
84     /** @return The meta data of the database as my table type. (NotNull) */
85     public TObjectDbm getMyDBMeta() { return TObjectDbm.getInstance(); }
86
87     // ===================================================================================
88     //                                                                        Dao Accessor
89     //                                                                        ============
90     public TObjectDao getMyDao() { return _dao; }
91     public void setMyDao(TObjectDao dao) { assertObjectNotNull("dao", dao); _dao = dao; }
92     public DaoReadable getDaoReadable() { return getMyDao(); }
93     public DaoWritable getDaoWritable() { return getMyDao(); }
94
95     // ===================================================================================
96     //                                                                        New Instance
97     //                                                                        ============
98     public Entity newEntity() { return newMyEntity(); }
99     public ConditionBean newConditionBean() { return newMyConditionBean(); }
100     public TObject newMyEntity() { return new TObject(); }
101     public TObjectCB newMyConditionBean() { return new TObjectCB(); }
102
103     // ===================================================================================
104     //                                                                        Count Select
105     //                                                                        ============
106     /**
107      * Select the count of the condition-bean. {IgnorePagingCondition}
108      * @param cb The condition-bean of TObject. (NotNull)
109      * @return The selected count.
110      */
111     public int selectCount(TObjectCB cb) {
112         assertConditionBeanNotNull(cb);
113         return delegateSelectCount(cb);
114     }
115
116     // ===================================================================================
117     //                                                                       Entity Select
118     //                                                                       =============
119     /**
120      * Select the entity by the condition-bean.
121      * @param cb The condition-bean of TObject. (NotNull)
122      * @return The selected entity. (Nullalble)
123      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.
124      */
125     public TObject selectEntity(final TObjectCB cb) {
126         return helpSelectEntityInternally(cb, new InternalSelectEntityCallback<TObject, TObjectCB>() {
127             public List<TObject> callbackSelectList(TObjectCB cb) { return selectList(cb); } });
128     }
129
130     /**
131      * Select the entity by the condition-bean with deleted check.
132      * @param cb The condition-bean of TObject. (NotNull)
133      * @return The selected entity. (NotNull)
134      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
135      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.
136      */
137     public TObject selectEntityWithDeletedCheck(final TObjectCB cb) {
138         return helpSelectEntityWithDeletedCheckInternally(cb, new InternalSelectEntityWithDeletedCheckCallback<TObject, TObjectCB>() {
139             public List<TObject> callbackSelectList(TObjectCB cb) { return selectList(cb); } });
140     }
141
142     /* (non-javadoc)
143      * Select the entity with deleted check. {by primary-key value}
144      * @param primaryKey The keys of primary.
145      * @return The selected entity. (NotNull)
146      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
147      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.
148      */
149     public TObject selectByPKValueWithDeletedCheck(java.lang.Integer objectId) {
150         TObject entity = new TObject();
151         entity.setObjectId(objectId);
152         final TObjectCB cb = newMyConditionBean();
153         cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(entity));
154         return selectEntityWithDeletedCheck(cb);
155     }
156
157     // ===================================================================================
158     //                                                                         List Select
159     //                                                                         ===========
160     /**
161      * Select the list as result bean.
162      * @param cb The condition-bean of TObject. (NotNull)
163      * @return The result bean of selected list. (NotNull)
164      */
165     public ListResultBean<TObject> selectList(TObjectCB cb) {
166         assertConditionBeanNotNull(cb);
167         return new ResultBeanBuilder<TObject>(getTableDbName()).buildListResultBean(cb, delegateSelectList(cb));
168     }
169
170     // ===================================================================================
171     //                                                                         Page Select
172     //                                                                         ===========
173     /**
174      * Select the page as result bean.
175      * @param cb The condition-bean of TObject. (NotNull)
176      * @return The result bean of selected page. (NotNull)
177      */
178     public PagingResultBean<TObject> selectPage(final TObjectCB cb) {
179         assertConditionBeanNotNull(cb);
180         final PagingInvoker<TObject> invoker = new PagingInvoker<TObject>(getTableDbName());
181         final PagingHandler<TObject> handler = new PagingHandler<TObject>() {
182             public PagingBean getPagingBean() { return cb; }
183             public int count() { return selectCount(cb); }
184             public List<TObject> paging() { return selectList(cb); }
185         };
186         return invoker.invokePaging(handler);
187     }
188
189     // ===================================================================================
190     //                                                                      Various Select
191     //                                                                      ==============
192     /**
193      * Select the list of value-label.
194      * @param cb The condition-bean of TObject. (NotNull)
195      * @param valueLabelSetupper The setupper of value-label. (NotNull)
196      * @return The list of value-label. (NotNull)
197      */
198     public List<java.util.Map<String, Object>> selectValueLabelList(TObjectCB cb, ValueLabelSetupper<TObject> valueLabelSetupper) {
199         return createValueLabelList(selectList(cb), valueLabelSetupper);
200     }
201
202
203     // ===================================================================================
204     //                                                                       Load Referrer
205     //                                                                       =============
206     /**
207      * Load referrer of TObjectpropertiesList with the setupper for condition-bean of referrer. <br />
208      * About internal policy, the value of primary key(and others too) is treated as case-insensitive. <br />
209      * The condition-bean that the setupper provides have settings before you touch it. It is as follows:
210      * <pre>
211      * cb.query().setObjectId_InScope(pkList);
212      * cb.query().addOrderBy_ObjectId_Asc();
213      * </pre>
214      * @param tObjectList The entity list of TObject. (NotNull)
215      * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
216      */
217     public void loadTObjectpropertiesList(List<TObject> tObjectList, ConditionBeanSetupper<TObjectpropertiesCB> conditionBeanSetupper) {
218         assertObjectNotNull("tObjectList<TObject>", tObjectList);
219         assertObjectNotNull("conditionBeanSetupper<TObjectpropertiesCB>", conditionBeanSetupper);
220         if (tObjectList.isEmpty()) { return; }
221         loadTObjectpropertiesList(tObjectList, new LoadReferrerOption<TObjectpropertiesCB, TObjectproperties>(conditionBeanSetupper));
222     }
223     /**
224      * {Refer to overload method that has an argument of condition-bean setupper.}
225      * @param tObjectList The entity list of TObject. (NotNull)
226      * @param loadReferrerOption The option of load-referrer. (NotNull)
227      */
228     public void loadTObjectpropertiesList(List<TObject> tObjectList, LoadReferrerOption<TObjectpropertiesCB, TObjectproperties> loadReferrerOption) {
229         assertObjectNotNull("tObjectList<TObject>", tObjectList);
230         assertObjectNotNull("loadReferrerOption<TObjectproperties, TObjectpropertiesCB>", loadReferrerOption);
231         if (tObjectList.isEmpty()) { return; }
232         final TObjectpropertiesBhv referrerBhv = xgetBSFLR().select(TObjectpropertiesBhv.class);
233         helpLoadReferrerInternally(tObjectList, loadReferrerOption, new InternalLoadReferrerCallback<TObject, java.lang.Integer, TObjectpropertiesCB, TObjectproperties>() {
234             public java.lang.Integer callbackBase_getPrimaryKeyValue(TObject entity) { return entity.getObjectId(); }
235             public void callbackBase_setReferrerList(TObject entity, List<TObjectproperties> referrerList) { entity.setTObjectpropertiesList(referrerList); }
236             public TObjectpropertiesCB callbackReferrer_newMyConditionBean() { return referrerBhv.newMyConditionBean(); }
237             public void callbackReferrer_queryForeignKeyInScope(TObjectpropertiesCB cb, List<java.lang.Integer> pkList) { cb.query().setObjectId_InScope(pkList); }
238             public void callbackReferrer_queryAddOrderByForeignKeyAsc(TObjectpropertiesCB cb) { cb.query().addOrderBy_ObjectId_Asc(); }
239             public List<TObjectproperties> callbackReferrer_selectList(TObjectpropertiesCB cb) { return referrerBhv.selectList(cb); }
240             public java.lang.Integer callbackReferrer_getForeignKeyValue(TObjectproperties entity) { return entity.getObjectId(); }
241             public void callbackReferrer_setForeignEntity(TObjectproperties referrerEntity, TObject baseEntity) { referrerEntity.setTObject(baseEntity); }
242         } );
243     }
244     /**
245      * Load referrer of TAttributeList with the setupper for condition-bean of referrer. <br />
246      * About internal policy, the value of primary key(and others too) is treated as case-insensitive. <br />
247      * The condition-bean that the setupper provides have settings before you touch it. It is as follows:
248      * <pre>
249      * cb.query().setObjectId_InScope(pkList);
250      * cb.query().addOrderBy_ObjectId_Asc();
251      * </pre>
252      * @param tObjectList The entity list of TObject. (NotNull)
253      * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
254      */
255     public void loadTAttributeList(List<TObject> tObjectList, ConditionBeanSetupper<TAttributeCB> conditionBeanSetupper) {
256         assertObjectNotNull("tObjectList<TObject>", tObjectList);
257         assertObjectNotNull("conditionBeanSetupper<TAttributeCB>", conditionBeanSetupper);
258         if (tObjectList.isEmpty()) { return; }
259         loadTAttributeList(tObjectList, new LoadReferrerOption<TAttributeCB, TAttribute>(conditionBeanSetupper));
260     }
261     /**
262      * {Refer to overload method that has an argument of condition-bean setupper.}
263      * @param tObjectList The entity list of TObject. (NotNull)
264      * @param loadReferrerOption The option of load-referrer. (NotNull)
265      */
266     public void loadTAttributeList(List<TObject> tObjectList, LoadReferrerOption<TAttributeCB, TAttribute> loadReferrerOption) {
267         assertObjectNotNull("tObjectList<TObject>", tObjectList);
268         assertObjectNotNull("loadReferrerOption<TAttribute, TAttributeCB>", loadReferrerOption);
269         if (tObjectList.isEmpty()) { return; }
270         final TAttributeBhv referrerBhv = xgetBSFLR().select(TAttributeBhv.class);
271         helpLoadReferrerInternally(tObjectList, loadReferrerOption, new InternalLoadReferrerCallback<TObject, java.lang.Integer, TAttributeCB, TAttribute>() {
272             public java.lang.Integer callbackBase_getPrimaryKeyValue(TObject entity) { return entity.getObjectId(); }
273             public void callbackBase_setReferrerList(TObject entity, List<TAttribute> referrerList) { entity.setTAttributeList(referrerList); }
274             public TAttributeCB callbackReferrer_newMyConditionBean() { return referrerBhv.newMyConditionBean(); }
275             public void callbackReferrer_queryForeignKeyInScope(TAttributeCB cb, List<java.lang.Integer> pkList) { cb.query().setObjectId_InScope(pkList); }
276             public void callbackReferrer_queryAddOrderByForeignKeyAsc(TAttributeCB cb) { cb.query().addOrderBy_ObjectId_Asc(); }
277             public List<TAttribute> callbackReferrer_selectList(TAttributeCB cb) { return referrerBhv.selectList(cb); }
278             public java.lang.Integer callbackReferrer_getForeignKeyValue(TAttribute entity) { return entity.getObjectId(); }
279             public void callbackReferrer_setForeignEntity(TAttribute referrerEntity, TObject baseEntity) { referrerEntity.setTObject(baseEntity); }
280         } );
281     }
282     /**
283      * Load referrer of TOperationList with the setupper for condition-bean of referrer. <br />
284      * About internal policy, the value of primary key(and others too) is treated as case-insensitive. <br />
285      * The condition-bean that the setupper provides have settings before you touch it. It is as follows:
286      * <pre>
287      * cb.query().setObjectId_InScope(pkList);
288      * cb.query().addOrderBy_ObjectId_Asc();
289      * </pre>
290      * @param tObjectList The entity list of TObject. (NotNull)
291      * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
292      */
293     public void loadTOperationList(List<TObject> tObjectList, ConditionBeanSetupper<TOperationCB> conditionBeanSetupper) {
294         assertObjectNotNull("tObjectList<TObject>", tObjectList);
295         assertObjectNotNull("conditionBeanSetupper<TOperationCB>", conditionBeanSetupper);
296         if (tObjectList.isEmpty()) { return; }
297         loadTOperationList(tObjectList, new LoadReferrerOption<TOperationCB, TOperation>(conditionBeanSetupper));
298     }
299     /**
300      * {Refer to overload method that has an argument of condition-bean setupper.}
301      * @param tObjectList The entity list of TObject. (NotNull)
302      * @param loadReferrerOption The option of load-referrer. (NotNull)
303      */
304     public void loadTOperationList(List<TObject> tObjectList, LoadReferrerOption<TOperationCB, TOperation> loadReferrerOption) {
305         assertObjectNotNull("tObjectList<TObject>", tObjectList);
306         assertObjectNotNull("loadReferrerOption<TOperation, TOperationCB>", loadReferrerOption);
307         if (tObjectList.isEmpty()) { return; }
308         final TOperationBhv referrerBhv = xgetBSFLR().select(TOperationBhv.class);
309         helpLoadReferrerInternally(tObjectList, loadReferrerOption, new InternalLoadReferrerCallback<TObject, java.lang.Integer, TOperationCB, TOperation>() {
310             public java.lang.Integer callbackBase_getPrimaryKeyValue(TObject entity) { return entity.getObjectId(); }
311             public void callbackBase_setReferrerList(TObject entity, List<TOperation> referrerList) { entity.setTOperationList(referrerList); }
312             public TOperationCB callbackReferrer_newMyConditionBean() { return referrerBhv.newMyConditionBean(); }
313             public void callbackReferrer_queryForeignKeyInScope(TOperationCB cb, List<java.lang.Integer> pkList) { cb.query().setObjectId_InScope(pkList); }
314             public void callbackReferrer_queryAddOrderByForeignKeyAsc(TOperationCB cb) { cb.query().addOrderBy_ObjectId_Asc(); }
315             public List<TOperation> callbackReferrer_selectList(TOperationCB cb) { return referrerBhv.selectList(cb); }
316             public java.lang.Integer callbackReferrer_getForeignKeyValue(TOperation entity) { return entity.getObjectId(); }
317             public void callbackReferrer_setForeignEntity(TOperation referrerEntity, TObject baseEntity) { referrerEntity.setTObject(baseEntity); }
318         } );
319     }
320     /**
321      * Load referrer of TConnectorByStartObjectIdList with the setupper for condition-bean of referrer. <br />
322      * About internal policy, the value of primary key(and others too) is treated as case-insensitive. <br />
323      * The condition-bean that the setupper provides have settings before you touch it. It is as follows:
324      * <pre>
325      * cb.query().setStartObjectId_InScope(pkList);
326      * cb.query().addOrderBy_StartObjectId_Asc();
327      * </pre>
328      * @param tObjectList The entity list of TObject. (NotNull)
329      * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
330      */
331     public void loadTConnectorByStartObjectIdList(List<TObject> tObjectList, ConditionBeanSetupper<TConnectorCB> conditionBeanSetupper) {
332         assertObjectNotNull("tObjectList<TObject>", tObjectList);
333         assertObjectNotNull("conditionBeanSetupper<TConnectorCB>", conditionBeanSetupper);
334         if (tObjectList.isEmpty()) { return; }
335         loadTConnectorByStartObjectIdList(tObjectList, new LoadReferrerOption<TConnectorCB, TConnector>(conditionBeanSetupper));
336     }
337     /**
338      * {Refer to overload method that has an argument of condition-bean setupper.}
339      * @param tObjectList The entity list of TObject. (NotNull)
340      * @param loadReferrerOption The option of load-referrer. (NotNull)
341      */
342     public void loadTConnectorByStartObjectIdList(List<TObject> tObjectList, LoadReferrerOption<TConnectorCB, TConnector> loadReferrerOption) {
343         assertObjectNotNull("tObjectList<TObject>", tObjectList);
344         assertObjectNotNull("loadReferrerOption<TConnector, TConnectorCB>", loadReferrerOption);
345         if (tObjectList.isEmpty()) { return; }
346         final TConnectorBhv referrerBhv = xgetBSFLR().select(TConnectorBhv.class);
347         helpLoadReferrerInternally(tObjectList, loadReferrerOption, new InternalLoadReferrerCallback<TObject, java.lang.Integer, TConnectorCB, TConnector>() {
348             public java.lang.Integer callbackBase_getPrimaryKeyValue(TObject entity) { return entity.getObjectId(); }
349             public void callbackBase_setReferrerList(TObject entity, List<TConnector> referrerList) { entity.setTConnectorByStartObjectIdList(referrerList); }
350             public TConnectorCB callbackReferrer_newMyConditionBean() { return referrerBhv.newMyConditionBean(); }
351             public void callbackReferrer_queryForeignKeyInScope(TConnectorCB cb, List<java.lang.Integer> pkList) { cb.query().setStartObjectId_InScope(pkList); }
352             public void callbackReferrer_queryAddOrderByForeignKeyAsc(TConnectorCB cb) { cb.query().addOrderBy_StartObjectId_Asc(); }
353             public List<TConnector> callbackReferrer_selectList(TConnectorCB cb) { return referrerBhv.selectList(cb); }
354             public java.lang.Integer callbackReferrer_getForeignKeyValue(TConnector entity) { return entity.getStartObjectId(); }
355             public void callbackReferrer_setForeignEntity(TConnector referrerEntity, TObject baseEntity) { referrerEntity.setTObjectByStartObjectId(baseEntity); }
356         } );
357     }
358     /**
359      * Load referrer of TConnectorByEndObjectIdList with the setupper for condition-bean of referrer. <br />
360      * About internal policy, the value of primary key(and others too) is treated as case-insensitive. <br />
361      * The condition-bean that the setupper provides have settings before you touch it. It is as follows:
362      * <pre>
363      * cb.query().setEndObjectId_InScope(pkList);
364      * cb.query().addOrderBy_EndObjectId_Asc();
365      * </pre>
366      * @param tObjectList The entity list of TObject. (NotNull)
367      * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
368      */
369     public void loadTConnectorByEndObjectIdList(List<TObject> tObjectList, ConditionBeanSetupper<TConnectorCB> conditionBeanSetupper) {
370         assertObjectNotNull("tObjectList<TObject>", tObjectList);
371         assertObjectNotNull("conditionBeanSetupper<TConnectorCB>", conditionBeanSetupper);
372         if (tObjectList.isEmpty()) { return; }
373         loadTConnectorByEndObjectIdList(tObjectList, new LoadReferrerOption<TConnectorCB, TConnector>(conditionBeanSetupper));
374     }
375     /**
376      * {Refer to overload method that has an argument of condition-bean setupper.}
377      * @param tObjectList The entity list of TObject. (NotNull)
378      * @param loadReferrerOption The option of load-referrer. (NotNull)
379      */
380     public void loadTConnectorByEndObjectIdList(List<TObject> tObjectList, LoadReferrerOption<TConnectorCB, TConnector> loadReferrerOption) {
381         assertObjectNotNull("tObjectList<TObject>", tObjectList);
382         assertObjectNotNull("loadReferrerOption<TConnector, TConnectorCB>", loadReferrerOption);
383         if (tObjectList.isEmpty()) { return; }
384         final TConnectorBhv referrerBhv = xgetBSFLR().select(TConnectorBhv.class);
385         helpLoadReferrerInternally(tObjectList, loadReferrerOption, new InternalLoadReferrerCallback<TObject, java.lang.Integer, TConnectorCB, TConnector>() {
386             public java.lang.Integer callbackBase_getPrimaryKeyValue(TObject entity) { return entity.getObjectId(); }
387             public void callbackBase_setReferrerList(TObject entity, List<TConnector> referrerList) { entity.setTConnectorByEndObjectIdList(referrerList); }
388             public TConnectorCB callbackReferrer_newMyConditionBean() { return referrerBhv.newMyConditionBean(); }
389             public void callbackReferrer_queryForeignKeyInScope(TConnectorCB cb, List<java.lang.Integer> pkList) { cb.query().setEndObjectId_InScope(pkList); }
390             public void callbackReferrer_queryAddOrderByForeignKeyAsc(TConnectorCB cb) { cb.query().addOrderBy_EndObjectId_Asc(); }
391             public List<TConnector> callbackReferrer_selectList(TConnectorCB cb) { return referrerBhv.selectList(cb); }
392             public java.lang.Integer callbackReferrer_getForeignKeyValue(TConnector entity) { return entity.getEndObjectId(); }
393             public void callbackReferrer_setForeignEntity(TConnector referrerEntity, TObject baseEntity) { referrerEntity.setTObjectByEndObjectId(baseEntity); }
394         } );
395     }
396
397     // ===================================================================================
398     //                                                                     Pullout Foreign
399     //                                                                     ===============
400           
401     // ===================================================================================
402     //                                                                       Entity Update
403     //                                                                       =============
404     /**
405      * Insert the entity.
406      * @param tObject The entity of insert target. (NotNull)
407      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation)
408      */
409     public void insert(TObject tObject) {
410         assertEntityNotNull(tObject);
411         delegateInsert(tObject);
412     }
413
414     @Override
415     protected void doCreate(Entity tObject) {
416         insert((TObject)tObject);
417     }
418
419     /**
420      * Update the entity modified-only. {UpdateCountZeroException, ConcurrencyControl}
421      * @param tObject The entity of update target. (NotNull) {PrimaryKeyRequired, ConcurrencyColumnRequired}
422      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
423      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.
424      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation)
425      */
426     public void update(final TObject tObject) {
427         helpUpdateInternally(tObject, new InternalUpdateCallback<TObject>() {
428             public int callbackDelegateUpdate(TObject entity) { return delegateUpdate(entity); } });
429     }
430
431     @Override
432     protected void doModify(Entity entity) {
433         update((TObject)entity);
434     }
435
436     @Override
437     protected void doModifyNonstrict(Entity entity) {
438         update((TObject)entity);
439     }
440
441     /**
442      * Insert or update the entity modified-only. {ConcurrencyControl(when update)}
443      * @param tObject The entity of insert or update target. (NotNull)
444      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
445      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.
446      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation)
447      */
448     public void insertOrUpdate(final TObject tObject) {
449         helpInsertOrUpdateInternally(tObject, new InternalInsertOrUpdateCallback<TObject, TObjectCB>() {
450             public void callbackInsert(TObject entity) { insert(entity); }
451             public void callbackUpdate(TObject entity) { update(entity); }
452             public TObjectCB callbackNewMyConditionBean() { return newMyConditionBean(); }
453             public int callbackSelectCount(TObjectCB cb) { return selectCount(cb); }
454         });
455     }
456
457     @Override
458     protected void doCreateOrUpdate(Entity tObject) {
459         insertOrUpdate((TObject)tObject);
460     }
461
462     @Override
463     protected void doCreateOrUpdateNonstrict(Entity entity) {
464         insertOrUpdate((TObject)entity);
465     }
466
467     /**
468      * Delete the entity. {UpdateCountZeroException, ConcurrencyControl}
469      * @param tObject The entity of delete target. (NotNull) {PrimaryKeyRequired, ConcurrencyColumnRequired}
470      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
471      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.
472      */
473     public void delete(TObject tObject) {
474         helpDeleteInternally(tObject, new InternalDeleteCallback<TObject>() {
475             public int callbackDelegateDelete(TObject entity) { return delegateDelete(entity); } });
476     }
477
478     @Override
479     protected void doRemove(Entity tObject) {
480         delete((TObject)tObject);
481     }
482
483     // ===================================================================================
484     //                                                                        Batch Update
485     //                                                                        ============
486     /**
487      * Batch insert the list. This method use 'Batch Update' of java.sql.PreparedStatement.
488      * @param tObjectList The list of the entity. (NotNull)
489      * @return The array of inserted count.
490      */
491     public int[] batchInsert(List<TObject> tObjectList) {
492         assertObjectNotNull("tObjectList", tObjectList);
493         return delegateInsertList(tObjectList);
494     }
495
496     /**
497      * Batch update the list. All columns are update target. {NOT modified only} <br />
498      * This method use 'Batch Update' of java.sql.PreparedStatement.
499      * @param tObjectList The list of the entity. (NotNull)
500      * @return The array of updated count.
501      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
502      */
503     public int[] batchUpdate(List<TObject> tObjectList) {
504         assertObjectNotNull("tObjectList", tObjectList);
505         return delegateUpdateList(tObjectList);
506     }
507
508     /**
509      * Batch delete the list. <br />
510      * This method use 'Batch Update' of java.sql.PreparedStatement.
511      * @param tObjectList The list of the entity. (NotNull)
512      * @return The array of deleted count.
513      * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.
514      */
515     public int[] batchDelete(List<TObject> tObjectList) {
516         assertObjectNotNull("tObjectList", tObjectList);
517         return delegateDeleteList(tObjectList);
518     }
519
520     // ===================================================================================
521     //                                                                        Query Update
522     //                                                                        ============
523     /**
524      * Query update the several entities. {NoConcurrencyControl}
525      * @param tObject Entity. (NotNull) {PrimaryKeyNotRequired}
526      * @param cb Condition-bean. (NotNull)
527      * @return The updated count.
528      */
529     public int queryUpdate(TObject tObject, TObjectCB cb) {
530         assertObjectNotNull("tObject", tObject); assertConditionBeanNotNull(cb);
531         setupCommonColumnOfUpdateIfNeeds(tObject);
532         filterEntityOfUpdate(tObject); assertEntityOfUpdate(tObject);
533         return getMyDao().updateByQuery(cb, tObject);
534     }
535
536     /**
537      * Query delete the several entities. {NoConcurrencyControl}
538      * @param cb Condition-bean. (NotNull)
539      * @return The deleted count.
540      */
541     public int queryDelete(TObjectCB cb) {
542         assertConditionBeanNotNull(cb);
543         return getMyDao().deleteByQuery(cb);
544     }
545
546     // ===================================================================================
547     //                                                                      Various Update
548     //                                                                      ==============
549
550     // ===================================================================================
551     //                                                                     Delegate Method
552     //                                                                     ===============
553     // -----------------------------------------------------
554     //                                                Select
555     //                                                ------
556     protected int delegateSelectCount(TObjectCB cb) { assertConditionBeanNotNull(cb); return getMyDao().selectCount(cb); }
557     protected List<TObject> delegateSelectList(TObjectCB cb) { assertConditionBeanNotNull(cb); return getMyDao().selectList(cb); }
558
559     // -----------------------------------------------------
560     //                                                Update
561     //                                                ------
562     protected int delegateInsert(TObject e) { if (!processBeforeInsert(e)) { return 1; } return getMyDao().insert(e); }
563     protected int delegateUpdate(TObject e) { if (!processBeforeUpdate(e)) { return 1; } return getMyDao().updateModifiedOnly(e); }
564     protected int delegateDelete(TObject e) { if (!processBeforeDelete(e)) { return 1; } return getMyDao().delete(e); }
565
566     protected int[] delegateInsertList(List<TObject> ls) {
567         assertObjectNotNull("tObjectList", ls); return getMyDao().insertList(helpFilterBeforeInsertInternally(ls));
568     }
569     protected int[] delegateUpdateList(List<TObject> ls) {
570         assertObjectNotNull("tObjectList", ls); return getMyDao().updateList(helpFilterBeforeUpdateInternally(ls));
571     }
572     protected int[] delegateDeleteList(List<TObject> ls) {
573         assertObjectNotNull("tObjectList", ls); return getMyDao().deleteList(helpFilterBeforeDeleteInternally(ls));
574     }
575
576     // ===================================================================================
577     //                                                                Optimistic Lock Info
578     //                                                                ====================
579     @Override
580     protected boolean hasVersionNoValue(Entity entity) {
581         return false;
582     }
583
584     @Override
585     protected boolean hasUpdateDateValue(Entity entity) {
586         return false;
587     }
588
589     // ===================================================================================
590     //                                                                              Helper
591     //                                                                              ======
592     protected TObject downcast(Entity entity) {
593         return helpDowncastInternally(entity, TObject.class);
594     }
595 }