当前位置: 首页>>代码示例>>Java>>正文


Java EntityCondition类代码示例

本文整理汇总了Java中org.ofbiz.entity.condition.EntityCondition的典型用法代码示例。如果您正苦于以下问题:Java EntityCondition类的具体用法?Java EntityCondition怎么用?Java EntityCondition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityCondition类属于org.ofbiz.entity.condition包,在下文中一共展示了EntityCondition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAvailableBalance

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
/**
  * Returns the net balance (see above) minus the sum of all authorization amounts which are not expired and were authorized by the as of date
  * @param finAccountId the financial account id
  * @param asOfDateTime the validity date
  * @param delegator the delegator
  * @return returns the net balance (see above) minus the sum of all authorization amounts which are not expired
  * @throws GenericEntityException
  */
public static BigDecimal getAvailableBalance(String finAccountId, Timestamp asOfDateTime, Delegator delegator) throws GenericEntityException {
    if (asOfDateTime == null) asOfDateTime = UtilDateTime.nowTimestamp();

    BigDecimal netBalance = getBalance(finAccountId, asOfDateTime, delegator);

    // find sum of all authorizations which are not expired and which were authorized before as of time
    List<GenericValue> authSums = EntityQuery.use(delegator)
            .select("amount")
            .from("FinAccountAuthSum")
            .where(EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId),
                    EntityCondition.makeCondition("authorizationDate", EntityOperator.LESS_THAN_EQUAL_TO, asOfDateTime))
            .queryList();

    BigDecimal authorizationsTotal = addFirstEntryAmount(ZERO, authSums, "amount", (decimals+1), rounding);

    // the total available balance is transactions total minus authorizations total
    return netBalance.subtract(authorizationsTotal).setScale(decimals, rounding);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:27,代码来源:FinAccountHelper.java

示例2: findUsersByPageRole

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
/**
 * Finds users currently authorized for the given page with the given role - only those 
 * named individually in the page authorization. Does not attempt to get all users from all allowed groups.
 * 
 * @param page
 * @param role
 * @return
 */
public static List<GenericValue> findUsersByPageRole(Delegator delegator, CmsPage page, UserRole role, boolean useCache) {
    List<GenericValue> users = null;
    try {
        List<EntityCondition> conds = new ArrayList<>();
        conds.add(EntityCondition.makeCondition("pageId", page.getId()));
        conds.add(EntityCondition.makeCondition("roleTypeId", role.toString()));
        conds.add(PageAuthPartyType.USER.makeExclusiveNonNullCond());
        EntityCondition whereCond = EntityCondition.makeCondition(conds, EntityOperator.AND);
        users = delegator.findList("CmsPageAuthorization", whereCond, null, null, null, useCache);
    } catch (GenericEntityException e) {
        throw new CmsException("Could not retrieve users with page role. Page: " + page.getName() + " Role:"
                + role.toString(), e);
    }
    return users;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:24,代码来源:CmsPage.java

示例3: getProductFeaturesByApplTypeId

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
public static List<GenericValue> getProductFeaturesByApplTypeId(GenericValue product, String productFeatureApplTypeId) {
    if (product == null) {
        return null;
    }
    List<GenericValue> features = null;
    try {
        List<GenericValue> productAppls;
        List<EntityCondition> condList = UtilMisc.toList(
                EntityCondition.makeCondition("productId", product.getString("productId")),
                EntityUtil.getFilterByDateExpr()
        );
        if (productFeatureApplTypeId != null) {
            condList.add(EntityCondition.makeCondition("productFeatureApplTypeId", productFeatureApplTypeId));
        }
        EntityCondition cond = EntityCondition.makeCondition(condList);
        productAppls = product.getDelegator().findList("ProductFeatureAppl", cond, null, null, null, false);
        features = EntityUtil.getRelated("ProductFeature", null, productAppls, false);
        features = EntityUtil.orderBy(features, UtilMisc.toList("description"));
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
        features = FastList.newInstance();
    }
    return features;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:ProductWorker.java

示例4: addConstraint

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
@Override
public void addConstraint(ProductSearchContext context) {
    String entityAlias = "PSPP" + context.index;
    String prefix = "PSPP" + context.index;
    context.dynamicViewEntity.addMemberEntity(entityAlias, "ProductPrice");

    context.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductPriceTypeId", "productPriceTypeId", null, null, null, null);
    context.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductPricePurposeId", "productPricePurposeId", null, null, null, null);
    context.dynamicViewEntity.addAlias(entityAlias, prefix + "CurrencyUomId", "currencyUomId", null, null, null, null);
    context.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductStoreGroupId", "productStoreGroupId", null, null, null, null);
    context.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null);
    context.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null);

    context.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));

    context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, productPriceTypeId));
    context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE"));
    context.entityConditionList.add(EntityCondition.makeCondition(prefix + "CurrencyUomId", EntityOperator.EQUALS, currencyUomId));
    context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductStoreGroupId", EntityOperator.EQUALS, productStoreGroupId));
    context.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, context.nowTimestamp)));
    context.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, context.nowTimestamp));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:ProductSearch.java

示例5: findAll

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
/**
 * Returns all versions of a page starting with the most recent.
 * 
 * @param pageId
 * @return
 */
public List<CmsPageVersion> findAll(Delegator delegator, String pageId, boolean useCache) {
    List<CmsPageVersion> versions = new ArrayList<>();
    try {
        EntityFindOptions efo = new EntityFindOptions();
        efo.setFetchSize(1);
        EntityCondition ec = EntityCondition.makeCondition("pageId",
                EntityOperator.EQUALS, pageId);
        List<GenericValue> values = (List<GenericValue>) delegator
                .findList("CmsPageVersion", ec, null,
                        UtilMisc.toList("createdStamp DESC"), efo, useCache);

        for (GenericValue v : values) {
            versions.add(new CmsPageVersion(v));
        }
    } catch (GenericEntityException e) {
        throw new CmsException(
                "Could not retrieve page version. Page Id: " + pageId, e);
    }

    return versions;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:CmsPageVersion.java

示例6: getOutstandingPurchaseOrders

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
/**
 * Finds all outstanding Purchase orders for a productId.  The orders and the items cannot be completed, cancelled, or rejected
 * @param productId the product id
 * @param delegator the delegator
 * @return returns all outstanding Purchase orders for a productId
 */
public static List<GenericValue> getOutstandingPurchaseOrders(String productId, Delegator delegator) {
    try {
        List<EntityCondition> purchaseOrderConditions = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"),
                EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
                EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
                EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"),
                EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"),
                EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"));
        purchaseOrderConditions.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER"));
        purchaseOrderConditions.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId));
        List<GenericValue> purchaseOrders = EntityQuery.use(delegator).from("OrderHeaderAndItems")
                .where(EntityCondition.makeCondition(purchaseOrderConditions, EntityOperator.AND))
                .orderBy("estimatedDeliveryDate DESC", "orderDate")
                .queryList();
        return purchaseOrders;
    } catch (GenericEntityException ex) {
        Debug.logError("Unable to find outstanding purchase orders for product [" + productId + "] due to " + ex.getMessage() + " - returning null", module);
        return null;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:27,代码来源:InventoryWorker.java

示例7: isCategoryContainsProduct

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
/**
 * SCIPIO: Returns true only if the category ID is a top category.
 * <p>
 * NOTE: is caching
 */
public static boolean isCategoryContainsProduct(Delegator delegator, LocalDispatcher dispatcher, String productCategoryId, String productId) {
    if (UtilValidate.isEmpty(productCategoryId) || UtilValidate.isEmpty(productId)) {
        return false;
    }
    try {
        List<EntityCondition> conds = FastList.newInstance();
        conds.add(EntityCondition.makeCondition("productCategoryId", productCategoryId));
        conds.add(EntityCondition.makeCondition("productId", productId));
        List<GenericValue> productCategoryMembers = EntityQuery.use(delegator).select("productCategoryId").from("ProductCategoryMember")
                .where(conds).filterByDate().cache(true).queryList();
        return !productCategoryMembers.isEmpty();
    } catch (GenericEntityException e) {
        Debug.logWarning(e, module);
    }
    return false; // can't tell, return false to play it safe
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:CategoryWorker.java

示例8: getUserRolesFromList

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的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;
    }
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:EntityPermissionChecker.java

示例9: parseStateProvinceGeoId

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
private static String parseStateProvinceGeoId(String payPalShipToState, String countryGeoId, Delegator delegator) {
    String lookupField = "geoName";
    List<EntityCondition> conditionList = FastList.newInstance();
    conditionList.add(EntityCondition.makeCondition("geoAssocTypeId", "REGIONS"));
    if ("USA".equals(countryGeoId) || "CAN".equals(countryGeoId)) {
        // PayPal returns two letter code for US and Canadian States/Provinces
        String geoTypeId = "USA".equals(countryGeoId) ? "STATE" : "PROVINCE";
        conditionList.add(EntityCondition.makeCondition("geoTypeId", geoTypeId));
        lookupField = "geoCode";
    }
    conditionList.add(EntityCondition.makeCondition("geoIdFrom", countryGeoId));
    conditionList.add(EntityCondition.makeCondition(lookupField, payPalShipToState));
    EntityCondition cond = EntityCondition.makeCondition(conditionList);
    GenericValue geoAssocAndGeoTo = null;
    try {
        geoAssocAndGeoTo = EntityQuery.use(delegator).from("GeoAssocAndGeoTo").where(cond).cache().queryFirst();
        
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }
    if (geoAssocAndGeoTo != null) {
        return geoAssocAndGeoTo.getString("geoId");
    }
    return null;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:26,代码来源:PayPalServices.java

示例10: getInvoiceUnattributedTaxTotal

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的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();
         invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem")
                 .where(EntityCondition.makeCondition("invoiceId", invoice.get("invoiceId")),
                         EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)),
                         EntityCondition.makeCondition("taxAuthPartyId", null)
                 ).queryList();
     } catch (GenericEntityException e) {
         Debug.logError(e, "Trouble getting InvoiceItem list", module);
         return null;
     }
    return getTaxTotalForInvoiceItems(invoiceTaxItems);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:20,代码来源:InvoiceWorker.java

示例11: makeDateCondition

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
private EntityCondition makeDateCondition() {
    List<EntityCondition> conditions = new ArrayList<EntityCondition>();
    if (UtilValidate.isEmpty(this.filterByFieldNames)) {
        this.filterByDate(filterByDateMoment, "fromDate", "thruDate");
    }

    for (int i = 0; i < this.filterByFieldNames.size();) {
        String fromDateFieldName = this.filterByFieldNames.get(i++);
        String thruDateFieldName = this.filterByFieldNames.get(i++);
        if (filterByDateMoment == null) {
            conditions.add(EntityUtil.getFilterByDateExpr(fromDateFieldName, thruDateFieldName));
        } else {
            conditions.add(EntityUtil.getFilterByDateExpr(this.filterByDateMoment, fromDateFieldName, thruDateFieldName));
        }
    }
    return EntityCondition.makeCondition(conditions);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:EntityQuery.java

示例12: getGlExchangeRateOfOutgoingPayment

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
public static BigDecimal getGlExchangeRateOfOutgoingPayment(GenericValue paymentApplication) throws GenericEntityException {
    BigDecimal exchangeRate = BigDecimal.ONE;
    Delegator delegator = paymentApplication.getDelegator();
    List andConditions = UtilMisc.toList(
            EntityCondition.makeCondition("glAccountTypeId", "CURRENT_ASSET"),
            EntityCondition.makeCondition("debitCreditFlag", "C"),
            EntityCondition.makeCondition("acctgTransTypeId", "OUTGOING_PAYMENT"),
            EntityCondition.makeCondition("paymentId", paymentApplication.getString("paymentId")));
    EntityCondition whereCondition = EntityCondition.makeCondition(andConditions, EntityJoinOperator.AND);
    GenericValue amounts = EntityQuery.use(delegator).select("origAmount", "amount").from("AcctgTransAndEntries").where(whereCondition).queryFirst();
    if (amounts == null) {
        return exchangeRate;
    }
    BigDecimal origAmount = amounts.getBigDecimal("origAmount");
    BigDecimal amount = amounts.getBigDecimal("amount");
    if (origAmount != null && amount != null && BigDecimal.ZERO.compareTo(origAmount) != 0 && BigDecimal.ZERO.compareTo(amount) != 0 && amount.compareTo(origAmount) != 0) {
        exchangeRate = amount.divide(origAmount, UtilNumber.getBigDecimalScale("ledger.decimals"), UtilNumber.getBigDecimalRoundingMode("invoice.rounding"));
    }
    return exchangeRate;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:21,代码来源:UtilAccounting.java

示例13: getOrderHeaderAdjustments

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的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;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:OrderReadHelper.java

示例14: filterByOr

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
/**
 *returns the values that match any of the exprs in list
 *
 *@param values List of GenericValues
 *@param exprs the expressions that must validate to true
 *@return List of GenericValue's that match the values in fields
 */
public static <T extends GenericEntity> List<T> filterByOr(List<T> values, List<? extends EntityCondition> exprs) {
    if (values == null) return null;
    if (UtilValidate.isEmpty(exprs)) {
        return values;
    }

    List<T> result = new LinkedList<T>();
    for (T value: values) {
        boolean include = false;

        for (EntityCondition condition: exprs) {
            include = condition.entityMatches(value);
            if (include) break;
        }
        if (include) {
            result.add(value);
        }
    }
    return result;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:EntityUtil.java

示例15: getItemReceivedQuantity

import org.ofbiz.entity.condition.EntityCondition; //导入依赖的package包/类
public BigDecimal getItemReceivedQuantity(GenericValue orderItem) {
    BigDecimal totalReceived = BigDecimal.ZERO;
    try {
        if (UtilValidate.isNotEmpty(orderItem)) {
            EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("orderId", orderItem.getString("orderId")),
                    EntityCondition.makeCondition("quantityAccepted", EntityOperator.GREATER_THAN, BigDecimal.ZERO),
                    EntityCondition.makeCondition("orderItemSeqId", orderItem.getString("orderItemSeqId"))));
            Delegator delegator = orderItem.getDelegator();
            List<GenericValue> shipmentReceipts = EntityQuery.use(delegator).select("quantityAccepted", "quantityRejected").from("ShipmentReceiptAndItem")
                    .where(cond).queryList();
            for (GenericValue shipmentReceipt : shipmentReceipts) {
                if (shipmentReceipt.getBigDecimal("quantityAccepted") != null)
                    totalReceived = totalReceived.add(shipmentReceipt.getBigDecimal("quantityAccepted"));
                if (shipmentReceipt.getBigDecimal("quantityRejected") != null)
                    totalReceived = totalReceived.add(shipmentReceipt.getBigDecimal("quantityRejected"));
            }
        }
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }
    return totalReceived;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:OrderReadHelper.java


注:本文中的org.ofbiz.entity.condition.EntityCondition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。