All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codelibs.fess.crawler.db.bsbhv.BsUrlQueueBhv Maven / Gradle / Ivy

/*
 * Copyright 2012-2016 CodeLibs Project and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package org.codelibs.fess.crawler.db.bsbhv;

import java.util.List;

import org.dbflute.*;
import org.dbflute.bhv.*;
import org.dbflute.bhv.readable.*;
import org.dbflute.bhv.writable.*;
import org.dbflute.bhv.referrer.*;
import org.dbflute.cbean.*;
import org.dbflute.cbean.chelper.HpSLSFunction;
import org.dbflute.cbean.result.*;
import org.dbflute.exception.*;
import org.dbflute.optional.OptionalEntity;
import org.dbflute.outsidesql.executor.*;
import org.codelibs.fess.crawler.db.exbhv.*;
import org.codelibs.fess.crawler.db.bsbhv.loader.*;
import org.codelibs.fess.crawler.db.exentity.*;
import org.codelibs.fess.crawler.db.bsentity.dbmeta.*;
import org.codelibs.fess.crawler.db.cbean.*;

/**
 * The behavior of URL_QUEUE as TABLE. 
*
 * [primary key]
 *     ID
 *
 * [column]
 *     ID, SESSION_ID, METHOD, URL, META_DATA, ENCODING, PARENT_URL, DEPTH, LAST_MODIFIED, CREATE_TIME
 *
 * [sequence]
 *     
 *
 * [identity]
 *     ID
 *
 * [version-no]
 *     
 *
 * [foreign table]
 *     
 *
 * [referrer table]
 *     
 *
 * [foreign property]
 *     
 *
 * [referrer property]
 *     
 * 
* @author DBFlute(AutoGenerator) */ public abstract class BsUrlQueueBhv extends AbstractBehaviorWritable { // =================================================================================== // Definition // ========== /*df:beginQueryPath*/ /** Delete UrlQueue by SessionID */ public static final String PATH_deleteUrlQueueBySessionId = "deleteUrlQueueBySessionId"; /** Delete All UrlQueue */ public static final String PATH_deleteAllUrlQueue = "deleteAllUrlQueue"; /*df:endQueryPath*/ // =================================================================================== // DB Meta // ======= /** {@inheritDoc} */ public UrlQueueDbm asDBMeta() { return UrlQueueDbm.getInstance(); } /** {@inheritDoc} */ public String asTableDbName() { return "URL_QUEUE"; } // =================================================================================== // New Instance // ============ /** {@inheritDoc} */ public UrlQueueCB newConditionBean() { return new UrlQueueCB(); } // =================================================================================== // Count Select // ============ /** * Select the count of uniquely-selected records by the condition-bean. {IgnorePagingCondition, IgnoreSpecifyColumn}
* SpecifyColumn is ignored but you can use it only to remove text type column for union's distinct. *
     * int count = urlQueueBhv.selectCount(cb -> {
     *     cb.query().set...
     * });
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The count for the condition. (NotMinus) */ public int selectCount(CBCall cbLambda) { return facadeSelectCount(createCB(cbLambda)); } // =================================================================================== // Entity Select // ============= /** * Select the entity by the condition-bean.
* It returns not-null optional entity, so you should ...
* If the data is always present as your business rule, alwaysPresent().
* If it might be no data, isPresent() and orElse(), ... *
     * // if the data always exists as your business rule
     * urlQueueBhv.selectEntity(cb -> {
     *     cb.query().set...
     * }).alwaysPresent(urlQueue -> {
     *     // called if present, or exception
     *     ... = urlQueue.get...
     * });
     * 
     * // if it might be no data, ...
     * urlQueueBhv.selectEntity(cb -> {
     *     cb.query().set...
     * }).ifPresent(urlQueue -> {
     *     // called if present
     *     ... = urlQueue.get...
     * }).orElse(() -> {
     *     // called if not present
     * });
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The optional entity selected by the condition. (NotNull: if no data, empty entity) * @throws EntityAlreadyDeletedException When get(), required() of return value is called and the value is null, which means entity has already been deleted (not found). * @throws EntityDuplicatedException When the entity has been duplicated. * @throws SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public OptionalEntity selectEntity(CBCall cbLambda) { return facadeSelectEntity(createCB(cbLambda)); } protected OptionalEntity facadeSelectEntity(UrlQueueCB cb) { return doSelectOptionalEntity(cb, typeOfSelectedEntity()); } protected OptionalEntity doSelectOptionalEntity(UrlQueueCB cb, Class tp) { return createOptionalEntity(doSelectEntity(cb, tp), cb); } protected Entity doReadEntity(ConditionBean cb) { return facadeSelectEntity(downcast(cb)).orElse(null); } /** * Select the entity by the condition-bean with deleted check.
* If the data is always present as your business rule, this method is good. *
     * UrlQueue urlQueue = urlQueueBhv.selectEntityWithDeletedCheck(cb -> cb.acceptPK(1));
     * ... = urlQueue.get...(); // the entity always be not null
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The entity selected by the condition. (NotNull: if no data, throws exception) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. * @throws SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public UrlQueue selectEntityWithDeletedCheck(CBCall cbLambda) { return facadeSelectEntityWithDeletedCheck(createCB(cbLambda)); } /** * Select the entity by the primary-key value. * @param id : PK, ID, NotNull, BIGINT(19). (NotNull) * @return The optional entity selected by the PK. (NotNull: if no data, empty entity) * @throws EntityAlreadyDeletedException When get(), required() of return value is called and the value is null, which means entity has already been deleted (not found). * @throws EntityDuplicatedException When the entity has been duplicated. * @throws SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public OptionalEntity selectByPK(Long id) { return facadeSelectByPK(id); } protected OptionalEntity facadeSelectByPK(Long id) { return doSelectOptionalByPK(id, typeOfSelectedEntity()); } protected ENTITY doSelectByPK(Long id, Class tp) { return doSelectEntity(xprepareCBAsPK(id), tp); } protected OptionalEntity doSelectOptionalByPK(Long id, Class tp) { return createOptionalEntity(doSelectByPK(id, tp), id); } protected UrlQueueCB xprepareCBAsPK(Long id) { assertObjectNotNull("id", id); return newConditionBean().acceptPK(id); } // =================================================================================== // List Select // =========== /** * Select the list as result bean. *
     * ListResultBean<UrlQueue> urlQueueList = urlQueueBhv.selectList(cb -> {
     *     cb.query().set...;
     *     cb.query().addOrderBy...;
     * });
     * for (UrlQueue urlQueue : urlQueueList) {
     *     ... = urlQueue.get...;
     * }
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The result bean of selected list. (NotNull: if no data, returns empty list) * @throws DangerousResultSizeException When the result size is over the specified safety size. */ public ListResultBean selectList(CBCall cbLambda) { return facadeSelectList(createCB(cbLambda)); } @Override protected boolean isEntityDerivedMappable() { return true; } // =================================================================================== // Page Select // =========== /** * Select the page as result bean.
* (both count-select and paging-select are executed) *
     * PagingResultBean<UrlQueue> page = urlQueueBhv.selectPage(cb -> {
     *     cb.query().set...
     *     cb.query().addOrderBy...
     *     cb.paging(20, 3); // 20 records per a page and current page number is 3
     * });
     * int allRecordCount = page.getAllRecordCount();
     * int allPageCount = page.getAllPageCount();
     * boolean isExistPrePage = page.isExistPrePage();
     * boolean isExistNextPage = page.isExistNextPage();
     * ...
     * for (UrlQueue urlQueue : page) {
     *     ... = urlQueue.get...;
     * }
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The result bean of selected page. (NotNull: if no data, returns bean as empty list) * @throws DangerousResultSizeException When the result size is over the specified safety size. */ public PagingResultBean selectPage(CBCall cbLambda) { return facadeSelectPage(createCB(cbLambda)); } // =================================================================================== // Cursor Select // ============= /** * Select the cursor by the condition-bean. *
     * urlQueueBhv.selectCursor(cb -> {
     *     cb.query().set...
     * }, member -> {
     *     ... = member.getMemberName();
     * });
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @param entityLambda The handler of entity row of UrlQueue. (NotNull) */ public void selectCursor(CBCall cbLambda, EntityRowHandler entityLambda) { facadeSelectCursor(createCB(cbLambda), entityLambda); } // =================================================================================== // Scalar Select // ============= /** * Select the scalar value derived by a function from uniquely-selected records.
* You should call a function method after this method called like as follows: *
     * urlQueueBhv.selectScalar(Date.class).max(cb -> {
     *     cb.specify().column...; // required for the function
     *     cb.query().set...
     * });
     * 
* @param The type of result. * @param resultType The type of result. (NotNull) * @return The scalar function object to specify function for scalar value. (NotNull) */ public HpSLSFunction selectScalar(Class resultType) { return facadeScalarSelect(resultType); } // =================================================================================== // Sequence // ======== @Override protected Number doReadNextVal() { String msg = "This table is NOT related to sequence: " + asTableDbName(); throw new UnsupportedOperationException(msg); } // =================================================================================== // Load Referrer // ============= /** * Load referrer for the list by the referrer loader. *
     * List<Member> memberList = memberBhv.selectList(cb -> {
     *     cb.query().set...
     * });
     * memberBhv.load(memberList, memberLoader -> {
     *     memberLoader.loadPurchase(purchaseCB -> {
     *         purchaseCB.setupSelect...
     *         purchaseCB.query().set...
     *         purchaseCB.query().addOrderBy...
     *     }); // you can also load nested referrer from here
     *     //}).withNestedReferrer(purchaseLoader -> {
     *     //    purchaseLoader.loadPurchasePayment(...);
     *     //});
     *
     *     // you can also pull out foreign table and load its referrer
     *     // (setupSelect of the foreign table should be called)
     *     //memberLoader.pulloutMemberStatus().loadMemberLogin(...)
     * });
     * for (Member member : memberList) {
     *     List<Purchase> purchaseList = member.getPurchaseList();
     *     for (Purchase purchase : purchaseList) {
     *         ...
     *     }
     * }
     * 
* About internal policy, the value of primary key (and others too) is treated as case-insensitive.
* The condition-bean, which the set-upper provides, has order by FK before callback. * @param urlQueueList The entity list of urlQueue. (NotNull) * @param loaderLambda The callback to handle the referrer loader for actually loading referrer. (NotNull) */ public void load(List urlQueueList, ReferrerLoaderHandler loaderLambda) { xassLRArg(urlQueueList, loaderLambda); loaderLambda.handle(new LoaderOfUrlQueue().ready(urlQueueList, _behaviorSelector)); } /** * Load referrer for the entity by the referrer loader. *
     * Member member = memberBhv.selectEntityWithDeletedCheck(cb -> cb.acceptPK(1));
     * memberBhv.load(member, memberLoader -> {
     *     memberLoader.loadPurchase(purchaseCB -> {
     *         purchaseCB.setupSelect...
     *         purchaseCB.query().set...
     *         purchaseCB.query().addOrderBy...
     *     }); // you can also load nested referrer from here
     *     //}).withNestedReferrer(purchaseLoader -> {
     *     //    purchaseLoader.loadPurchasePayment(...);
     *     //});
     *
     *     // you can also pull out foreign table and load its referrer
     *     // (setupSelect of the foreign table should be called)
     *     //memberLoader.pulloutMemberStatus().loadMemberLogin(...)
     * });
     * List<Purchase> purchaseList = member.getPurchaseList();
     * for (Purchase purchase : purchaseList) {
     *     ...
     * }
     * 
* About internal policy, the value of primary key (and others too) is treated as case-insensitive.
* The condition-bean, which the set-upper provides, has order by FK before callback. * @param urlQueue The entity of urlQueue. (NotNull) * @param loaderLambda The callback to handle the referrer loader for actually loading referrer. (NotNull) */ public void load(UrlQueue urlQueue, ReferrerLoaderHandler loaderLambda) { xassLRArg(urlQueue, loaderLambda); loaderLambda.handle(new LoaderOfUrlQueue().ready(xnewLRAryLs(urlQueue), _behaviorSelector)); } // =================================================================================== // Pull out Relation // ================= // =================================================================================== // Extract Column // ============== /** * Extract the value list of (single) primary key id. * @param urlQueueList The list of urlQueue. (NotNull, EmptyAllowed) * @return The list of the column value. (NotNull, EmptyAllowed, NotNullElement) */ public List extractIdList(List urlQueueList) { return helpExtractListInternally(urlQueueList, "id"); } // =================================================================================== // Entity Update // ============= /** * Insert the entity modified-only. (DefaultConstraintsEnabled) *
     * UrlQueue urlQueue = new UrlQueue();
     * // if auto-increment, you don't need to set the PK value
     * urlQueue.setFoo...(value);
     * urlQueue.setBar...(value);
     * // you don't need to set values of common columns
     * //urlQueue.setRegisterUser(value);
     * //urlQueue.set...;
     * urlQueueBhv.insert(urlQueue);
     * ... = urlQueue.getPK...(); // if auto-increment, you can get the value after
     * 
*

While, when the entity is created by select, all columns are registered.

* @param urlQueue The entity of insert. (NotNull, PrimaryKeyNullAllowed: when auto-increment) * @throws EntityAlreadyExistsException When the entity already exists. (unique constraint violation) */ public void insert(UrlQueue urlQueue) { doInsert(urlQueue, null); } /** * Update the entity modified-only. (ZeroUpdateException, NonExclusiveControl)
* By PK as default, and also you can update by unique keys using entity's uniqueOf(). *
     * UrlQueue urlQueue = new UrlQueue();
     * urlQueue.setPK...(value); // required
     * urlQueue.setFoo...(value); // you should set only modified columns
     * // you don't need to set values of common columns
     * //urlQueue.setRegisterUser(value);
     * //urlQueue.set...;
     * // if exclusive control, the value of concurrency column is required
     * urlQueue.setVersionNo(value);
     * urlQueueBhv.update(urlQueue);
     * 
* @param urlQueue The entity of update. (NotNull, PrimaryKeyNotNull) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. * @throws EntityAlreadyExistsException When the entity already exists. (unique constraint violation) */ public void update(UrlQueue urlQueue) { doUpdate(urlQueue, null); } /** * Insert or update the entity modified-only. (DefaultConstraintsEnabled, NonExclusiveControl)
* if (the entity has no PK) { insert() } else { update(), but no data, insert() }
*

Also you can update by unique keys using entity's uniqueOf().

* @param urlQueue The entity of insert or update. (NotNull, ...depends on insert or update) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. * @throws EntityAlreadyExistsException When the entity already exists. (unique constraint violation) */ public void insertOrUpdate(UrlQueue urlQueue) { doInsertOrUpdate(urlQueue, null, null); } /** * Delete the entity. (ZeroUpdateException, NonExclusiveControl)
* By PK as default, and also you can delete by unique keys using entity's uniqueOf(). *
     * UrlQueue urlQueue = new UrlQueue();
     * urlQueue.setPK...(value); // required
     * // if exclusive control, the value of concurrency column is required
     * urlQueue.setVersionNo(value);
     * try {
     *     urlQueueBhv.delete(urlQueue);
     * } catch (EntityAlreadyUpdatedException e) { // if concurrent update
     *     ...
     * }
     * 
* @param urlQueue The entity of delete. (NotNull, PrimaryKeyNotNull) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. */ public void delete(UrlQueue urlQueue) { doDelete(urlQueue, null); } // =================================================================================== // Batch Update // ============ /** * Batch-insert the entity list modified-only of same-set columns. (DefaultConstraintsEnabled)
* This method uses executeBatch() of java.sql.PreparedStatement.
*

The columns of least common multiple are registered like this:

*
     * for (... : ...) {
     *     UrlQueue urlQueue = new UrlQueue();
     *     urlQueue.setFooName("foo");
     *     if (...) {
     *         urlQueue.setFooPrice(123);
     *     }
     *     // FOO_NAME and FOO_PRICE (and record meta columns) are registered
     *     // FOO_PRICE not-called in any entities are registered as null without default value
     *     // columns not-called in all entities are registered as null or default value
     *     urlQueueList.add(urlQueue);
     * }
     * urlQueueBhv.batchInsert(urlQueueList);
     * 
*

While, when the entities are created by select, all columns are registered.

*

And if the table has an identity, entities after the process don't have incremented values. * (When you use the (normal) insert(), you can get the incremented value from your entity)

* @param urlQueueList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNullAllowed: when auto-increment) * @return The array of inserted count. (NotNull, EmptyAllowed) */ public int[] batchInsert(List urlQueueList) { return doBatchInsert(urlQueueList, null); } /** * Batch-update the entity list modified-only of same-set columns. (NonExclusiveControl)
* This method uses executeBatch() of java.sql.PreparedStatement.
* You should specify same-set columns to all entities like this: *
     * for (... : ...) {
     *     UrlQueue urlQueue = new UrlQueue();
     *     urlQueue.setFooName("foo");
     *     if (...) {
     *         urlQueue.setFooPrice(123);
     *     } else {
     *         urlQueue.setFooPrice(null); // updated as null
     *         //urlQueue.setFooDate(...); // *not allowed, fragmented
     *     }
     *     // FOO_NAME and FOO_PRICE (and record meta columns) are updated
     *     // (others are not updated: their values are kept)
     *     urlQueueList.add(urlQueue);
     * }
     * urlQueueBhv.batchUpdate(urlQueueList);
     * 
* @param urlQueueList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull) * @return The array of updated count. (NotNull, EmptyAllowed) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) */ public int[] batchUpdate(List urlQueueList) { return doBatchUpdate(urlQueueList, null); } /** * Batch-delete the entity list. (NonExclusiveControl)
* This method uses executeBatch() of java.sql.PreparedStatement. * @param urlQueueList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull) * @return The array of deleted count. (NotNull, EmptyAllowed) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) */ public int[] batchDelete(List urlQueueList) { return doBatchDelete(urlQueueList, null); } // =================================================================================== // Query Update // ============ /** * Insert the several entities by query (modified-only for fixed value). *
     * urlQueueBhv.queryInsert(new QueryInsertSetupper<UrlQueue, UrlQueueCB>() {
     *     public ConditionBean setup(UrlQueue entity, UrlQueueCB intoCB) {
     *         FooCB cb = FooCB();
     *         cb.setupSelect_Bar();
     *
     *         // mapping
     *         intoCB.specify().columnMyName().mappedFrom(cb.specify().columnFooName());
     *         intoCB.specify().columnMyCount().mappedFrom(cb.specify().columnFooCount());
     *         intoCB.specify().columnMyDate().mappedFrom(cb.specify().specifyBar().columnBarDate());
     *         entity.setMyFixedValue("foo"); // fixed value
     *         // you don't need to set values of common columns
     *         //entity.setRegisterUser(value);
     *         //entity.set...;
     *         // you don't need to set a value of concurrency column
     *         //entity.setVersionNo(value);
     *
     *         return cb;
     *     }
     * });
     * 
* @param manyArgLambda The callback to set up query-insert. (NotNull) * @return The inserted count. */ public int queryInsert(QueryInsertSetupper manyArgLambda) { return doQueryInsert(manyArgLambda, null); } /** * Update the several entities by query non-strictly modified-only. (NonExclusiveControl) *
     * UrlQueue urlQueue = new UrlQueue();
     * // you don't need to set PK value
     * //urlQueue.setPK...(value);
     * urlQueue.setFoo...(value); // you should set only modified columns
     * // you don't need to set values of common columns
     * //urlQueue.setRegisterUser(value);
     * //urlQueue.set...;
     * // you don't need to set a value of concurrency column
     * // (auto-increment for version number is valid though non-exclusive control)
     * //urlQueue.setVersionNo(value);
     * urlQueueBhv.queryUpdate(urlQueue, cb -> {
     *     cb.query().setFoo...
     * });
     * 
* @param urlQueue The entity that contains update values. (NotNull, PrimaryKeyNullAllowed) * @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The updated count. * @throws NonQueryUpdateNotAllowedException When the query has no condition. */ public int queryUpdate(UrlQueue urlQueue, CBCall cbLambda) { return doQueryUpdate(urlQueue, createCB(cbLambda), null); } /** * Delete the several entities by query. (NonExclusiveControl) *
     * urlQueueBhv.queryDelete(urlQueue, cb -> {
     *     cb.query().setFoo...
     * });
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @return The deleted count. * @throws NonQueryDeleteNotAllowedException When the query has no condition. */ public int queryDelete(CBCall cbLambda) { return doQueryDelete(createCB(cbLambda), null); } // =================================================================================== // Varying Update // ============== // ----------------------------------------------------- // Entity Update // ------------- /** * Insert the entity with varying requests.
* For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity().
* Other specifications are same as insert(entity). *
     * UrlQueue urlQueue = new UrlQueue();
     * // if auto-increment, you don't need to set the PK value
     * urlQueue.setFoo...(value);
     * urlQueue.setBar...(value);
     * urlQueueBhv.varyingInsert(urlQueue, op -> {
     *     // you can insert by your values for common columns
     *     op.disableCommonColumnAutoSetup();
     * });
     * ... = urlQueue.getPK...(); // if auto-increment, you can get the value after
     * 
* @param urlQueue The entity of insert. (NotNull, PrimaryKeyNullAllowed: when auto-increment) * @param opLambda The callback for option of insert for varying requests. (NotNull) * @throws EntityAlreadyExistsException When the entity already exists. (unique constraint violation) */ public void varyingInsert(UrlQueue urlQueue, WritableOptionCall> opLambda) { doInsert(urlQueue, createInsertOption(opLambda)); } /** * Update the entity with varying requests modified-only. (ZeroUpdateException, NonExclusiveControl)
* For example, self(selfCalculationSpecification), specify(updateColumnSpecification), disableCommonColumnAutoSetup().
* Other specifications are same as update(entity). *
     * UrlQueue urlQueue = new UrlQueue();
     * urlQueue.setPK...(value); // required
     * urlQueue.setOther...(value); // you should set only modified columns
     * // if exclusive control, the value of concurrency column is required
     * urlQueue.setVersionNo(value);
     * // you can update by self calculation values
     * urlQueueBhv.varyingUpdate(urlQueue, op -> {
     *     op.self(cb -> {
     *         cb.specify().columnXxxCount();
     *     }).plus(1); // XXX_COUNT = XXX_COUNT + 1
     * });
     * 
* @param urlQueue The entity of update. (NotNull, PrimaryKeyNotNull) * @param opLambda The callback for option of update for varying requests. (NotNull) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. * @throws EntityAlreadyExistsException When the entity already exists. (unique constraint violation) */ public void varyingUpdate(UrlQueue urlQueue, WritableOptionCall> opLambda) { doUpdate(urlQueue, createUpdateOption(opLambda)); } /** * Insert or update the entity with varying requests. (ExclusiveControl: when update)
* Other specifications are same as insertOrUpdate(entity). * @param urlQueue The entity of insert or update. (NotNull) * @param insertOpLambda The callback for option of insert for varying requests. (NotNull) * @param updateOpLambda The callback for option of update for varying requests. (NotNull) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. * @throws EntityAlreadyExistsException When the entity already exists. (unique constraint violation) */ public void varyingInsertOrUpdate(UrlQueue urlQueue, WritableOptionCall> insertOpLambda, WritableOptionCall> updateOpLambda) { doInsertOrUpdate(urlQueue, createInsertOption(insertOpLambda), createUpdateOption(updateOpLambda)); } /** * Delete the entity with varying requests. (ZeroUpdateException, NonExclusiveControl)
* Now a valid option does not exist.
* Other specifications are same as delete(entity). * @param urlQueue The entity of delete. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnNotNull) * @param opLambda The callback for option of delete for varying requests. (NotNull) * @throws EntityAlreadyDeletedException When the entity has already been deleted. (not found) * @throws EntityDuplicatedException When the entity has been duplicated. */ public void varyingDelete(UrlQueue urlQueue, WritableOptionCall> opLambda) { doDelete(urlQueue, createDeleteOption(opLambda)); } // ----------------------------------------------------- // Batch Update // ------------ /** * Batch-insert the list with varying requests.
* For example, disableCommonColumnAutoSetup() * , disablePrimaryKeyIdentity(), limitBatchInsertLogging().
* Other specifications are same as batchInsert(entityList). * @param urlQueueList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull) * @param opLambda The callback for option of insert for varying requests. (NotNull) * @return The array of updated count. (NotNull, EmptyAllowed) */ public int[] varyingBatchInsert(List urlQueueList, WritableOptionCall> opLambda) { return doBatchInsert(urlQueueList, createInsertOption(opLambda)); } /** * Batch-update the list with varying requests.
* For example, self(selfCalculationSpecification), specify(updateColumnSpecification) * , disableCommonColumnAutoSetup(), limitBatchUpdateLogging().
* Other specifications are same as batchUpdate(entityList). * @param urlQueueList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull) * @param opLambda The callback for option of update for varying requests. (NotNull) * @return The array of updated count. (NotNull, EmptyAllowed) */ public int[] varyingBatchUpdate(List urlQueueList, WritableOptionCall> opLambda) { return doBatchUpdate(urlQueueList, createUpdateOption(opLambda)); } /** * Batch-delete the list with varying requests.
* For example, limitBatchDeleteLogging().
* Other specifications are same as batchDelete(entityList). * @param urlQueueList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull) * @param opLambda The callback for option of delete for varying requests. (NotNull) * @return The array of deleted count. (NotNull, EmptyAllowed) */ public int[] varyingBatchDelete(List urlQueueList, WritableOptionCall> opLambda) { return doBatchDelete(urlQueueList, createDeleteOption(opLambda)); } // ----------------------------------------------------- // Query Update // ------------ /** * Insert the several entities by query with varying requests (modified-only for fixed value).
* For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity().
* Other specifications are same as queryInsert(entity, setupper). * @param manyArgLambda The set-upper of query-insert. (NotNull) * @param opLambda The callback for option of insert for varying requests. (NotNull) * @return The inserted count. */ public int varyingQueryInsert(QueryInsertSetupper manyArgLambda, WritableOptionCall> opLambda) { return doQueryInsert(manyArgLambda, createInsertOption(opLambda)); } /** * Update the several entities by query with varying requests non-strictly modified-only. {NonExclusiveControl}
* For example, self(selfCalculationSpecification), specify(updateColumnSpecification) * , disableCommonColumnAutoSetup(), allowNonQueryUpdate().
* Other specifications are same as queryUpdate(entity, cb). *
     * // ex) you can update by self calculation values
     * UrlQueue urlQueue = new UrlQueue();
     * // you don't need to set PK value
     * //urlQueue.setPK...(value);
     * urlQueue.setOther...(value); // you should set only modified columns
     * // you don't need to set a value of concurrency column
     * // (auto-increment for version number is valid though non-exclusive control)
     * //urlQueue.setVersionNo(value);
     * urlQueueBhv.varyingQueryUpdate(urlQueue, cb -> {
     *     cb.query().setFoo...
     * }, op -> {
     *     op.self(colCB -> {
     *         colCB.specify().columnFooCount();
     *     }).plus(1); // FOO_COUNT = FOO_COUNT + 1
     * });
     * 
* @param urlQueue The entity that contains update values. (NotNull) {PrimaryKeyNotRequired} * @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @param opLambda The callback for option of update for varying requests. (NotNull) * @return The updated count. * @throws NonQueryUpdateNotAllowedException When the query has no condition (if not allowed). */ public int varyingQueryUpdate(UrlQueue urlQueue, CBCall cbLambda, WritableOptionCall> opLambda) { return doQueryUpdate(urlQueue, createCB(cbLambda), createUpdateOption(opLambda)); } /** * Delete the several entities by query with varying requests non-strictly.
* For example, allowNonQueryDelete().
* Other specifications are same as queryDelete(cb). *
     * urlQueueBhv.queryDelete(urlQueue, cb -> {
     *     cb.query().setFoo...
     * }, op -> {
     *     op...
     * });
     * 
* @param cbLambda The callback for condition-bean of UrlQueue. (NotNull) * @param opLambda The callback for option of delete for varying requests. (NotNull) * @return The deleted count. * @throws NonQueryDeleteNotAllowedException When the query has no condition (if not allowed). */ public int varyingQueryDelete(CBCall cbLambda, WritableOptionCall> opLambda) { return doQueryDelete(createCB(cbLambda), createDeleteOption(opLambda)); } // =================================================================================== // OutsideSql // ========== /** * Prepare the all facade executor of outside-SQL to execute it. *
     * // main style 
     * urlQueueBhv.outideSql().selectEntity(pmb); // optional 
     * urlQueueBhv.outideSql().selectList(pmb); // ListResultBean
     * urlQueueBhv.outideSql().selectPage(pmb); // PagingResultBean
     * urlQueueBhv.outideSql().selectPagedListOnly(pmb); // ListResultBean
     * urlQueueBhv.outideSql().selectCursor(pmb, handler); // (by handler)
     * urlQueueBhv.outideSql().execute(pmb); // int (updated count)
     * urlQueueBhv.outideSql().call(pmb); // void (pmb has OUT parameters)
     *
     * // traditional style 
     * urlQueueBhv.outideSql().traditionalStyle().selectEntity(path, pmb, entityType);
     * urlQueueBhv.outideSql().traditionalStyle().selectList(path, pmb, entityType);
     * urlQueueBhv.outideSql().traditionalStyle().selectPage(path, pmb, entityType);
     * urlQueueBhv.outideSql().traditionalStyle().selectPagedListOnly(path, pmb, entityType);
     * urlQueueBhv.outideSql().traditionalStyle().selectCursor(path, pmb, handler);
     * urlQueueBhv.outideSql().traditionalStyle().execute(path, pmb);
     *
     * // options 
     * urlQueueBhv.outideSql().removeBlockComment().selectList()
     * urlQueueBhv.outideSql().removeLineComment().selectList()
     * urlQueueBhv.outideSql().formatSql().selectList()
     * 
*

The invoker of behavior command should be not null when you call this method.

* @return The new-created all facade executor of outside-SQL. (NotNull) */ public OutsideSqlAllFacadeExecutor outsideSql() { return doOutsideSql(); } // =================================================================================== // Type Helper // =========== protected Class typeOfSelectedEntity() { return UrlQueue.class; } protected Class typeOfHandlingEntity() { return UrlQueue.class; } protected Class typeOfHandlingConditionBean() { return UrlQueueCB.class; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy