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


Java EntityCondition.makeCondition方法代码示例

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


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

示例1: AbstractDatevDataCategory

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public AbstractDatevDataCategory(Delegator delegator, DatevHelper datevHelper) throws DatevException {
    this.delegator = delegator;
    this.datevHelper = datevHelper;

    try {
        EntityCondition datevFieldCommonCond = EntityCondition.makeCondition("dataCategoryId", EntityJoinOperator.EQUALS,
                datevHelper.getDataCategory().getString("dataCategoryId"));

        this.datevFieldDefinitions = EntityQuery.use(delegator).from("DatevFieldDefinition").where(datevFieldCommonCond).queryList();
        this.datevFieldNames = EntityUtil.getFieldListFromEntityList(datevFieldDefinitions, "fieldName", true);
        
        List<String> datevFieldIds = EntityUtil.getFieldListFromEntityList(datevFieldDefinitions, "fieldId", true);
        Map<String, GenericValue> datevFieldMappingsByField = FastMap.newInstance();
        List<GenericValue> datevFieldMappings = EntityQuery.use(delegator).from("DatevFieldMapping").where(datevFieldCommonCond).queryList();
        for (String fieldId : datevFieldIds) {
            datevFieldMappingsByField.put(fieldId, EntityUtil.getFirst(EntityUtil.filterByAnd(datevFieldMappings, UtilMisc.toMap("fieldId", fieldId))));
        }
        this.datevFieldMappingsByField = datevFieldMappingsByField;

        this.datevMetadataFieldsDefinitions = EntityQuery.use(delegator).from("DatevMetadata").queryList();
    } catch (GenericEntityException e) {
        throw new DatevException("Internal error. Cannot initialize DATEV importer tool.", e);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:AbstractDatevDataCategory.java

示例2: testRemoveByPK

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public void testRemoveByPK() throws Exception {
    flushAndRecreateTree("remove-by-pk");
    //
    // Find all the root nodes,
    // delete them their primary key
    //
    EntityCondition isRoot = EntityCondition.makeCondition(
        EntityCondition.makeCondition("description", EntityOperator.LIKE, "remove-by-pk:%"),
        EntityOperator.AND,
        EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD)
    );
    List<GenericValue> rootValues = EntityQuery.use(delegator).select("testingNodeId").from("TestingNode").where(isRoot).queryList();

    for (GenericValue value: rootValues) {
        GenericPK pk = value.getPrimaryKey();
        int del = delegator.removeByPrimaryKey(pk);
        assertEquals("Removing Root by primary key", 1, del);
    }

    // no more TestingNode should be in the data base anymore.

    List<GenericValue> testingNodes = EntityQuery.use(delegator).from("TestingNode").where(isRoot).queryList();
    assertEquals("No more TestingNode after removing the roots", 0, testingNodes.size());
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:EntityTestSuite.java

示例3: 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

示例4: makeUserSecGroupsCond

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
private static EntityCondition makeUserSecGroupsCond(String userId, Delegator delegator, LocalDispatcher dispatcher) {
    // Get all the user's groups
    List<GenericValue> userSecGroups = CmsDataUtil.findUserLoginSecurityGroupByUserLoginId(delegator, userId);
    
    List<EntityCondition> userSecGroupsConds = new ArrayList<>();
    for(GenericValue userSecGroup : userSecGroups) {
        String groupId = userSecGroup.getString("groupId");
        userSecGroupsConds.add(PageAuthPartyType.GROUP.makeIdCond(groupId));
    }
    
    EntityCondition userSecGroupsCond = null;
    if (!userSecGroupsConds.isEmpty()) {
        // Make an OR condition to select all rows containing any one of the user's groups
        userSecGroupsCond = EntityCondition.makeCondition(userSecGroupsConds, EntityOperator.OR);
        
        // When making this condition, make sure it is exclusive; all other ID identifiers (userId, etc.) must be null for integrity/consistency
        userSecGroupsCond = EntityCondition.makeCondition(userSecGroupsCond, EntityOperator.AND,
                PageAuthPartyType.GROUP.makeAllOthersNullCond()
        );
    }

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

示例5: getItemPickedQuantityBd

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

示例6: getGlExchangeRateOfPurchaseInvoice

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public static BigDecimal getGlExchangeRateOfPurchaseInvoice(GenericValue paymentApplication) throws GenericEntityException {
    BigDecimal exchangeRate = BigDecimal.ONE;
    Delegator delegator = paymentApplication.getDelegator();
    List andConditions = UtilMisc.toList(
            EntityCondition.makeCondition("glAccountTypeId", "ACCOUNTS_PAYABLE"),
            EntityCondition.makeCondition("debitCreditFlag", "C"),
            EntityCondition.makeCondition("acctgTransTypeId", "PURCHASE_INVOICE"),
            EntityCondition.makeCondition("invoiceId", paymentApplication.getString("invoiceId")));
    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

示例7: getStateList

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public static List<GenericValue> getStateList(Delegator delegator) {
    List<GenericValue> geoList = new LinkedList<GenericValue>();
    EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "TERRITORY"),
            EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"));
    try {
        geoList = EntityQuery.use(delegator).from("Geo").where(condition).orderBy("geoName").cache(true).queryList();
    } catch (GenericEntityException e) {
        Debug.logError(e, "Cannot lookup State Geos: " + e.toString(), module);
    }
    return geoList;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:12,代码来源:CommonWorkers.java

示例8: getMappingsUnderControl

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
/**
 * Returns all process mapping source paths that are mapped (one way or another) to fall
 * under the /control path.
 * ONLY used if the ControlServlet is not mapped to root.
 * Highly depends on the sourceFromContextRoot flag.
 * Added 2017-11-15.
 */
public List<CmsProcessMapping> getMappingsUnderControl(Delegator delegator, String webSiteId, 
        String controlServletPath, String defaultSourceServletPath, boolean defaultSourceFromContextRoot, boolean useCache) {
    if (controlServletPath == null || controlServletPath.length() < 1) return Collections.emptyList();
    
    EntityCondition cond = EntityCondition.makeCondition(EntityCondition.makeCondition("sourceWebSiteId", webSiteId),
            EntityOperator.AND, 
            makeSourcePathStartsWithControlCond(controlServletPath, defaultSourceServletPath, defaultSourceFromContextRoot));
    
    return CmsProcessMapping.getWorker().findAll(delegator, cond, null, isUseDbCacheStatic(useCache));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:CmsProcessMapping.java

示例9: addEntityPkFilterConds

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public static void addEntityPkFilterConds(Delegator delegator, String entityName, Collection<String> pkValues, Map<String, EntityCondition> entityCondMap) throws IllegalArgumentException {
    String pkFieldName = EntityInfoUtil.getSinglePkFieldNameStrict(delegator, entityName);
    List<EntityCondition> condList = new ArrayList<>(pkValues.size());
    for(String pkValue : pkValues) {
        condList.add(EntityCondition.makeCondition(pkFieldName, pkValue));
    }
    EntityCondition cond = EntityCondition.makeCondition(condList, EntityOperator.OR);
    addToEntityCondMap(delegator, entityCondMap, entityName, cond);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:10,代码来源:CmsDataExportWorker.java

示例10: buildCountCondition

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
private static EntityCondition buildCountCondition(String fieldName, String fieldValue) {
    List<EntityCondition> orCondList = FastList.newInstance();
    orCondList.add(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, UtilDateTime.nowTimestamp()));
    orCondList.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null));
    EntityCondition orCond = EntityCondition.makeCondition(orCondList, EntityOperator.OR);

    List<EntityCondition> andCondList = FastList.newInstance();
    andCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, UtilDateTime.nowTimestamp()));
    andCondList.add(EntityCondition.makeCondition(fieldName, EntityOperator.EQUALS, fieldValue));
    andCondList.add(orCond);
    EntityCondition andCond = EntityCondition.makeCondition(andCondList, EntityOperator.AND);

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

示例11: doQuery

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public EntityListIterator doQuery(Delegator delegator) {
    // handle the now assembled or and and keyword fixed lists
    this.finishKeywordConstraints();

    if (resultSortOrder != null) {
        resultSortOrder.setSortOrder(this);
    }
    dynamicViewEntity.addAlias("CNT", "contentId", null, null, null, Boolean.valueOf(contentIdGroupBy), null);
    EntityCondition whereCondition = EntityCondition.makeCondition(entityConditionList, EntityOperator.AND);

    // Debug.logInfo("ContentSearch, whereCondition = " + whereCondition.toString(), module);

    EntityListIterator eli = null;
    try {
        // SCIPIO: prevent crash if maxResults == null
        //eli = EntityQuery.use(delegator)
        //        .select(fieldsToSelect).from(dynamicViewEntity)
        //        .where(whereCondition)
        //        .cursorScrollInsensitive()
        //        .distinct()
        //        .maxRows(maxResults)
        //        .queryIterator();
        EntityQuery query = EntityQuery.use(delegator)
                .select(fieldsToSelect).from(dynamicViewEntity)
                .where(whereCondition)
                .cursorScrollInsensitive()
                .distinct();
        if (maxResults != null) {
            query = query.maxRows(maxResults);
        }
        eli = query.queryIterator();
    } catch (GenericEntityException e) {
        Debug.logError(e, "Error in content search", module);
        return null;
    }

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

示例12: makeExpr

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
protected static EntityExpr makeExpr(String fieldName, String value, boolean forceLike) {
    EntityComparisonOperator<?, ?> op = forceLike ? EntityOperator.LIKE : EntityOperator.EQUALS;

    if (value.startsWith("*")) {
        op = EntityOperator.LIKE;
        value = "%" + value.substring(1);
    }
    else if (value.startsWith("%")) {
        op = EntityOperator.LIKE;
    }

    if (value.endsWith("*")) {
        op = EntityOperator.LIKE;
        value = value.substring(0, value.length() - 1) + "%";
    }
    else if (value.endsWith("%")) {
        op = EntityOperator.LIKE;
    }

    if (forceLike) {
        if (!value.startsWith("%")) {
            value = "%" + value;
        }
        if (!value.endsWith("%")) {
            value = value + "%";
        }
    }

    return EntityCondition.makeCondition(fieldName, op, value);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:31,代码来源:OrderLookupServices.java

示例13: makeFieldPossibleValuesCond

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
static EntityCondition makeFieldPossibleValuesCond(String fieldName, Collection<?> values) {
    //if (values == null || values.isEmpty()) return null;
    List<EntityCondition> condList = new ArrayList<>(values.size());
    for(Object value : values) {
        condList.add(EntityCondition.makeCondition(fieldName, value));
    }
    return EntityCondition.makeCondition(condList, EntityOperator.OR);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:9,代码来源:SitemapGenerator.java

示例14: makeExclusiveNonNullCond

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public EntityCondition makeExclusiveNonNullCond() { // All null except this, non-null
    return EntityCondition.makeCondition(
            makeAllOthersNullCond(), 
            EntityOperator.AND,
            this.makeNonNullCond()
        );
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:8,代码来源:CmsPage.java

示例15: findDatedInclusionEntity

import org.ofbiz.entity.condition.EntityCondition; //导入方法依赖的package包/类
public static List<GenericValue> findDatedInclusionEntity(Delegator delegator, String entityName, Map<String, ? extends Object> search, Timestamp now) throws GenericEntityException {
    EntityCondition searchCondition = EntityCondition.makeCondition(UtilMisc.toList(
            EntityCondition.makeCondition(search), EntityUtil.getFilterByDateExpr(now)));
    return EntityQuery.use(delegator).from(entityName).where(searchCondition).orderBy("-fromDate").queryList();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:6,代码来源:EntityUtil.java


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