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


Java EntityTypeUtil类代码示例

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


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

示例1: checkPartyType

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
/** Check if a related party is of the right party type (PERSON or PARTY_GROUP)
 *@param delegator needed Delegator
 *@param partyId a a valid Party Id string
 *@param checkedPartyType a string in {PERSON, PARTY_GROUP}
 *@return Boolean, false in case of error
 */
public static Boolean checkPartyType(Delegator delegator, String partyId, String checkedPartyType) {
    GenericValue party = null;
    GenericValue partyType = null;
    GenericValue checkedTypeOfParty = null;
    try {
        party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
        if (UtilValidate.isNotEmpty(party)) {
            partyType = party.getRelatedOne("PartyType", true);
            checkedTypeOfParty = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", checkedPartyType).cache().queryOne();
        } else {
            return false;
        }
    } catch (GenericEntityException e) {
        Debug.logWarning(e, module);
    }
    return EntityTypeUtil.isType(partyType, checkedTypeOfParty);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:24,代码来源:PartyTypeHelper.java

示例2: checkPartyType

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
/** Check if a related party is of the right party type (PERSON or PARTY_GROUP)
 *@param delegator needed Delegator
 *@param partyId a a valid Party Id string
 *@param checkedPartyType a string in {PERSON, PARTY_GROUP}
 *@return Boolean, false in case of error
 */
public static Boolean checkPartyType(Delegator delegator, String partyId, String checkedPartyType) {
    GenericValue party = null;
    GenericValue partyType = null;
    GenericValue checkedTypeOfParty = null;
    try {
        party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
        if (UtilValidate.isNotEmpty(party)) {
            partyType = party.getRelatedOne("PartyType", true);
            checkedTypeOfParty = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", checkedPartyType), true);
        } else {
            return false;
        }
    } catch (GenericEntityException e) {
        Debug.logWarning(e, module);
    }
    return EntityTypeUtil.isType(partyType, checkedTypeOfParty);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:24,代码来源:PartyTypeHelper.java

示例3: getInstanceAggregatedId

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
public static String getInstanceAggregatedId(Delegator delegator, String instanceProductId) throws GenericEntityException {
    GenericValue instanceProduct = EntityQuery.use(delegator).from("Product").where("productId", instanceProductId).queryOne();

    if (UtilValidate.isNotEmpty(instanceProduct) && EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) {
        GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false)));
        if (UtilValidate.isNotEmpty(productAssoc)) {
            return productAssoc.getString("productId");
        }
    }
    return null;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:12,代码来源:ProductWorker.java

示例4: checkDecomposeInventoryItem

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
public static Map<String, Object> checkDecomposeInventoryItem(DispatchContext ctx, Map<String, ? extends Object> context) {
    Delegator delegator = ctx.getDelegator();
    LocalDispatcher dispatcher = ctx.getDispatcher();
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    String inventoryItemId = (String)context.get("inventoryItemId");
    Locale locale = (Locale) context.get("locale");
    /*
    BigDecimal quantity = (BigDecimal)context.get("quantityAccepted");
    if (quantity != null && quantity.BigDecimalValue() == 0) {
        return ServiceUtil.returnSuccess();
    }
     */
    try {
        GenericValue inventoryItem = EntityQuery.use(delegator).from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne();
        if (inventoryItem == null) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductInventoryItemNotFound", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale));
        }
        if (inventoryItem.get("availableToPromiseTotal") != null && inventoryItem.getBigDecimal("availableToPromiseTotal").compareTo(ZERO) <= 0) {
            return ServiceUtil.returnSuccess();
        }
        GenericValue product = inventoryItem.getRelatedOne("Product", false);
        if (product == null) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductProductNotFound", locale) + " " + inventoryItem.get("productId"));
        }
        if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) {
            Map<String, Object> serviceContext = UtilMisc.toMap("inventoryItemId", inventoryItemId,
                                                "userLogin", userLogin);
            /*
            if (quantity != null) {
                serviceContext.put("quantity", quantity);
            }
             */
            dispatcher.runSync("decomposeInventoryItem", serviceContext);
        }
    } catch (Exception e) {
        Debug.logError(e, "Problem calling the checkDecomposeInventoryItem service", module);
        return ServiceUtil.returnError(e.getMessage());
    }
    return ServiceUtil.returnSuccess();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:41,代码来源:ProductionRunServices.java

示例5: getInstanceAggregatedId

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
public static String getInstanceAggregatedId(Delegator delegator, String instanceProductId) throws GenericEntityException {
    GenericValue instanceProduct = delegator.findOne("Product", UtilMisc.toMap("productId", instanceProductId), false);

    if (UtilValidate.isNotEmpty(instanceProduct) && EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) {
        GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false)));
        if (UtilValidate.isNotEmpty(productAssoc)) {
            return productAssoc.getString("productId");
        }
    }
    return null;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:12,代码来源:ProductWorker.java

示例6: checkDecomposeInventoryItem

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
public static Map<String, Object> checkDecomposeInventoryItem(DispatchContext ctx, Map<String, ? extends Object> context) {
    Delegator delegator = ctx.getDelegator();
    LocalDispatcher dispatcher = ctx.getDispatcher();
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    String inventoryItemId = (String)context.get("inventoryItemId");
    Locale locale = (Locale) context.get("locale");
    /*
    BigDecimal quantity = (BigDecimal)context.get("quantityAccepted");
    if (quantity != null && quantity.BigDecimalValue() == 0) {
        return ServiceUtil.returnSuccess();
    }
     */
    try {
        GenericValue inventoryItem = delegator.findOne("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId), false);
        if (inventoryItem == null) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductInventoryItemNotFound", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale));
        }
        if (inventoryItem.get("availableToPromiseTotal") != null && inventoryItem.getBigDecimal("availableToPromiseTotal").compareTo(ZERO) <= 0) {
            return ServiceUtil.returnSuccess();
        }
        GenericValue product = inventoryItem.getRelatedOne("Product", false);
        if (product == null) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductProductNotFound", locale) + " " + inventoryItem.get("productId"));
        }
        if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) {
            Map<String, Object> serviceContext = UtilMisc.toMap("inventoryItemId", inventoryItemId,
                                                "userLogin", userLogin);
            /*
            if (quantity != null) {
                serviceContext.put("quantity", quantity);
            }
             */
            dispatcher.runSync("decomposeInventoryItem", serviceContext);
        }
    } catch (Exception e) {
        Debug.logError(e, "Problem calling the checkDecomposeInventoryItem service", module);
        return ServiceUtil.returnError(e.getMessage());
    }
    return ServiceUtil.returnSuccess();
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:41,代码来源:ProductionRunServices.java

示例7: hasParentType

import org.ofbiz.entity.util.EntityTypeUtil; //导入依赖的package包/类
/**
 * A generic method to be used on Type enities, e.g. ProductType.  Recurse to the root level in the type hierarchy
 * and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
 *
 * @param delegator       The Delegator object.
 * @param entityName      Name of the Type entity on which check is performed.
 * @param primaryKey      Primary Key field of the Type entity.
 * @param childType       Type value for which the check is performed.
 * @param parentTypeField Field in Type entity which stores the parent type.
 * @param parentType      Value of the parent type against which check is performed.
 * @return boolean value based on the check results.
 * 
 * @deprecated Moved to {@link org.ofbiz.entity.util.EntityTypeUtil#hasParentType(Delegator, String, String, String, String, String) EntityTypeUtil}
 */
@Deprecated
public static boolean hasParentType(Delegator delegator, String entityName, String primaryKey, String childType, String parentTypeField, String parentType) {
    return EntityTypeUtil.hasParentType(delegator, entityName, primaryKey, childType, parentTypeField, parentType);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:CommonWorkers.java


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