1 package jp.sourceforge.ea2ddl.dao.bsbhv;
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.*;
26 * The behavior of t_object.
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
47 * t_objectproperties, t_attribute, t_operation, t_connector
53 * tObjectpropertiesList, tAttributeList, tOperationList, tConnectorByStartObjectIdList, tConnectorByEndObjectIdList
55 * @author DBFlute(AutoGenerator)
57 public abstract class BsTObjectBhv extends jp.sourceforge.ea2ddl.dao.allcommon.bhv.AbstractBehaviorWritable {
59 // ===================================================================================
62 /*df:BehaviorQueryPathBegin*/
63 public static final String PATH_selectList = "selectList";
64 public static final String PATH_selectTableById = "selectTableById";
65 /*df:BehaviorQueryPathEnd*/
67 // ===================================================================================
70 protected TObjectDao _dao;
72 // ===================================================================================
75 /** @return The name on database of table. (NotNull) */
76 public String getTableDbName() { return "t_object"; }
78 // ===================================================================================
81 /** @return The meta data of the database. (NotNull) */
82 public DBMeta getDBMeta() { return TObjectDbm.getInstance(); }
84 /** @return The meta data of the database as my table type. (NotNull) */
85 public TObjectDbm getMyDBMeta() { return TObjectDbm.getInstance(); }
87 // ===================================================================================
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(); }
95 // ===================================================================================
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(); }
103 // ===================================================================================
107 * Select the count of the condition-bean. {IgnorePagingCondition}
108 * @param cb The condition-bean of TObject. (NotNull)
109 * @return The selected count.
111 public int selectCount(TObjectCB cb) {
112 assertConditionBeanNotNull(cb);
113 return delegateSelectCount(cb);
116 // ===================================================================================
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.
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); } });
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.
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); } });
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.
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);
157 // ===================================================================================
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)
165 public ListResultBean<TObject> selectList(TObjectCB cb) {
166 assertConditionBeanNotNull(cb);
167 return new ResultBeanBuilder<TObject>(getTableDbName()).buildListResultBean(cb, delegateSelectList(cb));
170 // ===================================================================================
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)
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); }
186 return invoker.invokePaging(handler);
189 // ===================================================================================
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)
198 public List<java.util.Map<String, Object>> selectValueLabelList(TObjectCB cb, ValueLabelSetupper<TObject> valueLabelSetupper) {
199 return createValueLabelList(selectList(cb), valueLabelSetupper);
203 // ===================================================================================
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:
211 * cb.query().setObjectId_InScope(pkList);
212 * cb.query().addOrderBy_ObjectId_Asc();
214 * @param tObjectList The entity list of TObject. (NotNull)
215 * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
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));
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)
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); }
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:
249 * cb.query().setObjectId_InScope(pkList);
250 * cb.query().addOrderBy_ObjectId_Asc();
252 * @param tObjectList The entity list of TObject. (NotNull)
253 * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
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));
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)
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); }
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:
287 * cb.query().setObjectId_InScope(pkList);
288 * cb.query().addOrderBy_ObjectId_Asc();
290 * @param tObjectList The entity list of TObject. (NotNull)
291 * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
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));
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)
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); }
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:
325 * cb.query().setStartObjectId_InScope(pkList);
326 * cb.query().addOrderBy_StartObjectId_Asc();
328 * @param tObjectList The entity list of TObject. (NotNull)
329 * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
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));
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)
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); }
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:
363 * cb.query().setEndObjectId_InScope(pkList);
364 * cb.query().addOrderBy_EndObjectId_Asc();
366 * @param tObjectList The entity list of TObject. (NotNull)
367 * @param conditionBeanSetupper The instance of referrer condition-bean setupper for registering referrer condition. (NotNull)
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));
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)
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); }
397 // ===================================================================================
401 // ===================================================================================
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)
409 public void insert(TObject tObject) {
410 assertEntityNotNull(tObject);
411 delegateInsert(tObject);
415 protected void doCreate(Entity tObject) {
416 insert((TObject)tObject);
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)
426 public void update(final TObject tObject) {
427 helpUpdateInternally(tObject, new InternalUpdateCallback<TObject>() {
428 public int callbackDelegateUpdate(TObject entity) { return delegateUpdate(entity); } });
432 protected void doModify(Entity entity) {
433 update((TObject)entity);
437 protected void doModifyNonstrict(Entity entity) {
438 update((TObject)entity);
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)
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); }
458 protected void doCreateOrUpdate(Entity tObject) {
459 insertOrUpdate((TObject)tObject);
463 protected void doCreateOrUpdateNonstrict(Entity entity) {
464 insertOrUpdate((TObject)entity);
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.
473 public void delete(TObject tObject) {
474 helpDeleteInternally(tObject, new InternalDeleteCallback<TObject>() {
475 public int callbackDelegateDelete(TObject entity) { return delegateDelete(entity); } });
479 protected void doRemove(Entity tObject) {
480 delete((TObject)tObject);
483 // ===================================================================================
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.
491 public int[] batchInsert(List<TObject> tObjectList) {
492 assertObjectNotNull("tObjectList", tObjectList);
493 return delegateInsertList(tObjectList);
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.
503 public int[] batchUpdate(List<TObject> tObjectList) {
504 assertObjectNotNull("tObjectList", tObjectList);
505 return delegateUpdateList(tObjectList);
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.
515 public int[] batchDelete(List<TObject> tObjectList) {
516 assertObjectNotNull("tObjectList", tObjectList);
517 return delegateDeleteList(tObjectList);
520 // ===================================================================================
524 * Query update the several entities. {NoConcurrencyControl}
525 * @param tObject Entity. (NotNull) {PrimaryKeyNotRequired}
526 * @param cb Condition-bean. (NotNull)
527 * @return The updated count.
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);
537 * Query delete the several entities. {NoConcurrencyControl}
538 * @param cb Condition-bean. (NotNull)
539 * @return The deleted count.
541 public int queryDelete(TObjectCB cb) {
542 assertConditionBeanNotNull(cb);
543 return getMyDao().deleteByQuery(cb);
546 // ===================================================================================
550 // ===================================================================================
553 // -----------------------------------------------------
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); }
559 // -----------------------------------------------------
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); }
566 protected int[] delegateInsertList(List<TObject> ls) {
567 assertObjectNotNull("tObjectList", ls); return getMyDao().insertList(helpFilterBeforeInsertInternally(ls));
569 protected int[] delegateUpdateList(List<TObject> ls) {
570 assertObjectNotNull("tObjectList", ls); return getMyDao().updateList(helpFilterBeforeUpdateInternally(ls));
572 protected int[] delegateDeleteList(List<TObject> ls) {
573 assertObjectNotNull("tObjectList", ls); return getMyDao().deleteList(helpFilterBeforeDeleteInternally(ls));
576 // ===================================================================================
577 // Optimistic Lock Info
578 // ====================
580 protected boolean hasVersionNoValue(Entity entity) {
585 protected boolean hasUpdateDateValue(Entity entity) {
589 // ===================================================================================
592 protected TObject downcast(Entity entity) {
593 return helpDowncastInternally(entity, TObject.class);