本文整理匯總了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;
}
示例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;
}
示例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);
}
}