Package org.ofbiz.entity

Examples of org.ofbiz.entity.GenericDelegator.findByAndCache()


            productAssoc.put("fromDate", UtilDateTime.nowTimestamp());
            productAssoc.create();
            Debug.log("set the productId to: " + product.getString("productId"));
           
            // copy the supplier
            List <GenericValue> supplierProducts = delegator.findByAndCache("SupplierProduct", UtilMisc.toMap("productId", productId));
            Iterator <GenericValue> SPite = supplierProducts.iterator();
            while (SPite.hasNext()) {
              GenericValue supplierProduct = SPite.next();
              supplierProduct.set("productId",  product.getString("productId"))
              supplierProduct.create();
View Full Code Here


              supplierProduct.set("productId",  product.getString("productId"))
              supplierProduct.create();
            }
           
            // copy the content
            List <GenericValue> productContents = delegator.findByAndCache("ProductContent", UtilMisc.toMap("productId", productId));
            Iterator <GenericValue> productContentsTte = productContents.iterator();
            while (productContentsTte.hasNext()) {
              GenericValue productContent = productContentsTte.next();
              productContent.set("productId",  product.getString("productId"));    
              productContent.create();
View Full Code Here

            String productId = (String) context.get("productId");
            String invoiceItemTypeId = (String) context.get("invoiceItemTypeId");
           
            // Collect agreementItems applicable to this orderItem/returnItem
            // TODO: partyIds should be part of this query!
            List agreementItems = delegator.findByAndCache("AgreementItemAndProductAppl", UtilMisc.toMap(
                    "productId", productId,
                    "agreementItemTypeId", "AGREEMENT_COMMISSION"));
            // Try the first available virtual product if this is a variant product
            if (agreementItems.size() == 0) {
                List productAssocs = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap(
View Full Code Here

            List agreementItems = delegator.findByAndCache("AgreementItemAndProductAppl", UtilMisc.toMap(
                    "productId", productId,
                    "agreementItemTypeId", "AGREEMENT_COMMISSION"));
            // Try the first available virtual product if this is a variant product
            if (agreementItems.size() == 0) {
                List productAssocs = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap(
                        "productIdTo", productId,
                        "productAssocTypeId", "PRODUCT_VARIANT"));
                productAssocs = EntityUtil.filterByDate(productAssocs);
                if (productAssocs.size() > 0) {
                    GenericEntity productAssoc = EntityUtil.getFirst(productAssocs);
View Full Code Here

                        "productIdTo", productId,
                        "productAssocTypeId", "PRODUCT_VARIANT"));
                productAssocs = EntityUtil.filterByDate(productAssocs);
                if (productAssocs.size() > 0) {
                    GenericEntity productAssoc = EntityUtil.getFirst(productAssocs);
                    agreementItems = delegator.findByAndCache("AgreementItemAndProductAppl", UtilMisc.toMap(
                            "productId", productAssoc.getString("productId"),
                            "agreementItemTypeId", "AGREEMENT_COMMISSION"));
                }
            }
            // this is not very efficient if there were many
View Full Code Here

            agreementItems = EntityUtil.filterByDate(agreementItems);
           
            Iterator it = agreementItems.iterator();
            while (it.hasNext()) {
                GenericValue agreementItem = (GenericValue) it.next();
                List terms = delegator.findByAndCache("AgreementTerm", UtilMisc.toMap(
                        "agreementId", agreementItem.getString("agreementId"),
                        "agreementItemSeqId", agreementItem.getString("agreementItemSeqId"),
                        "invoiceItemTypeId", invoiceItemTypeId));
                if (terms.size() > 0) {
                    BigDecimal commission = ZERO;
View Full Code Here

        String virtualProductId = getVariantVirtualId(variantProduct);
       
        // find all selectable features on the virtual product that are also standard features on the variant
        Set distFeatures = new HashSet();
       
        List variantDistinguishingFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "DISTINGUISHING_FEAT"));
        // Debug.logInfo("Found variantDistinguishingFeatures: " + variantDistinguishingFeatures, module);

        Iterator variantDistinguishingFeatureIter = UtilMisc.toIterator(EntityUtil.filterByDate(variantDistinguishingFeatures));
        while (variantDistinguishingFeatureIter != null && variantDistinguishingFeatureIter.hasNext()) {
            GenericValue variantDistinguishingFeature = (GenericValue) variantDistinguishingFeatureIter.next();
View Full Code Here

            GenericValue dummyFeature = delegator.makeValue("ProductFeature");
            dummyFeature.setAllFields(variantDistinguishingFeature, true, null, null);
            distFeatures.add(dummyFeature);
        }

        List virtualSelectableFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", virtualProductId, "productFeatureApplTypeId", "SELECTABLE_FEATURE"));
        // Debug.logInfo("Found virtualSelectableFeatures: " + virtualSelectableFeatures, module);

        Iterator virtualSelectableFeatureIter = UtilMisc.toIterator(EntityUtil.filterByDate(virtualSelectableFeatures));
        Set virtualSelectableFeatureIds = new HashSet();
        while (virtualSelectableFeatureIter != null && virtualSelectableFeatureIter.hasNext()) {
View Full Code Here

        while (virtualSelectableFeatureIter != null && virtualSelectableFeatureIter.hasNext()) {
            GenericValue virtualSelectableFeature = (GenericValue) virtualSelectableFeatureIter.next();
            virtualSelectableFeatureIds.add(virtualSelectableFeature.get("productFeatureId"));
        }
       
        List variantStandardFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE"));
        // Debug.logInfo("Found variantStandardFeatures: " + variantStandardFeatures, module);

        Iterator variantStandardFeatureIter = UtilMisc.toIterator(EntityUtil.filterByDate(variantStandardFeatures));
        while (variantStandardFeatureIter != null && variantStandardFeatureIter.hasNext()) {
            GenericValue variantStandardFeature = (GenericValue) variantStandardFeatureIter.next();
View Full Code Here

        try {
            if (product != null) {
                GenericDelegator delegator = product.getDelegator();
                Map<String,String> fields = UtilMisc.toMap("productId", product.getString("productId"), "productFeatureApplTypeId", "SELECTABLE_FEATURE");
                List<String> order = UtilMisc.toList("productFeatureTypeId", "sequenceNum");
                List features = delegator.findByAndCache("ProductFeatureAndAppl", fields, order);
                List featuresSorted = (List) UtilMisc.sortMaps(features, order);
                Iterator it = (Iterator) featuresSorted.iterator();
                String oldType = null;
                List<Map<String,String>> featureList = new LinkedList<Map<String,String>>();
                while(it.hasNext()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.