Search in sources :

Example 26 with EntityListIterator

use of org.apache.ofbiz.entity.util.EntityListIterator in project ofbiz-framework by apache.

the class SurveyWrapper method getQuestionResponses.

public List<GenericValue> getQuestionResponses(GenericValue question, int startIndex, int number) throws SurveyWrapperException {
    List<GenericValue> resp = null;
    boolean beganTransaction = false;
    int maxRows = startIndex + number;
    try {
        beganTransaction = TransactionUtil.begin();
    } catch (GenericTransactionException gte) {
        Debug.logError(gte, "Unable to begin transaction", module);
    }
    try (EntityListIterator eli = this.getEli(question, maxRows)) {
        if (startIndex > 0 && number > 0) {
            resp = eli.getPartialList(startIndex, number);
        } else {
            resp = eli.getCompleteList();
        }
    } catch (GenericEntityException e) {
        try {
            // only rollback the transaction if we started one...
            TransactionUtil.rollback(beganTransaction, "Error getting survey question responses", e);
        } catch (GenericEntityException e2) {
            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module);
        }
        throw new SurveyWrapperException(e);
    } finally {
        try {
            // only commit the transaction if we started one...
            TransactionUtil.commit(beganTransaction);
        } catch (GenericEntityException e) {
            throw new SurveyWrapperException(e);
        }
    }
    return resp;
}
Also used : GenericValue(org.apache.ofbiz.entity.GenericValue) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) GenericTransactionException(org.apache.ofbiz.entity.transaction.GenericTransactionException) EntityListIterator(org.apache.ofbiz.entity.util.EntityListIterator)

Example 27 with EntityListIterator

use of org.apache.ofbiz.entity.util.EntityListIterator in project ofbiz-framework by apache.

the class SurveyWrapper method getOptionResult.

private Map<String, Object> getOptionResult(GenericValue question) throws SurveyWrapperException {
    Map<String, Object> result = new HashMap<>();
    long total = 0;
    boolean beganTransaction = false;
    try {
        beganTransaction = TransactionUtil.begin();
    } catch (GenericTransactionException gte) {
        Debug.logError(gte, "Unable to begin transaction", module);
    }
    try (EntityListIterator eli = this.getEli(question, -1)) {
        if (eli != null) {
            GenericValue value;
            while (((value = eli.next()) != null)) {
                String optionId = value.getString("surveyOptionSeqId");
                if (UtilValidate.isNotEmpty(optionId)) {
                    Long optCount = (Long) result.remove(optionId);
                    if (optCount == null) {
                        optCount = Long.valueOf(1);
                    } else {
                        optCount = Long.valueOf(1 + optCount.longValue());
                    }
                    result.put(optionId, optCount);
                    // increment the count
                    total++;
                }
            }
        }
    } catch (GenericEntityException e) {
        try {
            // only rollback the transaction if we started one...
            TransactionUtil.rollback(beganTransaction, "Error getting survey question responses Option result", e);
        } catch (GenericEntityException e2) {
            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module);
        }
        throw new SurveyWrapperException(e);
    } finally {
        try {
            // only commit the transaction if we started one...
            TransactionUtil.commit(beganTransaction);
        } catch (GenericEntityException e) {
            throw new SurveyWrapperException(e);
        }
    }
    result.put("_total", Long.valueOf(total));
    return result;
}
Also used : GenericValue(org.apache.ofbiz.entity.GenericValue) HashMap(java.util.HashMap) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) GenericTransactionException(org.apache.ofbiz.entity.transaction.GenericTransactionException) EntityListIterator(org.apache.ofbiz.entity.util.EntityListIterator)

Example 28 with EntityListIterator

use of org.apache.ofbiz.entity.util.EntityListIterator in project ofbiz-framework by apache.

the class CommunicationEventServices method buildListOfWorkEffortInfoFromEmailAddresses.

/*
     * Gets WorkEffort info from e-mail address and returns a List of the results for the array of addresses
     */
private static List<Map<String, Object>> buildListOfWorkEffortInfoFromEmailAddresses(Address[] addresses, GenericValue userLogin, LocalDispatcher dispatcher) throws GenericServiceException {
    InternetAddress emailAddress = null;
    Map<String, Object> result = null;
    Delegator delegator = dispatcher.getDelegator();
    List<Map<String, Object>> tempResults = new LinkedList<>();
    String caseInsensitiveEmail = EntityUtilProperties.getPropertyValue("general", "mail.address.caseInsensitive", "N", delegator);
    if (addresses != null) {
        for (Address addr : addresses) {
            if (addr instanceof InternetAddress) {
                emailAddress = (InternetAddress) addr;
                Map<String, String> inputFields = new HashMap<>();
                inputFields.put("infoString", emailAddress.getAddress());
                inputFields.put("infoString_ic", caseInsensitiveEmail);
                result = dispatcher.runSync("performFind", UtilMisc.<String, Object>toMap("entityName", "WorkEffortContactMechView", "inputFields", inputFields, "userLogin", userLogin));
                if (ServiceUtil.isError(result)) {
                    String errorMessage = ServiceUtil.getErrorMessage(result);
                    Debug.logError(errorMessage, module);
                    throw new GenericServiceException(errorMessage);
                }
                try (EntityListIterator listIt = (EntityListIterator) result.get("listIt")) {
                    List<GenericValue> list = listIt.getCompleteList();
                    List<GenericValue> filteredList = EntityUtil.filterByDate(list);
                    tempResults.addAll(filteredList);
                } catch (GenericEntityException e) {
                    Debug.logError(e, module);
                }
            }
        }
    }
    return tempResults;
}
Also used : GenericValue(org.apache.ofbiz.entity.GenericValue) InternetAddress(javax.mail.internet.InternetAddress) Address(javax.mail.Address) InternetAddress(javax.mail.internet.InternetAddress) HashMap(java.util.HashMap) LinkedList(java.util.LinkedList) Delegator(org.apache.ofbiz.entity.Delegator) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) GenericServiceException(org.apache.ofbiz.service.GenericServiceException) EntityListIterator(org.apache.ofbiz.entity.util.EntityListIterator) HashMap(java.util.HashMap) Map(java.util.Map)

Example 29 with EntityListIterator

use of org.apache.ofbiz.entity.util.EntityListIterator in project ofbiz-framework by apache.

the class PartyServices method performFindParty.

public static Map<String, Object> performFindParty(DispatchContext dctx, Map<String, ? extends Object> context) {
    Map<String, Object> result = ServiceUtil.returnSuccess();
    Delegator delegator = dctx.getDelegator();
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    Locale locale = (Locale) context.get("locale");
    String extInfo = (String) context.get("extInfo");
    EntityCondition extCond = (EntityCondition) context.get("extCond");
    EntityListIterator listIt = null;
    // get the lookup flag
    String noConditionFind = (String) context.get("noConditionFind");
    // create the dynamic view entity
    DynamicViewEntity dynamicView = new DynamicViewEntity();
    // default view settings
    dynamicView.addMemberEntity("PT", "Party");
    dynamicView.addAlias("PT", "partyId");
    dynamicView.addAlias("PT", "statusId");
    dynamicView.addAlias("PT", "partyTypeId");
    dynamicView.addAlias("PT", "externalId");
    dynamicView.addAlias("PT", "createdDate");
    dynamicView.addAlias("PT", "lastModifiedDate");
    dynamicView.addRelation("one-nofk", "", "PartyType", ModelKeyMap.makeKeyMapList("partyTypeId"));
    dynamicView.addRelation("many", "", "UserLogin", ModelKeyMap.makeKeyMapList("partyId"));
    // define the main condition & expression list
    List<EntityCondition> andExprs = new ArrayList<>();
    EntityCondition mainCond = null;
    List<String> orderBy = new ArrayList<>();
    String sortField = (String) context.get("sortField");
    if (UtilValidate.isNotEmpty(sortField)) {
        orderBy.add(sortField);
    }
    List<String> fieldsToSelect = new ArrayList<>();
    // fields we need to select; will be used to set distinct
    fieldsToSelect.add("partyId");
    fieldsToSelect.add("statusId");
    fieldsToSelect.add("partyTypeId");
    fieldsToSelect.add("externalId");
    fieldsToSelect.add("createdDate");
    fieldsToSelect.add("lastModifiedDate");
    // filter on parties that have relationship with logged in user
    String partyRelationshipTypeId = (String) context.get("partyRelationshipTypeId");
    if (UtilValidate.isNotEmpty(partyRelationshipTypeId)) {
        // add relation to view
        dynamicView.addMemberEntity("PRSHP", "PartyRelationship");
        dynamicView.addAlias("PRSHP", "partyIdTo");
        dynamicView.addAlias("PRSHP", "partyRelationshipTypeId");
        dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "partyIdTo"));
        List<String> ownerPartyIds = UtilGenerics.cast(context.get("ownerPartyIds"));
        EntityCondition relationshipCond = null;
        if (UtilValidate.isEmpty(ownerPartyIds)) {
            String partyIdFrom = userLogin.getString("partyId");
            relationshipCond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyIdFrom"), EntityOperator.EQUALS, EntityFunction.UPPER(partyIdFrom));
        } else {
            relationshipCond = EntityCondition.makeCondition("partyIdFrom", EntityOperator.IN, ownerPartyIds);
        }
        dynamicView.addAlias("PRSHP", "partyIdFrom");
        // add the expr
        andExprs.add(EntityCondition.makeCondition(relationshipCond, EntityOperator.AND, EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyRelationshipTypeId"), EntityOperator.EQUALS, EntityFunction.UPPER(partyRelationshipTypeId))));
        fieldsToSelect.add("partyIdTo");
    }
    // get the params
    String partyId = (String) context.get("partyId");
    String partyTypeId = (String) context.get("partyTypeId");
    String roleTypeId = (String) context.get("roleTypeId");
    String statusId = (String) context.get("statusId");
    String userLoginId = (String) context.get("userLoginId");
    String externalId = (String) context.get("externalId");
    String firstName = (String) context.get("firstName");
    String lastName = (String) context.get("lastName");
    String groupName = (String) context.get("groupName");
    // check for a partyId
    if (UtilValidate.isNotEmpty(partyId)) {
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + partyId + "%")));
    }
    // now the statusId - send ANY for all statuses; leave null for just enabled; or pass a specific status
    if (UtilValidate.isNotEmpty(statusId)) {
        andExprs.add(EntityCondition.makeCondition("statusId", statusId));
    } else {
        // NOTE: _must_ explicitly allow null as it is not included in a not equal in many databases... odd but true
        andExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("statusId", GenericEntity.NULL_FIELD), EntityOperator.OR, EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")));
    }
    // check for partyTypeId
    if (UtilValidate.isNotEmpty(partyTypeId)) {
        andExprs.add(EntityCondition.makeCondition("partyTypeId", partyTypeId));
    }
    if (UtilValidate.isNotEmpty(externalId)) {
        andExprs.add(EntityCondition.makeCondition("externalId", externalId));
    }
    // filter on user login
    if (UtilValidate.isNotEmpty(userLoginId)) {
        // modify the dynamic view
        dynamicView.addMemberEntity("UL", "UserLogin");
        dynamicView.addAlias("UL", "userLoginId");
        dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        // add the expr
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + userLoginId + "%")));
        fieldsToSelect.add("userLoginId");
    }
    // filter on groupName
    if (UtilValidate.isNotEmpty(groupName)) {
        // modify the dynamic view
        dynamicView.addMemberEntity("PG", "PartyGroup");
        dynamicView.addAlias("PG", "groupName");
        dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        // add the expr
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + groupName + "%")));
        fieldsToSelect.add("groupName");
    }
    // modify the dynamic view
    if (UtilValidate.isNotEmpty(firstName) || UtilValidate.isNotEmpty(lastName)) {
        dynamicView.addMemberEntity("PE", "Person");
        dynamicView.addAlias("PE", "firstName");
        dynamicView.addAlias("PE", "lastName");
        dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        fieldsToSelect.add("firstName");
        fieldsToSelect.add("lastName");
        orderBy.add("lastName");
        orderBy.add("firstName");
    }
    // filter on firstName
    if (UtilValidate.isNotEmpty(firstName)) {
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + firstName + "%")));
    }
    // filter on lastName
    if (UtilValidate.isNotEmpty(lastName)) {
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + lastName + "%")));
    }
    // filter on role member
    if (UtilValidate.isNotEmpty(roleTypeId)) {
        // add role to view
        dynamicView.addMemberEntity("PR", "PartyRole");
        dynamicView.addAlias("PR", "roleTypeId");
        dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        // add the expr
        andExprs.add(EntityCondition.makeCondition("roleTypeId", roleTypeId));
        fieldsToSelect.add("roleTypeId");
    }
    // ----
    // PartyIdentification Fields
    // ----
    String idValue = (String) context.get("idValue");
    String partyIdentificationTypeId = (String) context.get("partyIdentificationTypeId");
    if ("I".equals(extInfo) || UtilValidate.isNotEmpty(idValue) || UtilValidate.isNotEmpty(partyIdentificationTypeId)) {
        // add role to view
        dynamicView.addMemberEntity("PAI", "PartyIdentification");
        dynamicView.addAlias("PAI", "idValue");
        dynamicView.addAlias("PAI", "partyIdentificationTypeId");
        dynamicView.addViewLink("PT", "PAI", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        fieldsToSelect.add("idValue");
        fieldsToSelect.add("partyIdentificationTypeId");
        if (UtilValidate.isNotEmpty(idValue)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("idValue"), EntityOperator.LIKE, EntityFunction.UPPER("%".concat(idValue).concat("%"))));
        }
        if (UtilValidate.isNotEmpty(partyIdentificationTypeId)) {
            andExprs.add(EntityCondition.makeCondition("partyIdentificationTypeId", partyIdentificationTypeId));
        }
    }
    // ----
    // InventoryItem Fields
    // ----
    // filter on inventory item's fields
    String inventoryItemId = (String) context.get("inventoryItemId");
    String serialNumber = (String) context.get("serialNumber");
    String softIdentifier = (String) context.get("softIdentifier");
    if (UtilValidate.isNotEmpty(inventoryItemId) || UtilValidate.isNotEmpty(serialNumber) || UtilValidate.isNotEmpty(softIdentifier)) {
        // add role to view
        dynamicView.addMemberEntity("II", "InventoryItem");
        dynamicView.addAlias("II", "ownerPartyId");
        dynamicView.addViewLink("PT", "II", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "ownerPartyId"));
    }
    if (UtilValidate.isNotEmpty(inventoryItemId)) {
        dynamicView.addAlias("II", "inventoryItemId");
        // add the expr
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("inventoryItemId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + inventoryItemId + "%")));
        fieldsToSelect.add("inventoryItemId");
    }
    if (UtilValidate.isNotEmpty(serialNumber)) {
        dynamicView.addAlias("II", "serialNumber");
        // add the expr
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("serialNumber"), EntityOperator.LIKE, EntityFunction.UPPER("%" + serialNumber + "%")));
        fieldsToSelect.add("serialNumber");
    }
    if (UtilValidate.isNotEmpty(softIdentifier)) {
        dynamicView.addAlias("II", "softIdentifier");
        // add the expr
        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("softIdentifier"), EntityOperator.LIKE, EntityFunction.UPPER("%" + softIdentifier + "%")));
        fieldsToSelect.add("softIdentifier");
    }
    // ----
    // PostalAddress fields
    // ----
    String stateProvinceGeoId = (String) context.get("stateProvinceGeoId");
    if ("P".equals(extInfo) || UtilValidate.isNotEmpty(context.get("address1")) || UtilValidate.isNotEmpty(context.get("address2")) || UtilValidate.isNotEmpty(context.get("city")) || UtilValidate.isNotEmpty(context.get("postalCode")) || UtilValidate.isNotEmpty(context.get("countryGeoId")) || (UtilValidate.isNotEmpty(stateProvinceGeoId))) {
        // add address to dynamic view
        dynamicView.addMemberEntity("PC", "PartyContactMech");
        dynamicView.addMemberEntity("PA", "PostalAddress");
        dynamicView.addAlias("PC", "contactMechId");
        dynamicView.addAlias("PA", "address1");
        dynamicView.addAlias("PA", "address2");
        dynamicView.addAlias("PA", "city");
        dynamicView.addAlias("PA", "stateProvinceGeoId");
        dynamicView.addAlias("PA", "countryGeoId");
        dynamicView.addAlias("PA", "postalCode");
        dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        dynamicView.addViewLink("PC", "PA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
        // filter on address1
        String address1 = (String) context.get("address1");
        if (UtilValidate.isNotEmpty(address1)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("address1"), EntityOperator.LIKE, EntityFunction.UPPER("%" + address1 + "%")));
        }
        // filter on address2
        String address2 = (String) context.get("address2");
        if (UtilValidate.isNotEmpty(address2)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("address2"), EntityOperator.LIKE, EntityFunction.UPPER("%" + address2 + "%")));
        }
        // filter on city
        String city = (String) context.get("city");
        if (UtilValidate.isNotEmpty(city)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("city"), EntityOperator.LIKE, EntityFunction.UPPER("%" + city + "%")));
        }
        // filter on state geo
        if (UtilValidate.isNotEmpty(stateProvinceGeoId)) {
            andExprs.add(EntityCondition.makeCondition("stateProvinceGeoId", stateProvinceGeoId));
        }
        // filter on postal code
        String postalCode = (String) context.get("postalCode");
        if (UtilValidate.isNotEmpty(postalCode)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("postalCode"), EntityOperator.LIKE, EntityFunction.UPPER("%" + postalCode + "%")));
        }
        fieldsToSelect.add("postalCode");
        fieldsToSelect.add("city");
        fieldsToSelect.add("stateProvinceGeoId");
    }
    // ----
    if ("O".equals(extInfo) || UtilValidate.isNotEmpty(context.get("infoString"))) {
        // add info to dynamic view
        dynamicView.addMemberEntity("PC", "PartyContactMech");
        dynamicView.addMemberEntity("CM", "ContactMech");
        dynamicView.addAlias("PC", "contactMechId");
        dynamicView.addAlias("CM", "infoString");
        dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        dynamicView.addViewLink("PC", "CM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
        // filter on infoString
        String infoString = (String) context.get("infoString");
        if (UtilValidate.isNotEmpty(infoString)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER("%" + infoString + "%")));
            fieldsToSelect.add("infoString");
        }
    }
    // ----
    if ("T".equals(extInfo) || UtilValidate.isNotEmpty(context.get("countryCode")) || UtilValidate.isNotEmpty(context.get("areaCode")) || UtilValidate.isNotEmpty(context.get("contactNumber"))) {
        // add telecom to dynamic view
        dynamicView.addMemberEntity("PC", "PartyContactMech");
        dynamicView.addMemberEntity("TM", "TelecomNumber");
        dynamicView.addAlias("PC", "contactMechId");
        dynamicView.addAlias("TM", "countryCode");
        dynamicView.addAlias("TM", "areaCode");
        dynamicView.addAlias("TM", "contactNumber");
        dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
        dynamicView.addViewLink("PC", "TM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
        // filter on countryCode
        String countryCode = (String) context.get("countryCode");
        if (UtilValidate.isNotEmpty(countryCode)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("countryCode"), EntityOperator.EQUALS, EntityFunction.UPPER(countryCode)));
        }
        // filter on areaCode
        String areaCode = (String) context.get("areaCode");
        if (UtilValidate.isNotEmpty(areaCode)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("areaCode"), EntityOperator.EQUALS, EntityFunction.UPPER(areaCode)));
        }
        // filter on contact number
        String contactNumber = (String) context.get("contactNumber");
        if (UtilValidate.isNotEmpty(contactNumber)) {
            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("contactNumber"), EntityOperator.EQUALS, EntityFunction.UPPER(contactNumber)));
        }
        fieldsToSelect.add("contactNumber");
        fieldsToSelect.add("areaCode");
    }
    // build the main condition, add the extend condition is it present
    if (UtilValidate.isNotEmpty(extCond)) {
        andExprs.add(extCond);
    }
    if (UtilValidate.isNotEmpty(andExprs)) {
        mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
    }
    if (Debug.infoOn()) {
        Debug.logInfo("In findParty mainCond=" + mainCond, module);
    }
    // do the lookup
    if (UtilValidate.isNotEmpty(noConditionFind) && ("Y".equals(noConditionFind) || andExprs.size() > 1)) {
        // exclude on condition the status expr
        try {
            // set distinct on so we only get one row per party
            // using list iterator
            listIt = EntityQuery.use(delegator).select(UtilMisc.toSet(fieldsToSelect)).from(dynamicView).where(mainCond).orderBy(orderBy).cursorScrollInsensitive().distinct().queryIterator();
        } catch (GenericEntityException e) {
            String errMsg = "Failure in party find operation, rolling back transaction: " + e.toString();
            Debug.logError(e, errMsg, module);
            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupPartyError", UtilMisc.toMap("errMessage", e.toString()), locale));
        }
    }
    result.put("listIt", listIt);
    return result;
}
Also used : Locale(java.util.Locale) GenericValue(org.apache.ofbiz.entity.GenericValue) EntityCondition(org.apache.ofbiz.entity.condition.EntityCondition) ArrayList(java.util.ArrayList) DynamicViewEntity(org.apache.ofbiz.entity.model.DynamicViewEntity) Delegator(org.apache.ofbiz.entity.Delegator) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) EntityListIterator(org.apache.ofbiz.entity.util.EntityListIterator)

Example 30 with EntityListIterator

use of org.apache.ofbiz.entity.util.EntityListIterator in project ofbiz-framework by apache.

the class PartyServices method findParty.

// migration from ftl to widget in process.
@Deprecated
public static Map<String, Object> findParty(DispatchContext dctx, Map<String, ? extends Object> context) {
    Map<String, Object> result = ServiceUtil.returnSuccess();
    Delegator delegator = dctx.getDelegator();
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    Locale locale = (Locale) context.get("locale");
    String extInfo = (String) context.get("extInfo");
    // get the role types
    try {
        List<GenericValue> roleTypes = EntityQuery.use(delegator).from("RoleType").orderBy("description").queryList();
        result.put("roleTypes", roleTypes);
    } catch (GenericEntityException e) {
        String errMsg = "Error looking up RoleTypes: " + e.toString();
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupRoleTypeError", UtilMisc.toMap("errMessage", e.toString()), locale));
    }
    // current role type
    String roleTypeId;
    try {
        roleTypeId = (String) context.get("roleTypeId");
        if (UtilValidate.isNotEmpty(roleTypeId)) {
            GenericValue currentRole = EntityQuery.use(delegator).from("RoleType").where("roleTypeId", roleTypeId).cache().queryOne();
            result.put("currentRole", currentRole);
        }
    } catch (GenericEntityException e) {
        String errMsg = "Error looking up current RoleType: " + e.toString();
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupRoleTypeError", UtilMisc.toMap("errMessage", e.toString()), locale));
    }
    // get party types
    try {
        List<GenericValue> partyTypes = EntityQuery.use(delegator).from("PartyType").orderBy("description").queryList();
        result.put("partyTypes", partyTypes);
    } catch (GenericEntityException e) {
        String errMsg = "Error looking up PartyTypes: " + e.toString();
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupPartyTypeError", UtilMisc.toMap("errMessage", e.toString()), locale));
    }
    // current party type
    String partyTypeId;
    try {
        partyTypeId = (String) context.get("partyTypeId");
        if (UtilValidate.isNotEmpty(partyTypeId)) {
            GenericValue currentPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", partyTypeId).cache().queryOne();
            result.put("currentPartyType", currentPartyType);
        }
    } catch (GenericEntityException e) {
        String errMsg = "Error looking up current PartyType: " + e.toString();
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupPartyTypeError", UtilMisc.toMap("errMessage", e.toString()), locale));
    }
    // current state
    String stateProvinceGeoId;
    try {
        stateProvinceGeoId = (String) context.get("stateProvinceGeoId");
        if (UtilValidate.isNotEmpty(stateProvinceGeoId)) {
            GenericValue currentStateGeo = EntityQuery.use(delegator).from("Geo").where("geoId", stateProvinceGeoId).cache().queryOne();
            result.put("currentStateGeo", currentStateGeo);
        }
    } catch (GenericEntityException e) {
        String errMsg = "Error looking up current stateProvinceGeo: " + e.toString();
        Debug.logError(e, errMsg, module);
        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupStateProvinceGeoError", UtilMisc.toMap("errMessage", e.toString()), locale));
    }
    // set the page parameters
    int viewIndex = 0;
    try {
        viewIndex = Integer.parseInt((String) context.get("VIEW_INDEX"));
    } catch (Exception e) {
        viewIndex = 0;
    }
    result.put("viewIndex", Integer.valueOf(viewIndex));
    int viewSize = 20;
    try {
        viewSize = Integer.parseInt((String) context.get("VIEW_SIZE"));
    } catch (Exception e) {
        viewSize = 20;
    }
    result.put("viewSize", Integer.valueOf(viewSize));
    // get the lookup flag
    String lookupFlag = (String) context.get("lookupFlag");
    // blank param list
    String paramList = "";
    List<GenericValue> partyList = null;
    int partyListSize = 0;
    int lowIndex = 0;
    int highIndex = 0;
    if ("Y".equals(lookupFlag)) {
        String showAll = (context.get("showAll") != null ? (String) context.get("showAll") : "N");
        paramList = paramList + "&lookupFlag=" + lookupFlag + "&showAll=" + showAll + "&extInfo=" + extInfo;
        // create the dynamic view entity
        DynamicViewEntity dynamicView = new DynamicViewEntity();
        // default view settings
        dynamicView.addMemberEntity("PT", "Party");
        dynamicView.addAlias("PT", "partyId");
        dynamicView.addAlias("PT", "statusId");
        dynamicView.addAlias("PT", "partyTypeId");
        dynamicView.addAlias("PT", "createdDate");
        dynamicView.addAlias("PT", "lastModifiedDate");
        dynamicView.addRelation("one-nofk", "", "PartyType", ModelKeyMap.makeKeyMapList("partyTypeId"));
        dynamicView.addRelation("many", "", "UserLogin", ModelKeyMap.makeKeyMapList("partyId"));
        // define the main condition & expression list
        List<EntityCondition> andExprs = new LinkedList<>();
        EntityCondition mainCond = null;
        List<String> orderBy = new LinkedList<>();
        List<String> fieldsToSelect = new LinkedList<>();
        // fields we need to select; will be used to set distinct
        fieldsToSelect.add("partyId");
        fieldsToSelect.add("statusId");
        fieldsToSelect.add("partyTypeId");
        fieldsToSelect.add("createdDate");
        fieldsToSelect.add("lastModifiedDate");
        // filter on parties that have relationship with logged in user
        String partyRelationshipTypeId = (String) context.get("partyRelationshipTypeId");
        if (UtilValidate.isNotEmpty(partyRelationshipTypeId)) {
            // add relation to view
            dynamicView.addMemberEntity("PRSHP", "PartyRelationship");
            dynamicView.addAlias("PRSHP", "partyIdTo");
            dynamicView.addAlias("PRSHP", "partyRelationshipTypeId");
            dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "partyIdTo"));
            List<String> ownerPartyIds = UtilGenerics.cast(context.get("ownerPartyIds"));
            EntityCondition relationshipCond = null;
            if (UtilValidate.isEmpty(ownerPartyIds)) {
                String partyIdFrom = userLogin.getString("partyId");
                paramList = paramList + "&partyIdFrom=" + partyIdFrom;
                relationshipCond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyIdFrom"), EntityOperator.EQUALS, EntityFunction.UPPER(partyIdFrom));
            } else {
                relationshipCond = EntityCondition.makeCondition("partyIdFrom", EntityOperator.IN, ownerPartyIds);
            }
            dynamicView.addAlias("PRSHP", "partyIdFrom");
            // add the expr
            andExprs.add(EntityCondition.makeCondition(relationshipCond, EntityOperator.AND, EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyRelationshipTypeId"), EntityOperator.EQUALS, EntityFunction.UPPER(partyRelationshipTypeId))));
            fieldsToSelect.add("partyIdTo");
        }
        // get the params
        String partyId = (String) context.get("partyId");
        String statusId = (String) context.get("statusId");
        String userLoginId = (String) context.get("userLoginId");
        String firstName = (String) context.get("firstName");
        String lastName = (String) context.get("lastName");
        String groupName = (String) context.get("groupName");
        if (!"Y".equals(showAll)) {
            // check for a partyId
            if (UtilValidate.isNotEmpty(partyId)) {
                paramList = paramList + "&partyId=" + partyId;
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + partyId + "%")));
            }
            // now the statusId - send ANY for all statuses; leave null for just enabled; or pass a specific status
            if (statusId != null) {
                paramList = paramList + "&statusId=" + statusId;
                if (!"ANY".equalsIgnoreCase(statusId)) {
                    andExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId));
                }
            } else {
                // NOTE: _must_ explicitly allow null as it is not included in a not equal in many databases... odd but true
                andExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")));
            }
            // check for partyTypeId
            if (partyTypeId != null && !"ANY".equals(partyTypeId)) {
                paramList = paramList + "&partyTypeId=" + partyTypeId;
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyTypeId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + partyTypeId + "%")));
            }
            // filter on user login
            if (UtilValidate.isNotEmpty(userLoginId)) {
                paramList = paramList + "&userLoginId=" + userLoginId;
                // modify the dynamic view
                dynamicView.addMemberEntity("UL", "UserLogin");
                dynamicView.addAlias("UL", "userLoginId");
                dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                // add the expr
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + userLoginId + "%")));
                fieldsToSelect.add("userLoginId");
            }
            // filter on groupName
            if (UtilValidate.isNotEmpty(groupName)) {
                paramList = paramList + "&groupName=" + groupName;
                // modify the dynamic view
                dynamicView.addMemberEntity("PG", "PartyGroup");
                dynamicView.addAlias("PG", "groupName");
                dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                // add the expr
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + groupName + "%")));
                fieldsToSelect.add("groupName");
            }
            // modify the dynamic view
            if (UtilValidate.isNotEmpty(firstName) || UtilValidate.isNotEmpty(lastName)) {
                dynamicView.addMemberEntity("PE", "Person");
                dynamicView.addAlias("PE", "firstName");
                dynamicView.addAlias("PE", "lastName");
                dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                fieldsToSelect.add("firstName");
                fieldsToSelect.add("lastName");
                orderBy.add("lastName");
                orderBy.add("firstName");
            }
            // filter on firstName
            if (UtilValidate.isNotEmpty(firstName)) {
                paramList = paramList + "&firstName=" + firstName;
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + firstName + "%")));
            }
            // filter on lastName
            if (UtilValidate.isNotEmpty(lastName)) {
                paramList = paramList + "&lastName=" + lastName;
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + lastName + "%")));
            }
            // filter on role member
            if (roleTypeId != null && !"ANY".equals(roleTypeId)) {
                paramList = paramList + "&roleTypeId=" + roleTypeId;
                // add role to view
                dynamicView.addMemberEntity("PR", "PartyRole");
                dynamicView.addAlias("PR", "roleTypeId");
                dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                // add the expr
                andExprs.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, roleTypeId));
                fieldsToSelect.add("roleTypeId");
            }
            // ----
            // InventoryItem Fields
            // ----
            // filter on inventory item's fields
            String inventoryItemId = (String) context.get("inventoryItemId");
            String serialNumber = (String) context.get("serialNumber");
            String softIdentifier = (String) context.get("softIdentifier");
            if (UtilValidate.isNotEmpty(inventoryItemId) || UtilValidate.isNotEmpty(serialNumber) || UtilValidate.isNotEmpty(softIdentifier)) {
                // add role to view
                dynamicView.addMemberEntity("II", "InventoryItem");
                dynamicView.addAlias("II", "ownerPartyId");
                dynamicView.addViewLink("PT", "II", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "ownerPartyId"));
            }
            if (UtilValidate.isNotEmpty(inventoryItemId)) {
                paramList = paramList + "&inventoryItemId=" + inventoryItemId;
                dynamicView.addAlias("II", "inventoryItemId");
                // add the expr
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("inventoryItemId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + inventoryItemId + "%")));
                fieldsToSelect.add("inventoryItemId");
            }
            if (UtilValidate.isNotEmpty(serialNumber)) {
                paramList = paramList + "&serialNumber=" + serialNumber;
                dynamicView.addAlias("II", "serialNumber");
                // add the expr
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("serialNumber"), EntityOperator.LIKE, EntityFunction.UPPER("%" + serialNumber + "%")));
                fieldsToSelect.add("serialNumber");
            }
            if (UtilValidate.isNotEmpty(softIdentifier)) {
                paramList = paramList + "&softIdentifier=" + softIdentifier;
                dynamicView.addAlias("II", "softIdentifier");
                // add the expr
                andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("softIdentifier"), EntityOperator.LIKE, EntityFunction.UPPER("%" + softIdentifier + "%")));
                fieldsToSelect.add("softIdentifier");
            }
            // ----
            if ("P".equals(extInfo)) {
                // add address to dynamic view
                dynamicView.addMemberEntity("PC", "PartyContactMech");
                dynamicView.addMemberEntity("PA", "PostalAddress");
                dynamicView.addAlias("PC", "contactMechId");
                dynamicView.addAlias("PA", "address1");
                dynamicView.addAlias("PA", "address2");
                dynamicView.addAlias("PA", "city");
                dynamicView.addAlias("PA", "stateProvinceGeoId");
                dynamicView.addAlias("PA", "countryGeoId");
                dynamicView.addAlias("PA", "postalCode");
                dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                dynamicView.addViewLink("PC", "PA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
                // filter on address1
                String address1 = (String) context.get("address1");
                if (UtilValidate.isNotEmpty(address1)) {
                    paramList = paramList + "&address1=" + address1;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("address1"), EntityOperator.LIKE, EntityFunction.UPPER("%" + address1 + "%")));
                }
                // filter on address2
                String address2 = (String) context.get("address2");
                if (UtilValidate.isNotEmpty(address2)) {
                    paramList = paramList + "&address2=" + address2;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("address2"), EntityOperator.LIKE, EntityFunction.UPPER("%" + address2 + "%")));
                }
                // filter on city
                String city = (String) context.get("city");
                if (UtilValidate.isNotEmpty(city)) {
                    paramList = paramList + "&city=" + city;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("city"), EntityOperator.LIKE, EntityFunction.UPPER("%" + city + "%")));
                }
                // filter on state geo
                if (stateProvinceGeoId != null && !"ANY".equals(stateProvinceGeoId)) {
                    paramList = paramList + "&stateProvinceGeoId=" + stateProvinceGeoId;
                    andExprs.add(EntityCondition.makeCondition("stateProvinceGeoId", EntityOperator.EQUALS, stateProvinceGeoId));
                }
                // filter on postal code
                String postalCode = (String) context.get("postalCode");
                if (UtilValidate.isNotEmpty(postalCode)) {
                    paramList = paramList + "&postalCode=" + postalCode;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("postalCode"), EntityOperator.LIKE, EntityFunction.UPPER("%" + postalCode + "%")));
                }
                fieldsToSelect.add("postalCode");
                fieldsToSelect.add("city");
                fieldsToSelect.add("stateProvinceGeoId");
            }
            // ----
            if ("O".equals(extInfo)) {
                // add info to dynamic view
                dynamicView.addMemberEntity("PC", "PartyContactMech");
                dynamicView.addMemberEntity("CM", "ContactMech");
                dynamicView.addAlias("PC", "contactMechId");
                dynamicView.addAlias("CM", "infoString");
                dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                dynamicView.addViewLink("PC", "CM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
                // filter on infoString
                String infoString = (String) context.get("infoString");
                if (UtilValidate.isNotEmpty(infoString)) {
                    paramList = paramList + "&infoString=" + infoString;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER("%" + infoString + "%")));
                    fieldsToSelect.add("infoString");
                }
            }
            // ----
            if ("T".equals(extInfo)) {
                // add telecom to dynamic view
                dynamicView.addMemberEntity("PC", "PartyContactMech");
                dynamicView.addMemberEntity("TM", "TelecomNumber");
                dynamicView.addAlias("PC", "contactMechId");
                dynamicView.addAlias("TM", "countryCode");
                dynamicView.addAlias("TM", "areaCode");
                dynamicView.addAlias("TM", "contactNumber");
                dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
                dynamicView.addViewLink("PC", "TM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
                // filter on countryCode
                String countryCode = (String) context.get("countryCode");
                if (UtilValidate.isNotEmpty(countryCode)) {
                    paramList = paramList + "&countryCode=" + countryCode;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("countryCode"), EntityOperator.EQUALS, EntityFunction.UPPER(countryCode)));
                }
                // filter on areaCode
                String areaCode = (String) context.get("areaCode");
                if (UtilValidate.isNotEmpty(areaCode)) {
                    paramList = paramList + "&areaCode=" + areaCode;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("areaCode"), EntityOperator.EQUALS, EntityFunction.UPPER(areaCode)));
                }
                // filter on contact number
                String contactNumber = (String) context.get("contactNumber");
                if (UtilValidate.isNotEmpty(contactNumber)) {
                    paramList = paramList + "&contactNumber=" + contactNumber;
                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("contactNumber"), EntityOperator.EQUALS, EntityFunction.UPPER(contactNumber)));
                }
                fieldsToSelect.add("contactNumber");
                fieldsToSelect.add("areaCode");
            }
            // build the main condition
            if (andExprs.size() > 0) {
                mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
            }
        }
        Debug.logInfo("In findParty mainCond=" + mainCond, module);
        String sortField = (String) context.get("sortField");
        if (UtilValidate.isNotEmpty(sortField)) {
            orderBy.add(sortField);
        }
        // do the lookup
        if (mainCond != null || "Y".equals(showAll)) {
            lowIndex = viewIndex * viewSize + 1;
            highIndex = (viewIndex + 1) * viewSize;
            // set distinct on so we only get one row per order
            // using list iterator
            EntityQuery eq = EntityQuery.use(delegator).select(UtilMisc.toSet(fieldsToSelect)).from(dynamicView).where(mainCond).orderBy(orderBy).cursorScrollInsensitive().fetchSize(highIndex).distinct();
            try (EntityListIterator pli = eq.queryIterator()) {
                // get the partial list for this page
                partyList = pli.getPartialList(lowIndex, viewSize);
                // attempt to get the full size
                partyListSize = pli.getResultsSizeAfterPartialList();
                if (highIndex > partyListSize) {
                    highIndex = partyListSize;
                }
            } catch (GenericEntityException e) {
                String errMsg = "Failure in party find operation, rolling back transaction: " + e.toString();
                Debug.logError(e, errMsg, module);
                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "PartyLookupPartyError", UtilMisc.toMap("errMessage", e.toString()), locale));
            }
        } else {
            partyListSize = 0;
        }
    }
    if (partyList == null) {
        partyList = new LinkedList<>();
    }
    result.put("partyList", partyList);
    result.put("partyListSize", Integer.valueOf(partyListSize));
    result.put("paramList", paramList);
    result.put("highIndex", Integer.valueOf(highIndex));
    result.put("lowIndex", Integer.valueOf(lowIndex));
    return result;
}
Also used : Locale(java.util.Locale) GenericValue(org.apache.ofbiz.entity.GenericValue) EntityCondition(org.apache.ofbiz.entity.condition.EntityCondition) EntityQuery(org.apache.ofbiz.entity.util.EntityQuery) GenericServiceException(org.apache.ofbiz.service.GenericServiceException) IOException(java.io.IOException) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) LinkedList(java.util.LinkedList) DynamicViewEntity(org.apache.ofbiz.entity.model.DynamicViewEntity) Delegator(org.apache.ofbiz.entity.Delegator) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) EntityListIterator(org.apache.ofbiz.entity.util.EntityListIterator)

Aggregations

EntityListIterator (org.apache.ofbiz.entity.util.EntityListIterator)65 GenericValue (org.apache.ofbiz.entity.GenericValue)59 GenericEntityException (org.apache.ofbiz.entity.GenericEntityException)57 Delegator (org.apache.ofbiz.entity.Delegator)33 EntityCondition (org.apache.ofbiz.entity.condition.EntityCondition)29 LinkedList (java.util.LinkedList)25 HashMap (java.util.HashMap)24 Timestamp (java.sql.Timestamp)23 Locale (java.util.Locale)21 EntityQuery (org.apache.ofbiz.entity.util.EntityQuery)19 GenericTransactionException (org.apache.ofbiz.entity.transaction.GenericTransactionException)18 Map (java.util.Map)16 GenericServiceException (org.apache.ofbiz.service.GenericServiceException)13 LocalDispatcher (org.apache.ofbiz.service.LocalDispatcher)12 DynamicViewEntity (org.apache.ofbiz.entity.model.DynamicViewEntity)8 ModelKeyMap (org.apache.ofbiz.entity.model.ModelKeyMap)8 GeneralException (org.apache.ofbiz.base.util.GeneralException)7 ModelEntity (org.apache.ofbiz.entity.model.ModelEntity)7 ArrayList (java.util.ArrayList)6 EntityExpr (org.apache.ofbiz.entity.condition.EntityExpr)6