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


Java ModelKeyMap类代码示例

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


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

示例1: addConstraint

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
    List<String> productCategoryIds = FastList.newInstance();
    for (GenericValue category: productCategories) {
        productCategoryIds.add(category.getString("productCategoryId"));
    }

    // make index based values and increment
    String entityAlias = "PCM" + productSearchContext.index;
    String prefix = "pcm" + productSearchContext.index;
    productSearchContext.index++;

    productSearchContext.dynamicViewEntity.addMemberEntity(entityAlias, "ProductCategoryMember");
    productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductCategoryId", "productCategoryId", null, null, null, null);
    productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null);
    productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null);
    productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
    productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIds));
    productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp)));
    productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp));

    // add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later
    productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.prodCatalogId)));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:ProductSearch.java

示例2: setSortOrder

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
public void setSortOrder(ProductSearchContext productSearchContext) {
    productSearchContext.dynamicViewEntity.addMemberEntity("PFAPPL", "ProductFeatureAndAppl");
    productSearchContext.dynamicViewEntity.addAlias("PFAPPL", "sortProductFeatureTypeId", "productFeatureTypeId", null, null, null, null);
    productSearchContext.dynamicViewEntity.addAlias("PFAPPL", "sortProductFeatureId", "productFeatureId", null, null, null, null);
    productSearchContext.dynamicViewEntity.addAlias("PFAPPL", "sortFromDate", "fromDate", null, null, null, null);
    productSearchContext.dynamicViewEntity.addAlias("PFAPPL", "sortThruDate", "thruDate", null, null, null, null);
    productSearchContext.dynamicViewEntity.addViewLink("PROD", "PFAPPL", Boolean.TRUE, UtilMisc.toList(new ModelKeyMap("productId", "productId")));
    productSearchContext.entityConditionList.add(EntityCondition.makeCondition("sortProductFeatureTypeId", EntityOperator.EQUALS, this.productFeatureTypeId));
    productSearchContext.entityConditionList.add(EntityCondition.makeCondition("sortFromDate", EntityOperator.LESS_THAN_EQUAL_TO, productSearchContext.nowTimestamp));
    productSearchContext.entityConditionList.add(EntityCondition.makeCondition(
            EntityCondition.makeCondition("sortThruDate", EntityOperator.EQUALS, null), EntityOperator.OR,
            EntityCondition.makeCondition("sortThruDate", EntityOperator.GREATER_THAN_EQUAL_TO, productSearchContext.nowTimestamp)));
    if (ascending) {
        productSearchContext.orderByList.add("+sortProductFeatureId");
    } else {
        productSearchContext.orderByList.add("-sortProductFeatureId");
    }
    productSearchContext.fieldsToSelect.add("sortProductFeatureId");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:21,代码来源:ProductSearch.java

示例3: addConstraint

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
    // make index based values and increment
    String entityAlias = "WEPA" + workEffortSearchContext.index;
    String prefix = "wepa" + workEffortSearchContext.index;
    workEffortSearchContext.index++;

    workEffortSearchContext.dynamicViewEntity.addMemberEntity(entityAlias, "WorkEffortPartyAssignment");
    workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "PartyId", "partyId", null, null, null, null);
    workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "RoleTypeId", "roleTypeId", null, null, null, null);
    workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null);
    workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null);
    workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId"));

    workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "PartyId", EntityOperator.EQUALS, partyId));
    workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, workEffortSearchContext.nowTimestamp)));
    workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, workEffortSearchContext.nowTimestamp));
    if (UtilValidate.isNotEmpty(this.roleTypeId)) {
        workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "RoleTypeId", EntityOperator.EQUALS, roleTypeId));
    }

    // add in workEffortSearchConstraint, don't worry about the workEffortSearchResultId or constraintSeqId, those will be fill in later
    workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.partyId + "," + this.roleTypeId)));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:WorkEffortSearch.java

示例4: removeRelated

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
@Deprecated
public int removeRelated(String relationName, GenericValue value, boolean doCacheClear) throws GenericEntityException {
    ModelEntity modelEntity = value.getModelEntity();
    ModelRelation relation = modelEntity.getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }

    Map<String, Object> fields = new HashMap<String, Object>();
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return this.removeByAnd(relation.getRelEntityName(), fields, doCacheClear);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:GenericDelegator.java

示例5: getRelated

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
public List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value, boolean useCache) throws GenericEntityException {
    ModelEntity modelEntity = value.getModelEntity();
    ModelRelation relation = modelEntity.getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }

    // put the byAndFields (if not null) into the hash map first,
    // they will be overridden by value's fields if over-specified this is important for security and cleanliness
    Map<String, Object> fields = new HashMap<String, Object>();
    if (byAndFields != null) {
        fields.putAll(byAndFields);
    }
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return this.findByAnd(relation.getRelEntityName(), fields, orderBy, useCache);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:GenericDelegator.java

示例6: getRelatedDummyPK

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
public GenericPK getRelatedDummyPK(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) throws GenericEntityException {
    ModelEntity modelEntity = value.getModelEntity();
    ModelRelation relation = modelEntity.getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }
    ModelEntity relatedEntity = getModelReader().getModelEntity(relation.getRelEntityName());

    // put the byAndFields (if not null) into the hash map first,
    // they will be overridden by value's fields if over-specified this is important for security and cleanliness
    Map<String, Object> fields = new HashMap<String, Object>();
    if (byAndFields != null) {
        fields.putAll(byAndFields);
    }
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return GenericPK.create(this, relatedEntity, fields);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:GenericDelegator.java

示例7: getRelatedOne

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Override
public GenericValue getRelatedOne(String relationName, GenericValue value, boolean useCache) throws GenericEntityException {
    ModelRelation relation = value.getModelEntity().getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }
    if (!"one".equals(relation.getType()) && !"one-nofk".equals(relation.getType())) {
        throw new GenericModelException("Relation is not a 'one' or a 'one-nofk' relation: " + relationName + " of entity " + value.getEntityName());
    }

    Map<String, Object> fields = new HashMap<String, Object>();
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return this.findOne(relation.getRelEntityName(), fields, useCache);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:GenericDelegator.java

示例8: removeRelated

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
@Deprecated
public int removeRelated(String relationName, GenericValue value, boolean doCacheClear) throws GenericEntityException {
    ModelEntity modelEntity = value.getModelEntity();
    ModelRelation relation = modelEntity.getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }

    Map<String, Object> fields = new HashMap<String, Object>();
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return this.removeByAnd(relation.getRelEntityName(), fields, doCacheClear);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:17,代码来源:GenericDelegator.java

示例9: getRelated

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
public List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value, boolean useCache) throws GenericEntityException {
    ModelEntity modelEntity = value.getModelEntity();
    ModelRelation relation = modelEntity.getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }

    // put the byAndFields (if not null) into the hash map first,
    // they will be overridden by value's fields if over-specified this is important for security and cleanliness
    Map<String, Object> fields = new HashMap<String, Object>();
    if (byAndFields != null) {
        fields.putAll(byAndFields);
    }
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return this.findByAnd(relation.getRelEntityName(), fields, orderBy, useCache);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:21,代码来源:GenericDelegator.java

示例10: getRelatedDummyPK

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
public GenericPK getRelatedDummyPK(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) throws GenericEntityException {
    ModelEntity modelEntity = value.getModelEntity();
    ModelRelation relation = modelEntity.getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }
    ModelEntity relatedEntity = getModelReader().getModelEntity(relation.getRelEntityName());

    // put the byAndFields (if not null) into the hash map first,
    // they will be overridden by value's fields if over-specified this is important for security and cleanliness
    Map<String, Object> fields = new HashMap<String, Object>();
    if (byAndFields != null) {
        fields.putAll(byAndFields);
    }
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return GenericPK.create(this, relatedEntity, fields);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:22,代码来源:GenericDelegator.java

示例11: getRelatedOne

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
public GenericValue getRelatedOne(String relationName, GenericValue value, boolean useCache) throws GenericEntityException {
    ModelRelation relation = value.getModelEntity().getRelation(relationName);

    if (relation == null) {
        throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value);
    }
    if (!"one".equals(relation.getType()) && !"one-nofk".equals(relation.getType())) {
        throw new GenericModelException("Relation is not a 'one' or a 'one-nofk' relation: " + relationName + " of entity " + value.getEntityName());
    }

    Map<String, Object> fields = new HashMap<String, Object>();
    for (ModelKeyMap keyMap : relation.getKeyMaps()) {
        fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
    }

    return this.findOne(relation.getRelEntityName(), fields, useCache);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:18,代码来源:GenericDelegator.java

示例12: ProductSearchContext

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
public ProductSearchContext(Delegator delegator, String visitId) {
    this.delegator = delegator;
    this.visitId = visitId;
    dynamicViewEntity.addMemberEntity("PROD", "Product");
    dynamicViewEntity.addMemberEntity("PRODCI", "ProductCalculatedInfo");
    dynamicViewEntity.addViewLink("PROD", "PRODCI", Boolean.TRUE, ModelKeyMap.makeKeyMapList("productId"));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:8,代码来源:ProductSearch.java

示例13: getRelationFieldNames

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
/**
 * Returns the field names of the entity that are foreign keys to the specified relEntityName.
 * Only useful if relEntityName is entity with single-field PK.
 */
public static Set<String> getRelationFieldNames(ModelEntity modelEntity, String relEntityName, 
        boolean includeOne, boolean includeOneNoFk, boolean includeMany) {
    if (modelEntity == null) return null;
    Set<String> fieldNames = new LinkedHashSet<>(); // NOTE: using LinkedHashSet so order is more predictable...
    for(ModelRelation relation : modelEntity.getRelationsList(includeOne, includeOneNoFk, includeMany)) {
        if (relEntityName.equals(relation.getRelEntityName())) {
            for(ModelKeyMap keyMap : relation.getKeyMaps()) {
                fieldNames.add(keyMap.getFieldName());
            }
        }
    }
    return fieldNames;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:EntityInfoUtil.java

示例14: makeFkIndexClause

import org.ofbiz.entity.model.ModelKeyMap; //导入依赖的package包/类
public String makeFkIndexClause(ModelEntity entity, ModelRelation modelRelation, int constraintNameClipLength) {
    StringBuilder mainCols = new StringBuilder();

    for (ModelKeyMap keyMap : modelRelation.getKeyMaps()) {
        ModelField mainField = entity.getField(keyMap.getFieldName());

        if (mainField == null) {
            Debug.logError("Bad key-map in entity [" + entity.getEntityName() + "] relation to [" + modelRelation.getTitle() + modelRelation.getRelEntityName() + "] for field [" + keyMap.getFieldName() + "]", module);
            return null;
        }

        if (mainCols.length() > 0) {
            mainCols.append(", ");
        }
        mainCols.append(mainField.getColName());
    }

    StringBuilder indexSqlBuf = new StringBuilder("CREATE INDEX ");
    String relConstraintName = makeFkConstraintName(modelRelation, constraintNameClipLength);

    indexSqlBuf.append(relConstraintName);
    indexSqlBuf.append(" ON ");
    indexSqlBuf.append(entity.getTableName(datasourceInfo));

    indexSqlBuf.append(" (");
    indexSqlBuf.append(mainCols.toString());
    indexSqlBuf.append(")");

    return indexSqlBuf.toString();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:31,代码来源:DatabaseUtil.java


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