當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityCondition.checkCondition方法代碼示例

本文整理匯總了Java中org.ofbiz.entity.condition.EntityCondition.checkCondition方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityCondition.checkCondition方法的具體用法?Java EntityCondition.checkCondition怎麽用?Java EntityCondition.checkCondition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.ofbiz.entity.condition.EntityCondition的用法示例。


在下文中一共展示了EntityCondition.checkCondition方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findListIteratorByCondition

import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
@Override
public EntityListIterator findListIteratorByCondition(DynamicViewEntity dynamicViewEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException {

    // if there is no transaction throw an exception, we don't want to create a transaction here since closing it would mess up the ELI
    if (!TransactionUtil.isTransactionInPlace()) {
        //throw new GenericEntityException("ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.");

        //throwing an exception is a little harsh for now, just display a really big error message since we want to get all of these fixed...
        Exception newE = new Exception("Stack Trace");
        Debug.logError(newE, "ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.", module);
    }

    ModelViewEntity modelViewEntity = dynamicViewEntity.makeModelViewEntity(this);
    if (whereEntityCondition != null) whereEntityCondition.checkCondition(modelViewEntity);
    if (havingEntityCondition != null) havingEntityCondition.checkCondition(modelViewEntity);

    GenericHelper helper = getEntityHelper(dynamicViewEntity.getOneRealEntityName());
    EntityListIterator eli = helper.findListIteratorByCondition(this, modelViewEntity, whereEntityCondition,
            havingEntityCondition, fieldsToSelect, orderBy, findOptions);
    eli.setDelegator(this);
    //TODO: add decrypt fields
    return eli;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:24,代碼來源:GenericDelegator.java

示例2: find

import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
@Override
public EntityListIterator find(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException {

    // if there is no transaction throw an exception, we don't want to create a transaction here since closing it would mess up the ELI
    if (!TransactionUtil.isTransactionInPlace()) {
        //throw new GenericEntityException("ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.");

        //throwing an exception is a little harsh for now, just display a really big error message since we want to get all of these fixed...
        Exception newE = new Exception("Stack Trace");
        Debug.logError(newE, "ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.", module);
    }

    ModelEntity modelEntity = getModelReader().getModelEntity(entityName);
    GenericValue dummyValue = GenericValue.create(modelEntity);
    EntityEcaRuleRunner<?> ecaRunner = this.getEcaRuleRunner(modelEntity.getEntityName());
    ecaRunner.evalRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, dummyValue, false);

    if (whereEntityCondition != null) {
        whereEntityCondition.checkCondition(modelEntity);
    }
    if (havingEntityCondition != null) {
        havingEntityCondition.checkCondition(modelEntity);
    }

    ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, dummyValue, false);
    GenericHelper helper = getEntityHelper(modelEntity.getEntityName());
    EntityListIterator eli = helper.findListIteratorByCondition(this, modelEntity, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderBy, findOptions);
    eli.setDelegator(this);

    ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, dummyValue, false);
    return eli;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:33,代碼來源:GenericDelegator.java

示例3: findCountByCondition

import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
@Override
public long findCountByCondition(String entityName, EntityCondition whereEntityCondition,
        EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException {

    boolean beganTransaction = false;
    try {
        if (alwaysUseTransaction) {
            beganTransaction = TransactionUtil.begin();
        }

        ModelEntity modelEntity = getModelReader().getModelEntity(entityName);
        GenericValue dummyValue = GenericValue.create(modelEntity);
        EntityEcaRuleRunner<?> ecaRunner = this.getEcaRuleRunner(modelEntity.getEntityName());
        ecaRunner.evalRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, dummyValue, false);

        if (whereEntityCondition != null) {
            whereEntityCondition.checkCondition(modelEntity);
        }
        if (havingEntityCondition != null) {
            havingEntityCondition.checkCondition(modelEntity);
        }

        ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, dummyValue, false);
        GenericHelper helper = getEntityHelper(modelEntity.getEntityName());
        long count = helper.findCountByCondition(this, modelEntity, whereEntityCondition, havingEntityCondition, findOptions);

        ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, dummyValue, false);
        TransactionUtil.commit(beganTransaction);
        return count;
    } catch (Exception e) {
        String errMsg = "Failure in findListIteratorByCondition operation for entity [DynamicView]: " + e.toString() + ". Rolling back transaction.";
        Debug.logError(e, errMsg, module);
        TransactionUtil.rollback(beganTransaction, errMsg, e);
        throw new GenericEntityException(e);
    }
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:37,代碼來源:GenericDelegator.java


注:本文中的org.ofbiz.entity.condition.EntityCondition.checkCondition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。