本文整理汇总了Java中org.ofbiz.entity.condition.EntityExpr类的典型用法代码示例。如果您正苦于以下问题:Java EntityExpr类的具体用法?Java EntityExpr怎么用?Java EntityExpr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityExpr类属于org.ofbiz.entity.condition包,在下文中一共展示了EntityExpr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBillingAccountMaxAmount
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
* Returns the OrderPaymentPreference.maxAmount for the billing account
* associated with the order, or 0 if there is no billing account or no max
* amount set
*/
public BigDecimal getBillingAccountMaxAmount() {
if (getBillingAccount() == null) {
return BigDecimal.ZERO;
} else {
List<GenericValue> paymentPreferences = null;
try {
Delegator delegator = orderHeader.getDelegator();
paymentPreferences = EntityQuery.use(delegator).from("OrderPurchasePaymentSummary").where("orderId", orderHeader.get("orderId")).queryList();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("paymentMethodTypeId", "EXT_BILLACT"),
EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED"));
GenericValue billingAccountPaymentPreference = EntityUtil.getFirst(EntityUtil.filterByAnd(paymentPreferences, exprs));
if ((billingAccountPaymentPreference != null) && (billingAccountPaymentPreference.getBigDecimal("maxAmount") != null)) {
return billingAccountPaymentPreference.getBigDecimal("maxAmount");
} else {
return BigDecimal.ZERO;
}
}
}
示例2: getItemPickedQuantityBd
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public BigDecimal getItemPickedQuantityBd(GenericValue orderItem) {
BigDecimal quantityPicked = ZERO;
EntityConditionList<EntityExpr> pickedConditions = EntityCondition
.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderItem.get("orderId")),
EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItem.getString("orderItemSeqId")),
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PICKLIST_CANCELLED")), EntityOperator.AND);
List<GenericValue> picked = null;
try {
picked = orderHeader.getDelegator().findList("PicklistAndBinAndItem", pickedConditions, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
this.orderHeader = null;
}
if (picked != null) {
for (GenericValue pickedItem : picked) {
BigDecimal issueQty = pickedItem.getBigDecimal("quantity");
if (issueQty != null) {
quantityPicked = quantityPicked.add(issueQty).setScale(scale, rounding);
}
}
}
return quantityPicked.setScale(scale, rounding);
}
示例3: getOrderHeaderAdjustments
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public static List<GenericValue> getOrderHeaderAdjustments(List<GenericValue> adjustments, String shipGroupSeqId) {
List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null));
List<EntityExpr> contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
List<EntityExpr> contraints3 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, ""));
List<EntityExpr> contraints4 = FastList.newInstance();
if (shipGroupSeqId != null) {
contraints4.add(EntityCondition.makeCondition("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId));
}
List<GenericValue> toFilter = null;
List<GenericValue> adj = FastList.newInstance();
if (shipGroupSeqId != null) {
toFilter = EntityUtil.filterByAnd(adjustments, contraints4);
} else {
toFilter = adjustments;
}
adj.addAll(EntityUtil.filterByAnd(toFilter, contraints1));
adj.addAll(EntityUtil.filterByAnd(toFilter, contraints2));
adj.addAll(EntityUtil.filterByAnd(toFilter, contraints3));
return adj;
}
示例4: ownAndCollectJobs
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
* SCIPIO: Takes ownership of job and adds to list.
* <p>
* Factored out from {@link #poll}.
*/
protected void ownAndCollectJobs(DispatchContext dctx, Delegator delegator, int limit,
EntityListIterator jobsIterator, List<Job> poll) throws GenericEntityException {
if (limit < 0 || poll.size() < limit) {
GenericValue jobValue = jobsIterator.next();
while (jobValue != null) {
// Claim ownership of this value. Using storeByCondition to avoid a race condition.
List<EntityExpr> updateExpression = UtilMisc.toList(EntityCondition.makeCondition("jobId", EntityOperator.EQUALS, jobValue.get("jobId")), EntityCondition.makeCondition("runByInstanceId", EntityOperator.EQUALS, null));
int rowsUpdated = delegator.storeByCondition("JobSandbox", UtilMisc.toMap("runByInstanceId", instanceId), EntityCondition.makeCondition(updateExpression));
if (rowsUpdated == 1) {
poll.add(new PersistedServiceJob(dctx, jobValue, null));
if (limit >= 0 && poll.size() == limit) { // SCIPIO: modified to support limit = -1
break;
}
}
jobValue = jobsIterator.next();
}
}
}
示例5: getUserRolesFromList
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public static List<String> getUserRolesFromList(Delegator delegator, List<String> idList, String partyId, String entityIdFieldName, String partyIdFieldName, String roleTypeIdFieldName, String entityName) throws GenericEntityException {
EntityExpr expr = EntityCondition.makeCondition(entityIdFieldName, EntityOperator.IN, idList);
EntityExpr expr2 = EntityCondition.makeCondition(partyIdFieldName, partyId);
List<GenericValue> roleList = EntityQuery.use(delegator)
.from(entityName)
.where(EntityCondition.makeCondition(UtilMisc.toList(expr, expr2)))
.cache(true)
.queryList();
List<GenericValue> roleListFiltered = EntityUtil.filterByDate(roleList);
Set<String> distinctSet = new HashSet<String>();
for (GenericValue contentRole: roleListFiltered) {
String roleTypeId = contentRole.getString(roleTypeIdFieldName);
distinctSet.add(roleTypeId);
}
List<String> distinctList = Arrays.asList(distinctSet.toArray(new String[distinctSet.size()]));
return distinctList;
}
示例6: getFilterByPeriodExpr
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
* Method to get a condition that checks that the given fieldName is in a given timePeriod.
*/
public static EntityCondition getFilterByPeriodExpr(String fieldName, GenericValue timePeriod) {
Timestamp fromDate;
Timestamp thruDate;
if (timePeriod.get("fromDate") instanceof Timestamp) {
fromDate = timePeriod.getTimestamp("fromDate");
thruDate = timePeriod.getTimestamp("thruDate");
} else {
fromDate = UtilDateTime.toTimestamp(timePeriod.getDate("fromDate"));
thruDate = UtilDateTime.toTimestamp(timePeriod.getDate("thruDate"));
}
EntityConditionList<EntityExpr> betweenCondition = EntityCondition.makeCondition(
EntityCondition.makeCondition(fieldName, EntityOperator.GREATER_THAN, fromDate),
EntityCondition.makeCondition(fieldName, EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
return EntityCondition.makeCondition(EntityCondition.makeCondition(fieldName, EntityOperator.NOT_EQUAL, null), betweenCondition);
}
示例7: getBillingAccountMaxAmount
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
* Returns the OrderPaymentPreference.maxAmount for the billing account associated with the order, or 0 if there is no
* billing account or no max amount set
*/
public BigDecimal getBillingAccountMaxAmount() {
if (getBillingAccount() == null) {
return BigDecimal.ZERO;
} else {
List<GenericValue> paymentPreferences = null;
try {
Delegator delegator = orderHeader.getDelegator();
paymentPreferences = delegator.findByAnd("OrderPurchasePaymentSummary", UtilMisc.toMap("orderId", orderHeader.getString("orderId")), null, false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
List<EntityExpr> exprs = UtilMisc.toList(
EntityCondition.makeCondition("paymentMethodTypeId", "EXT_BILLACT"),
EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED"));
GenericValue billingAccountPaymentPreference = EntityUtil.getFirst(EntityUtil.filterByAnd(paymentPreferences, exprs));
if ((billingAccountPaymentPreference != null) && (billingAccountPaymentPreference.getBigDecimal("maxAmount") != null)) {
return billingAccountPaymentPreference.getBigDecimal("maxAmount");
} else {
return BigDecimal.ZERO;
}
}
}
示例8: getItemPickedQuantityBd
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public BigDecimal getItemPickedQuantityBd(GenericValue orderItem) {
BigDecimal quantityPicked = ZERO;
EntityConditionList<EntityExpr> pickedConditions = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderItem.get("orderId")),
EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItem.getString("orderItemSeqId")),
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PICKLIST_CANCELLED")),
EntityOperator.AND);
List<GenericValue> picked = null;
try {
picked = orderHeader.getDelegator().findList("PicklistAndBinAndItem", pickedConditions, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
this.orderHeader = null;
}
if (picked != null) {
for(GenericValue pickedItem : picked) {
BigDecimal issueQty = pickedItem.getBigDecimal("quantity");
if (issueQty != null) {
quantityPicked = quantityPicked.add(issueQty).setScale(scale, rounding);
}
}
}
return quantityPicked.setScale(scale, rounding);
}
示例9: findSubNodes
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public static Map<String, Object> findSubNodes(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
Map<String, Object> results = FastMap.newInstance();
Delegator delegator = dctx.getDelegator();
String contentIdTo = (String)context.get("contentId");
List<EntityExpr> condList = FastList.newInstance();
EntityExpr expr = EntityCondition.makeCondition("caContentIdTo", EntityOperator.EQUALS, contentIdTo);
condList.add(expr);
expr = EntityCondition.makeCondition("caContentAssocTypeId", EntityOperator.EQUALS, "SUB_CONTENT");
condList.add(expr);
expr = EntityCondition.makeCondition("caThruDate", EntityOperator.EQUALS, null);
condList.add(expr);
EntityConditionList<EntityExpr> entityCondList = EntityCondition.makeCondition(condList, EntityOperator.AND);
try {
List<GenericValue> lst = delegator.findList("ContentAssocDataResourceViewFrom", entityCondList, null, UtilMisc.toList("caSequenceNum", "caFromDate", "createdDate"), null, false);
results.put("_LIST_", lst);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.toString());
}
return results;
}
示例10: renderSubContentAsText
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public static void renderSubContentAsText(LocalDispatcher dispatcher, Delegator delegator, String contentId, Appendable out, String mapKey,
Map<String,Object> templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException {
// find the sub-content with matching mapKey
List<String> orderBy = UtilMisc.toList("-fromDate");
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId));
if (UtilValidate.isNotEmpty(mapKey)) {
exprs.add(EntityCondition.makeCondition("mapKey", EntityOperator.EQUALS, mapKey));
}
List<GenericValue> assocs;
assocs = delegator.findList("ContentAssoc", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, orderBy, null, cache);
assocs = EntityUtil.filterByDate(assocs);
GenericValue subContent = EntityUtil.getFirst(assocs);
if (subContent == null) {
//throw new GeneralException("No sub-content found with map-key [" + mapKey + "] for content [" + contentId + "]");
Debug.logWarning("No sub-content found with map-key [" + mapKey + "] for content [" + contentId + "]", module);
} else {
String subContentId = subContent.getString("contentIdTo");
templateContext.put("mapKey", mapKey);
renderContentAsText(dispatcher, delegator, subContentId, out, templateContext, locale, mimeTypeId, null, null, cache);
}
}
示例11: getInvoiceTaxTotalForTaxAuthPartyAndGeo
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
* @param invoice GenericValue object representing the invoice
* @param taxAuthPartyId
* @param taxAuthGeoId
* @return The invoice tax total for a given tax authority and geo location
*/
public static BigDecimal getInvoiceTaxTotalForTaxAuthPartyAndGeo(GenericValue invoice, String taxAuthPartyId, String taxAuthGeoId) {
List<GenericValue> invoiceTaxItems = null;
try {
Delegator delegator = invoice.getDelegator();
EntityConditionList<EntityExpr> condition = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")),
EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)),
EntityCondition.makeCondition("taxAuthPartyId", taxAuthPartyId),
EntityCondition.makeCondition("taxAuthGeoId", taxAuthGeoId)),
EntityOperator.AND);
invoiceTaxItems = delegator.findList("InvoiceItem", condition, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting InvoiceItem list", module);
return null;
}
return getTaxTotalForInvoiceItems(invoiceTaxItems);
}
示例12: getInvoiceUnattributedTaxTotal
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/** Returns the invoice tax total for unattributed tax items, that is items which have no taxAuthPartyId value
* @param invoice GenericValue object representing the invoice
* @return Returns the invoice tax total for unattributed tax items
*/
public static BigDecimal getInvoiceUnattributedTaxTotal(GenericValue invoice) {
List<GenericValue> invoiceTaxItems = null;
try {
Delegator delegator = invoice.getDelegator();
EntityConditionList<EntityExpr> condition = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")),
EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)),
EntityCondition.makeCondition("taxAuthPartyId", null)),
EntityOperator.AND);
invoiceTaxItems = delegator.findList("InvoiceItem", condition, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting InvoiceItem list", module);
return null;
}
return getTaxTotalForInvoiceItems(invoiceTaxItems);
}
示例13: lookupRoutingTask
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
*
* Used to retrieve some RoutingTasks (WorkEffort) selected by Name or MachineGroup ordered by Name
*
* @param ctx the dispatch context
* @param context a map containing workEffortName (routingTaskName) and fixedAssetId (MachineGroup or ANY)
* @return result a map containing lookupResult (list of RoutingTask <=> workEffortId with currentStatusId = "ROU_ACTIVE" and workEffortTypeId = "ROU_TASK"
*/
public static Map<String, Object> lookupRoutingTask(DispatchContext ctx, Map<String, ? extends Object> context) {
Delegator delegator = ctx.getDelegator();
Map<String, Object> result = FastMap.newInstance();
Locale locale = (Locale) context.get("locale");
String workEffortName = (String) context.get("workEffortName");
String fixedAssetId = (String) context.get("fixedAssetId");
List<GenericValue> listRoutingTask = null;
List<EntityExpr> constraints = FastList.newInstance();
if (UtilValidate.isNotEmpty(workEffortName)) {
constraints.add(EntityCondition.makeCondition("workEffortName", EntityOperator.GREATER_THAN_EQUAL_TO, workEffortName));
}
if (UtilValidate.isNotEmpty(fixedAssetId) && ! "ANY".equals(fixedAssetId)) {
constraints.add(EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId));
}
constraints.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "ROU_ACTIVE"));
constraints.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "ROU_TASK"));
try {
listRoutingTask = EntityQuery.use(delegator).from("WorkEffort")
.where(constraints)
.orderBy("workEffortName")
.queryList();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingTechDataWorkEffortNotExist", UtilMisc.toMap("errorString", e.toString()), locale));
}
if (listRoutingTask == null) {
listRoutingTask = FastList.newInstance();
}
if (listRoutingTask.size() == 0) {
//FIXME is it correct ?
// listRoutingTask.add(UtilMisc.toMap("label","no Match","value","NO_MATCH"));
}
result.put("lookupResult", listRoutingTask);
return result;
}
示例14: getAssociatedPartyIdsByRelationshipType
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
public static List<String> getAssociatedPartyIdsByRelationshipType(Delegator delegator, String partyIdFrom, String partyRelationshipTypeId) {
List<GenericValue> partyList = FastList.newInstance();
List<String> partyIds = null;
try {
EntityConditionList<EntityExpr> baseExprs = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("partyIdFrom", partyIdFrom),
EntityCondition.makeCondition("partyRelationshipTypeId", partyRelationshipTypeId)), EntityOperator.AND);
List<GenericValue> associatedParties = EntityQuery.use(delegator).from("PartyRelationship").where(baseExprs).cache(true).queryList();
partyList.addAll(associatedParties);
while (UtilValidate.isNotEmpty(associatedParties)) {
List<GenericValue> currentAssociatedParties = FastList.newInstance();
for (GenericValue associatedParty : associatedParties) {
EntityConditionList<EntityExpr> innerExprs = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("partyIdFrom", associatedParty.get("partyIdTo")),
EntityCondition.makeCondition("partyRelationshipTypeId", partyRelationshipTypeId)), EntityOperator.AND);
List<GenericValue> associatedPartiesChilds = EntityQuery.use(delegator).from("PartyRelationship").where(innerExprs).cache(true).queryList();
if (UtilValidate.isNotEmpty(associatedPartiesChilds)) {
currentAssociatedParties.addAll(associatedPartiesChilds);
}
partyList.add(associatedParty);
}
associatedParties = currentAssociatedParties;
}
partyIds = EntityUtil.getFieldListFromEntityList(partyList, "partyIdTo", true);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
return partyIds;
}
示例15: getOrderPaymentReceivedTotalByType
import org.ofbiz.entity.condition.EntityExpr; //导入依赖的package包/类
/**
* Get the total payment received amount by payment type. Specify null to
* get amount over all types. This method works by going through all the
* PaymentAndApplications for all order Invoices that have status
* PMNT_RECEIVED.
*/
public BigDecimal getOrderPaymentReceivedTotalByType(String paymentMethodTypeId) {
BigDecimal total = ZERO;
try {
// get a set of invoice IDs that belong to the order
List<GenericValue> orderItemBillings = orderHeader.getRelated("OrderItemBilling", null, null, true);
Set<String> invoiceIds = new HashSet<String>();
for (GenericValue orderItemBilling : orderItemBillings) {
invoiceIds.add(orderItemBilling.getString("invoiceId"));
}
// get the payments of the desired type for these invoices TODO: in
// models where invoices can have many orders, this needs to be
// refined
List<EntityExpr> conditions = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"),
EntityCondition.makeCondition("invoiceId", EntityOperator.IN, invoiceIds));
if (paymentMethodTypeId != null) {
conditions.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId));
}
EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
List<GenericValue> payments = orderHeader.getDelegator().findList("PaymentAndApplication", ecl, null, null, null, true);
for (GenericValue payment : payments) {
if (payment.get("amountApplied") == null)
continue;
total = total.add(payment.getBigDecimal("amountApplied")).setScale(scale, rounding);
}
} catch (GenericEntityException e) {
Debug.logError(e, e.getMessage(), module);
}
return total;
}