Package org.ofbiz.entity

Examples of org.ofbiz.entity.GenericPK


    public synchronized void resetPromoRuleUse(String productPromoId, String productPromoRuleId) {
        Iterator<Map.Entry<GenericPK, BigDecimal>> entryIter = this.quantityUsedPerPromoCandidate.entrySet().iterator();
        while (entryIter.hasNext()) {
            Map.Entry<GenericPK, BigDecimal> entry = entryIter.next();
            GenericPK productPromoCondActionPK = entry.getKey();
            BigDecimal quantityUsed = entry.getValue();
            if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId"))) {
                entryIter.remove();
                BigDecimal existingValue = this.quantityUsedPerPromoFailed.get(productPromoCondActionPK);
                if (existingValue == null) {
                    this.quantityUsedPerPromoFailed.put(productPromoCondActionPK, quantityUsed);
                } else {
View Full Code Here


    public synchronized void confirmPromoRuleUse(String productPromoId, String productPromoRuleId) {
        Iterator<Map.Entry<GenericPK, BigDecimal>> entryIter = this.quantityUsedPerPromoCandidate.entrySet().iterator();
        while (entryIter.hasNext()) {
            Map.Entry<GenericPK, BigDecimal> entry = entryIter.next();
            GenericPK productPromoCondActionPK = entry.getKey();
            BigDecimal quantityUsed = entry.getValue();
            if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId"))) {
                entryIter.remove();
                BigDecimal existingValue = this.quantityUsedPerPromoActual.get(productPromoCondActionPK);
                if (existingValue == null) {
                    this.quantityUsedPerPromoActual.put(productPromoCondActionPK, quantityUsed);
                } else {
View Full Code Here

        //Delegator delegator = dctx.getDelegator();
        //LocalDispatcher dispatcher = dctx.getDispatcher();
        //HttpServletRequest request = (HttpServletRequest)context.get("request");
        //String suffix = (String) context.get("suffix");
        GenericValue val = (GenericValue)context.get("pk");
        GenericPK pk = val.getPrimaryKey();
        HttpSession session = (HttpSession)context.get("session");

        ContentManagementWorker.mruAdd(session, pk);
        return ServiceUtil.returnSuccess();
    }
View Full Code Here

        // Copy the instance, and assign it to the local delegator instead of the master one.
        GenericValue localInstance = new GenericValue(masterInstance);
        localInstance.setDelegator(getLocalDelegator());

        GenericPK localInstancePK = localInstance.getPrimaryKey();

        try {
            getLocalDelegator().create(localInstance);
            Debug.logVerbose("Inserted key " + localInstancePK.toString(), module);

            return STATUS_CONTINUE;
        } catch (GenericEntityException gee) {
            if (gee.getLocalizedMessage().indexOf("Duplicate entry") > 0) {
                Debug.logError("[insertLocalInstance] Duplicate key " +
                    localInstancePK.toString(), module);

                return STATUS_CONTINUE;
            } else {
                Debug.logError("[insertLocalInstance] Error inserting key " +
                    localInstancePK.toString() + ":", module);
                Debug.logError("[insertLocalInstance] " +
                    gee.getLocalizedMessage(), module);

                return STATUS_ERROR;
            }
View Full Code Here

            return STATUS_ERROR;
        }

        ;

        GenericPK localInstancePK = localInstance.getPrimaryKey();

        try {
            getLocalDelegator().removeByPrimaryKey(localInstance.getPrimaryKey());
            Debug.logVerbose("Removed key " + localInstancePK.toString(), module);

            return STATUS_CONTINUE;
        } catch (GenericEntityException gee) {
            Debug.logError("[removeLocalInstance] Error removing key " +
                localInstancePK.toString() + ":", module);
            Debug.logError("[removeLocalInstance] " +
                gee.getLocalizedMessage(), module);

            return STATUS_ERROR;
        }
View Full Code Here

            Debug.logError("[findOneRelated] User info object is required.", module);

            return null;
        }

        GenericPK entityPK = null;

        String entityKeyString = null;
        List relatedGVL = null;

        if (findAll) {
            // Need to find all entity instances, not just the ones related to
            // the main entity instance.
            try {
                if (TIMER) {
                    timer.timerString(2,
                        "[EntityReplicator.findOneRelated] Start findByAnd");
                }

                relatedGVL = delegator.findByAnd(relatedEntityName, filterMap);

                if (TIMER) {
                    timer.timerString(2,
                        "[EntityReplicator.findOneRelated] Finished findByAnd");
                }

                return relatedGVL;
            } catch (GenericEntityException e) {
                Debug.logError("[findOneRelated] Error getting " +
                    relatedEntityName + " records by and: " +
                    e.getLocalizedMessage(), module);

                return null;
            }
        } else {
            // Need to find just the entity instances related to the main entity instance.
            if (mainInstance == null) {
                Debug.logError(
                    "[findOneRelated] Main instance is required if findAll is false.", module);

                return null;
            }

            entityPK = mainInstance.getPrimaryKey();
            entityKeyString = entityPK.toString();
            Debug.logVerbose("[findOneRelated] Retrieving all " +
                    relatedEntityName + " records related to " +
                    entityKeyString, module);

            try {
View Full Code Here

            while (checkOrderAdjustments != null && checkOrderAdjustments.hasNext()) {
                GenericValue checkOrderAdjustment = checkOrderAdjustments.next();
                if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) &&
                        UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) &&
                        UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) {
                    GenericPK productPromoActionPk = delegator.makeValidValue("ProductPromoAction", checkOrderAdjustment).getPrimaryKey();
                    cart.setDesiredAlternateGiftByAction(productPromoActionPk, alternateGwpProductId);
                    if (cart.getOrderType().equals("SALES_ORDER")) {
                        org.ofbiz.order.shoppingcart.product.ProductPromoWorker.doPromotions(cart, dispatcher);
                    }
                    return "success";
View Full Code Here

            //  Prune the oldest history item
            Debug.logVerbose(
                    "[pruneUserHistory] Party Id has max history size.  Pruning.", module);

            GenericValue pruneGV = (GenericValue) historyArray[0];
            GenericPK prunePk = pruneGV.getPrimaryKey();

            try {
                delegator.removeByPrimaryKey(prunePk);
            } catch (GenericEntityException e) {
                Debug.logError(
View Full Code Here

                return new ArrayList();
            }

            // Get the account ID for this opportunity.
            String dealId = (String) filterValues.get("dealId");
            GenericPK dealPK = new GenericPK(delegator.getModelEntity("Deal"));
            dealPK.set("dealId", dealId);

            GenericValue dealGV = null;

            try {
                dealGV = delegator.findByPrimaryKey(dealPK);
View Full Code Here

            // Look through the assigned keys to see if this key is already selected.
            Iterator selectedEntityPKI = selectedEntityPKL.iterator();

            while (selectedEntityPKI.hasNext()) {
                GenericPK selectedEntityPK = (GenericPK) selectedEntityPKI.next();

                if (selectedEntityPK.equals(eligibleGV.getPrimaryKey())) {
                    Debug.logVerbose(
                            "[activityContactSelectAvailable] Removing a selected item for PK " +
                            selectedEntityPK.toString(), module);

                    // This entity has already been selected. Remove it from the eligible list.
                    eligibleEntityI.remove();

                    break;
View Full Code Here

TOP

Related Classes of org.ofbiz.entity.GenericPK

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.