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


Java DynamicViewEntity类代码示例

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


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

示例1: findListIteratorByCondition

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的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: findListIteratorByCondition

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
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(modelViewEntity, whereEntityCondition,
                havingEntityCondition, fieldsToSelect, orderBy, findOptions);
        eli.setDelegator(this);
        //TODO: add decrypt fields
        return eli;
    }
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:23,代码来源:GenericDelegator.java

示例3: addFieldDef

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, ConstantValue value) {
    if (value instanceof FieldValue) {
        addFieldDef(dve, groupBy, alias, (FieldValue) value, null);
        return;
    } else if (value instanceof FunctionCall) {
        FunctionCall fc = (FunctionCall) value;
        String name = fc.getName().toLowerCase();
        Iterator<Value> it = fc.iterator();
        if (it.hasNext()) {
            Value firstValue = it.next();
            if (!it.hasNext()) {
                if (firstValue instanceof FieldValue) {
                    addFieldDef(dve, groupBy, alias, (FieldValue) firstValue, name);
                    return;
                }
            }
        }
    }
    addFieldDef(dve, groupBy, alias, buildComplexMember(value));
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:21,代码来源:EntityPlanner.java

示例4: EntitySelectPlan

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
public EntitySelectPlan(DynamicViewEntity dve, ConditionPlan<EntityCondition> wherePlan, ConditionPlan<EntityCondition> havingPlan, List<String> orderBy) {
    super(wherePlan, havingPlan);
    this.dve = dve;
    this.orderBy = orderBy;
    //this.offset = offset;
    //this.limit = limit;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:8,代码来源:EntitySelectPlan.java

示例5: removeDuplicateOpenEndedCategoryMembers

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
public static Map<String, Object> removeDuplicateOpenEndedCategoryMembers(DispatchContext dctx, Map<String, ? extends Object> context) {
    Delegator delegator = dctx.getDelegator();
    Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
    Locale locale = (Locale) context.get("locale");
    String errMsg = null;

    try {
        DynamicViewEntity dve = new DynamicViewEntity();
        dve.addMemberEntity("PCM", "ProductCategoryMember");
        dve.addAlias("PCM", "productId", null, null, null, Boolean.TRUE, null);
        dve.addAlias("PCM", "productCategoryId", null, null, null, Boolean.TRUE, null);
        dve.addAlias("PCM", "fromDate", null, null, null, null, null);
        dve.addAlias("PCM", "thruDate", null, null, null, null, null);
        dve.addAlias("PCM", "productIdCount", "productId", null, null, null, "count");

        EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(
                EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, nowTimestamp),
                EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)
               ), EntityOperator.AND);
        EntityCondition havingCond = EntityCondition.makeCondition("productIdCount", EntityOperator.GREATER_THAN, Long.valueOf(1));
        EntityListIterator eli = EntityQuery.use(delegator).select("productId", "productCategoryId", "productIdCount").from(dve).where(condition).having(havingCond).queryIterator();
        GenericValue pcm = null;
        int numSoFar = 0;
        while ((pcm = eli.next()) != null) {
            List<GenericValue> productCategoryMemberList = EntityQuery.use(delegator).from("ProductCategoryMember").where("productId", pcm.get("productId"), "productCategoryId", pcm.get("productCategoryId")).queryList();
            if (productCategoryMemberList.size() > 1) {
                // remove all except the first...
                productCategoryMemberList.remove(0);
                for (GenericValue productCategoryMember: productCategoryMemberList) {
                    productCategoryMember.remove();
                }
                numSoFar++;
                if (numSoFar % 500 == 0) {
                    Debug.logInfo("Removed category members for " + numSoFar + " products with duplicate category members.", module);
                }
            }
        }
        eli.close();
        Debug.logInfo("Completed - Removed category members for " + numSoFar + " products with duplicate category members.", module);
    } catch (GenericEntityException e) {
        Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString());
        errMsg = UtilProperties.getMessage(resourceError,"productutilservices.entity_error_running_removeDuplicateOpenEndedCategoryMembers", messageMap, locale);
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(errMsg);
    }

    return ServiceUtil.returnSuccess();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:49,代码来源:ProductUtilServices.java

示例6: from

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
/** Set the entity to query against
 * @param dynamicViewEntity - The DynamicViewEntity object to query against
 * @return this EntityQuery object, to enable chaining
 */
public EntityQuery from(DynamicViewEntity dynamicViewEntity) {
    this.dynamicViewEntity  = dynamicViewEntity;
    this.entityName = null;
    return this;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:10,代码来源:EntityQuery.java

示例7: removeDuplicateOpenEndedCategoryMembers

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
public static Map<String, Object> removeDuplicateOpenEndedCategoryMembers(DispatchContext dctx, Map<String, ? extends Object> context) {
    Delegator delegator = dctx.getDelegator();
    Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
    Locale locale = (Locale) context.get("locale");
    String errMsg = null;

    try {
        DynamicViewEntity dve = new DynamicViewEntity();
        dve.addMemberEntity("PCM", "ProductCategoryMember");
        dve.addAlias("PCM", "productId", null, null, null, Boolean.TRUE, null);
        dve.addAlias("PCM", "productCategoryId", null, null, null, Boolean.TRUE, null);
        dve.addAlias("PCM", "fromDate", null, null, null, null, null);
        dve.addAlias("PCM", "thruDate", null, null, null, null, null);
        dve.addAlias("PCM", "productIdCount", "productId", null, null, null, "count");

        EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(
                EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, nowTimestamp),
                EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)
               ), EntityOperator.AND);
        EntityCondition havingCond = EntityCondition.makeCondition("productIdCount", EntityOperator.GREATER_THAN, Long.valueOf(1));
        EntityListIterator eli = delegator.findListIteratorByCondition(dve, condition, havingCond, UtilMisc.toList("productId", "productCategoryId", "productIdCount"), null, null);
        GenericValue pcm = null;
        int numSoFar = 0;
        while ((pcm = eli.next()) != null) {
            List<GenericValue> productCategoryMemberList = delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap("productId", pcm.get("productId"), "productCategoryId", pcm.get("productCategoryId")), null, false);
            if (productCategoryMemberList.size() > 1) {
                // remove all except the first...
                productCategoryMemberList.remove(0);
                for (GenericValue productCategoryMember: productCategoryMemberList) {
                    productCategoryMember.remove();
                }
                numSoFar++;
                if (numSoFar % 500 == 0) {
                    Debug.logInfo("Removed category members for " + numSoFar + " products with duplicate category members.", module);
                }
            }
        }
        eli.close();
        Debug.logInfo("Completed - Removed category members for " + numSoFar + " products with duplicate category members.", module);
    } catch (GenericEntityException e) {
        Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString());
        errMsg = UtilProperties.getMessage(resourceError,"productutilservices.entity_error_running_removeDuplicateOpenEndedCategoryMembers", messageMap, locale);
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(errMsg);
    }

    return ServiceUtil.returnSuccess();
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:49,代码来源:ProductUtilServices.java

示例8: planSelect

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
@Override
public EntitySelectPlan planSelect(SQLSelect selectStatement) {
    DynamicViewEntity dve = new DynamicViewEntity();
    Unioned unioned = selectStatement.getUnioned();
    if (unioned != null) {
        throw new IllegalArgumentException("union views not yet supported");
    }
    SelectGroup selectGroup = unioned.getGroup();
    Table table = selectGroup.getTable();
    addMember(dve, table.getTableName());
    addJoined(dve, table.getTableName().getAlias(), table.getJoined());
    if (selectGroup.getFieldAlls() != null) {
        for (FieldAll fieldAll: selectGroup.getFieldAlls()) {
            List<String> excludes = new LinkedList<String>();
            for (String exclude: fieldAll) {
                excludes.add(exclude);
            }
            if (excludes.isEmpty()) {
                excludes = null;
            }
            dve.addAliasAll(fieldAll.getAlias(), null, excludes);
        }
    }
    if (selectStatement.getRelations() != null) {
        for (Relation relation: selectStatement.getRelations().values()) {
            dve.addRelation(relation.getType(), relation.getTitle(), relation.getEntityName(), buildKeyMaps(relation));
        }
    }
    List<String> groupBy = selectGroup.getGroupBy();
    if (groupBy == null) {
        groupBy = Collections.emptyList();
    }
    if (selectGroup.getFieldDefs() != null) {
        for (FieldDef fieldDef: selectGroup.getFieldDefs()) {
            addFieldDef(dve, groupBy, fieldDef.getAlias(), fieldDef);
        }
    }
    List<String> orderBy;
    if (selectStatement.getOrderBy() == null) {
        orderBy = null;
    } else {
        orderBy = new LinkedList<String>();
        for (OrderByItem orderByItem: selectStatement.getOrderBy()) {
            orderBy.add(orderByItem.toString());
        }
    }
    return new EntitySelectPlan(dve, plan(selectGroup.getWhereCondition()), plan(selectGroup.getHavingCondition()), orderBy);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:49,代码来源:EntityPlanner.java

示例9: addMember

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
private static void addMember(DynamicViewEntity dve, TableName member) {
    dve.addMemberEntity(member.getAlias(), member.getTableName());
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:4,代码来源:EntityPlanner.java

示例10: addJoined

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
private static void addJoined(DynamicViewEntity dve, String leftAlias, Joined joined) {
    if (joined == null) return;
    addMember(dve, joined.getTableName());
    dve.addViewLink(leftAlias, joined.getTableName().getAlias(), joined.isOptional(), buildKeyMaps(joined));
    addJoined(dve, joined.getTableName().getAlias(), joined.getJoined());
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:7,代码来源:EntityPlanner.java

示例11: getDynamicViewEntity

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
public DynamicViewEntity getDynamicViewEntity() {
    return dve;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:4,代码来源:EntitySelectPlan.java

示例12: findListIteratorByCondition

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
/**
 * Finds GenericValues by the conditions specified in the EntityCondition
 * object, the the EntityCondition javadoc for more details. NOTE 20080502:
 * 9 references
 *
 * @param dynamicViewEntity
 *            The DynamicViewEntity to use for the entity model for this
 *            query; generally created on the fly for limited use
 * @param whereEntityCondition
 *            The EntityCondition object that specifies how to constrain
 *            this query before any groupings are done (if this is a view
 *            entity with group-by aliases)
 * @param havingEntityCondition
 *            The EntityCondition object that specifies how to constrain
 *            this query after any groupings are done (if this is a view
 *            entity with group-by aliases)
 * @param fieldsToSelect
 *            The fields of the named entity to get from the database; if
 *            empty or null all fields will be retreived
 * @param orderBy
 *            The fields of the named entity to order the query by;
 *            optionally add a " ASC" for ascending or " DESC" for
 *            descending
 * @param findOptions
 *            An instance of EntityFindOptions that specifies advanced query
 *            options. See the EntityFindOptions JavaDoc for more details.
 * @return EntityListIterator representing the result of the query: NOTE
 *         THAT THIS MUST BE CLOSED WHEN YOU ARE DONE WITH IT, AND DON'T
 *         LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE
 *         CONNECTION.
 */
EntityListIterator findListIteratorByCondition(DynamicViewEntity dynamicViewEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException;
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:33,代码来源:Delegator.java

示例13: findListIteratorByCondition

import org.ofbiz.entity.model.DynamicViewEntity; //导入依赖的package包/类
/**
 * Finds GenericValues by the conditions specified in the EntityCondition
 * object, the the EntityCondition javadoc for more details. NOTE 20080502:
 * 9 references
 *
 * @param dynamicViewEntity
 *            The DynamicViewEntity to use for the entity model for this
 *            query; generally created on the fly for limited use
 * @param whereEntityCondition
 *            The EntityCondition object that specifies how to constrain
 *            this query before any groupings are done (if this is a view
 *            entity with group-by aliases)
 * @param havingEntityCondition
 *            The EntityCondition object that specifies how to constrain
 *            this query after any groupings are done (if this is a view
 *            entity with group-by aliases)
 * @param fieldsToSelect
 *            The fields of the named entity to get from the database; if
 *            empty or null all fields will be retreived
 * @param orderBy
 *            The fields of the named entity to order the query by;
 *            optionally add a " ASC" for ascending or " DESC" for
 *            descending
 * @param findOptions
 *            An instance of EntityFindOptions that specifies advanced query
 *            options. See the EntityFindOptions JavaDoc for more details.
 * @return EntityListIterator representing the result of the query: NOTE
 *         THAT THIS MUST BE CLOSED WHEN YOU ARE DONE WITH IT, AND DON'T
 *         LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE
 *         CONNECTION.
 */
public EntityListIterator findListIteratorByCondition(DynamicViewEntity dynamicViewEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException;
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:33,代码来源:Delegator.java


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