Package org.ofbiz.entity

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


        }

        if (!partyId.equals("_NA_")) {
            // try to find a PartyContactMech with a valid date range
            try {
                List<GenericValue> partyContactMechs = EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId), UtilMisc.toList("fromDate")), true);
                partyContactMech = EntityUtil.getFirst(partyContactMechs);
                if (partyContactMech == null) {
                    errMsg = UtilProperties.getMessage(resource,"contactmechservices.cannot_update_specified_contact_info_not_corresponds", locale);
                    return ServiceUtil.returnError(errMsg);
                } else {
View Full Code Here


        acctgTransEntrySeqId = (String) ctx.get("acctgTransEntrySeqId" + suffix);
        organizationPartyId = (String) ctx.get("organizationPartyId" + suffix);
        glAccountId = (String) ctx.get("glAccountId" + suffix);
        GenericValue acctgTransEntry;
        try {
            List acctgTransEntries = delegator.findByAnd("AcctgTransEntry", UtilMisc.toMap("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId));
            if (acctgTransEntries.size() > 0) {
                Iterator acctgTransEntryItr = acctgTransEntries.iterator();
                while (acctgTransEntryItr.hasNext()) {  //calculate amount for each AcctgTransEntry according to glAccountId based on debit and credit
                    acctgTransEntry = (GenericValue) acctgTransEntryItr.next();
                    debitCreditFlag = (String) acctgTransEntry.getString("debitCreditFlag");
View Full Code Here

        }
        acctgTransId = (String) ctx.get("acctgTransId" + suffix);
        acctgTransEntrySeqId = (String) ctx.get("acctgTransEntrySeqId" + suffix);
        GenericValue acctgTransEntry;
        try {
            List acctgTransEntries = delegator.findByAnd("AcctgTransEntry", UtilMisc.toMap("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId));
            if (acctgTransEntries.size() > 0) {
                Iterator acctgTransEntryItr = acctgTransEntries.iterator();
                while (acctgTransEntryItr.hasNext()) {
                    acctgTransEntry = (GenericValue) acctgTransEntryItr.next();
                    reconciledAmount = acctgTransEntry.getString("amount");
View Full Code Here

        }

        // get the contact address to pass over
        GenericValue contactAddress = null;
        try {
            List addresses = delegator.findByAnd("OrderContactMech", UtilMisc.toMap("orderId", orderId, "contactMechPurposeTypeId", "BILLING_LOCATION"));
            if (addresses.size() == 0)
                addresses = delegator.findByAnd("OrderContactMech", UtilMisc.toMap("orderId", orderId, "contactMechPurposeTypeId", "SHIPPING_LOCATION"));
            GenericValue contactMech = EntityUtil.getFirst(addresses);
            contactAddress = delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", contactMech.getString("contactMechId")));
        } catch (GenericEntityException e) {
View Full Code Here

        // get the contact address to pass over
        GenericValue contactAddress = null;
        try {
            List addresses = delegator.findByAnd("OrderContactMech", UtilMisc.toMap("orderId", orderId, "contactMechPurposeTypeId", "BILLING_LOCATION"));
            if (addresses.size() == 0)
                addresses = delegator.findByAnd("OrderContactMech", UtilMisc.toMap("orderId", orderId, "contactMechPurposeTypeId", "SHIPPING_LOCATION"));
            GenericValue contactMech = EntityUtil.getFirst(addresses);
            contactAddress = delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", contactMech.getString("contactMechId")));
        } catch (GenericEntityException e) {
            Debug.logWarning(e, "Problems getting order contact information", module);
        }
View Full Code Here

        // get the email address to pass over
        String emailAddress = null;
        GenericValue emailContact = null;
        try {
            List emails = delegator.findByAnd("OrderContactMech", UtilMisc.toMap("orderId", orderId, "contactMechPurposeTypeId", "ORDER_EMAIL"));
            GenericValue firstEmail = EntityUtil.getFirst(emails);
            emailContact = delegator.findByPrimaryKey("ContactMech", UtilMisc.toMap("contactMechId", firstEmail.getString("contactMechId")));
            emailAddress = emailContact.getString("infoString");
        } catch (GenericEntityException e) {
            Debug.logWarning(e, "Problems getting order email address", module);
View Full Code Here

                // and optionally, for this period type
                Map<String, String> findParams = UtilMisc.toMap("organizationPartyId", organizationPartyId);
                if ((periodTypeId != null) && !(periodTypeId.equals(""))) {
                    findParams.put("periodTypeId", periodTypeId);
                }
                List<GenericValue> timePeriods = delegator.findByAnd("CustomTimePeriod", findParams, UtilMisc.toList("fromDate ASC"));
                if ((timePeriods != null) && (timePeriods.size() > 0) && (timePeriods.get(0).get("fromDate") != null)) {
                    lastClosedDate = UtilDateTime.toTimestamp(timePeriods.get(0).getDate("fromDate"));
                } else {
                    return ServiceUtil.returnError("Cannot get a starting date for net income");
                }
View Full Code Here

                String isVariant = product.getString("isVariant");
                if (pieces == null && isVariant != null && "Y".equals(isVariant)) {
                    // get the virtual product and check its weight
                    GenericValue virtual = null;
                    try {
                        List virtuals = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productIdTo", product.getString("productId"), "productAssocTypeId", "PRODUCT_VARIANT"), UtilMisc.toList("-fromDate"));
                        virtuals = EntityUtil.filterByDate(virtuals);
                        virtual = EntityUtil.getFirst(virtuals);
                    } catch (GenericEntityException e) {
                        Debug.logError(e, "Problem getting virtual product");
                    }
View Full Code Here

        GenericDelegator delegator = orderHeader.getDelegator();
        // get the email addresses from the order contact mech(s)
        List orderContactMechs = null;
        try {
            Map ocFields = UtilMisc.toMap("orderId", orderHeader.get("orderId"), "contactMechPurposeTypeId", "ORDER_EMAIL");
            orderContactMechs = delegator.findByAnd("OrderContactMech", ocFields);
        } catch (GenericEntityException e) {
            Debug.logWarning(e, "Problems getting order contact mechs", module);
        }

        StringBuffer emails = new StringBuffer();
View Full Code Here

    public int hasSurvey() {
        GenericDelegator delegator = orderHeader.getDelegator();
        List surveys = null;
        try {
            surveys = delegator.findByAnd("SurveyResponse", UtilMisc.toMap("orderId", orderHeader.getString("orderId")));
        } catch (GenericEntityException e) {
            Debug.logError(e, module);
        }
        int size = 0;
        if (surveys != null) {
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.