From 00a5d3413a238e0d2b18f2e076cd90670a2e5f71 Mon Sep 17 00:00:00 2001 From: Michael Brohl Date: Sat, 23 Dec 2017 11:27:35 +0000 Subject: [PATCH] Improved: Remove unused services from party/services_view.xml and PartyServices.java/.xml. (OFBIZ-9988) The removed code is not used anywhere in the codebase. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1819138 13f79535-47bb-0310-9956-ffa450edef68 --- .../party/minilang/party/PartyServices.xml | 21 -- .../party/servicedef/services_view.xml | 70 ----- .../ofbiz/party/party/PartyServices.java | 270 ------------------ 3 files changed, 361 deletions(-) diff --git a/applications/party/minilang/party/PartyServices.xml b/applications/party/minilang/party/PartyServices.xml index fcdebf7783..57b2621701 100644 --- a/applications/party/minilang/party/PartyServices.xml +++ b/applications/party/minilang/party/PartyServices.xml @@ -375,27 +375,6 @@ under the License. - - - - - - - - - - - - - - - - - - - - diff --git a/applications/party/servicedef/services_view.xml b/applications/party/servicedef/services_view.xml index 4aeb8df7d8..22bc60e9ac 100644 --- a/applications/party/servicedef/services_view.xml +++ b/applications/party/servicedef/services_view.xml @@ -125,76 +125,6 @@ under the License. - - Gets a collection of parties from an exact email address, uses SQL EQUALS - - - - - - Gets a collection of parties from a part of an email address, uses SQL LIKE - - - - - - Gets a collection of parties from a part of an UserloginId, uses SQL LIKE - - - - - - Gets a collection of parties from a first/last name, uses SQL LIKE - - - - - - - Gets a collection of parties from a group name, uses SQL LIKE - - - - - - Gets a list of parties from a party externalId - - - - - - Gets all parties related to partyIdFrom through the PartyRelationship entity - - - - - - - Get Parties Related to a Party - - The relatedPartyIdList coming out will include the original partyIdFrom - - The includeFromToSwitched and recurse attributes should by "Y" or "N" and default to N. - - The useCache attribute should be "true" or "false", defaults to "false" - - - - - - - - - - - - - diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java index 52b76cede1..0268fee38e 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java @@ -26,7 +26,6 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -46,8 +45,6 @@ import org.apache.ofbiz.entity.GenericEntity; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityConditionList; -import org.apache.ofbiz.entity.condition.EntityExpr; import org.apache.ofbiz.entity.condition.EntityFunction; import org.apache.ofbiz.entity.condition.EntityOperator; import org.apache.ofbiz.entity.model.DynamicViewEntity; @@ -696,273 +693,6 @@ public class PartyServices { return result; } - /** - * Get the party object(s) from an e-mail address - * @param dctx The DispatchContext that this service is operating in. - * @param context Map containing the input parameters. - * @return Map with the result of the service, the output parameters. - */ - public static Map getPartiesFromExactEmail(DispatchContext dctx, Map context) { - Map result = new HashMap<>(); - Delegator delegator = dctx.getDelegator(); - Collection> parties = new LinkedList<>(); - String email = (String) context.get("email"); - Locale locale = (Locale) context.get("locale"); - - if (email.length() == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.required_parameter_email_cannot_be_empty", locale)); - } - - try { - List c = EntityQuery.use(delegator).from("PartyAndContactMech") - .where(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.EQUALS, EntityFunction.UPPER(email.toUpperCase(Locale.getDefault())))) - .orderBy("infoString") - .filterByDate() - .queryList(); - - if (Debug.verboseOn()) { - Debug.logVerbose("List: " + c, module); - } - if (Debug.infoOn()) { - Debug.logInfo("PartyFromEmail number found: " + c.size(), module); - } - if (c != null) { - for (GenericValue pacm: c) { - GenericValue party = delegator.makeValue("Party", UtilMisc.toMap("partyId", pacm.get("partyId"), "partyTypeId", pacm.get("partyTypeId"))); - - parties.add(UtilMisc.toMap("party", party)); - } - } - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.cannot_get_party_entities_read", - UtilMisc.toMap("errMessage", e.getMessage()), locale)); - } - if (parties.size() > 0) { - result.put("parties", parties); - } - return result; - } - - public static Map getPartiesFromPartOfEmail(DispatchContext dctx, Map context) { - Map result = new HashMap<>(); - Delegator delegator = dctx.getDelegator(); - Collection> parties = new LinkedList<>(); - String email = (String) context.get("email"); - Locale locale = (Locale) context.get("locale"); - - if (email.length() == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.required_parameter_email_cannot_be_empty", locale)); - } - - try { - List c = EntityQuery.use(delegator).from("PartyAndContactMech") - .where(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER(("%" + email.toUpperCase(Locale.getDefault())) + "%"))) - .orderBy("infoString") - .filterByDate() - .queryList(); - - if (Debug.verboseOn()) { - Debug.logVerbose("List: " + c, module); - } - if (Debug.infoOn()) { - Debug.logInfo("PartyFromEmail number found: " + c.size(), module); - } - if (c != null) { - for (GenericValue pacm: c) { - GenericValue party = delegator.makeValue("Party", UtilMisc.toMap("partyId", pacm.get("partyId"), "partyTypeId", pacm.get("partyTypeId"))); - - parties.add(UtilMisc.toMap("party", party)); - } - } - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.cannot_get_party_entities_read", - UtilMisc.toMap("errMessage", e.getMessage()), locale)); - } - if (parties.size() > 0) { - result.put("parties", parties); - } - return result; - } - - /** - * Get the party object(s) from a user login ID - * @param dctx The DispatchContext that this service is operating in. - * @param context Map containing the input parameters. - * @return Map with the result of the service, the output parameters. - */ - public static Map getPartiesFromPartOfUserloginId(DispatchContext dctx, Map context) { - Debug.logWarning("Running the getPartiesFromPartOfUserloginId Service...", module); - Map result = new HashMap<>(); - Delegator delegator = dctx.getDelegator(); - Collection> parties = new LinkedList<>(); - String userLoginId = (String) context.get("userLoginId"); - Locale locale = (Locale) context.get("locale"); - - if (userLoginId.length() == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "PartyCannotGetUserLoginFromParty", locale)); - } - - try { - Collection ulc = EntityQuery.use(delegator).from("PartyAndUserLogin") - .where(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + userLoginId.toUpperCase(Locale.getDefault()) + "%"))) - .orderBy("userLoginId") - .queryList(); - - if (Debug.verboseOn()) { - Debug.logVerbose("Collection: " + ulc, module); - } - if (Debug.infoOn()) { - Debug.logInfo("PartyFromUserLogin number found: " + ulc.size(), module); - } - if (ulc != null) { - for (GenericValue ul: ulc) { - GenericValue party = delegator.makeValue("Party", UtilMisc.toMap("partyId", ul.get("partyId"), "partyTypeId", ul.get("partyTypeId"))); - - parties.add(UtilMisc.toMap("party", party)); - } - } - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.cannot_get_party_entities_read", - UtilMisc.toMap("errMessage", e.getMessage()), locale)); - } - if (UtilValidate.isNotEmpty(parties)) { - result.put("parties", parties); - } - return result; - } - - /** - * Get the party object(s) from person information - * @param dctx The DispatchContext that this service is operating in. - * @param context Map containing the input parameters. - * @return Map with the result of the service, the output parameters. - */ - public static Map getPartiesFromPerson(DispatchContext dctx, Map context) { - Map result = new HashMap<>(); - Delegator delegator = dctx.getDelegator(); - Collection> parties = new LinkedList<>(); - String firstName = (String) context.get("firstName"); - String lastName = (String) context.get("lastName"); - Locale locale = (Locale) context.get("locale"); - - if (firstName == null) { - firstName = ""; - } - if (lastName == null) { - lastName = ""; - } - if (firstName.length() == 0 && lastName.length() == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.both_names_cannot_be_empty", locale)); - } - - try { - EntityConditionList ecl = EntityCondition.makeCondition(EntityOperator.AND, - EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, - EntityFunction.UPPER("%" + firstName.toUpperCase(Locale.getDefault()) + "%")), - EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, - EntityFunction.UPPER("%" + lastName.toUpperCase(Locale.getDefault()) + "%"))); - Collection pc = EntityQuery.use(delegator).from("Person").where(ecl).orderBy("lastName", "firstName", "partyId").queryList(); - - if (Debug.infoOn()) { - Debug.logInfo("PartyFromPerson number found: " + pc.size(), module); - } - if (pc != null) { - for (GenericValue person: pc) { - GenericValue party = delegator.makeValue("Party", UtilMisc.toMap("partyId", person.get("partyId"), "partyTypeId", "PERSON")); - - parties.add(UtilMisc.toMap("person", person, "party", party)); - } - } - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.cannot_get_party_entities_read", - UtilMisc.toMap("errMessage", e.getMessage()), locale)); - } - if (parties.size() > 0) { - result.put("parties", parties); - } - return result; - } - - /** - * Get the party object(s) from party group name. - * @param dctx The DispatchContext that this service is operating in. - * @param context Map containing the input parameters. - * @return Map with the result of the service, the output parameters. - */ - public static Map getPartiesFromPartyGroup(DispatchContext dctx, Map context) { - Map result = new HashMap<>(); - Delegator delegator = dctx.getDelegator(); - Collection> parties = new LinkedList<>(); - String groupName = (String) context.get("groupName"); - Locale locale = (Locale) context.get("locale"); - - if (groupName.length() == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "PartyCannotgetPartiesFromPartyGroup", locale)); - } - - try { - Collection pc = EntityQuery.use(delegator).from("PartyGroup") - .where(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + groupName.toUpperCase(Locale.getDefault()) + "%"))) - .orderBy("groupName", "partyId") - .queryList(); - - if (Debug.infoOn()) { - Debug.logInfo("PartyFromGroup number found: " + pc.size(), module); - } - if (pc != null) { - for (GenericValue group: pc) { - GenericValue party = delegator.makeValue("Party", UtilMisc.toMap("partyId", group.get("partyId"), "partyTypeId", "PARTY_GROUP")); - - parties.add(UtilMisc.toMap("partyGroup", group, "party", party)); - } - } - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.cannot_get_party_entities_read", - UtilMisc.toMap("errMessage", e.getMessage()), locale)); - } - if (parties.size() > 0) { - result.put("parties", parties); - } - return result; - } - - /** - * Get the party object(s) from party externalId. - * @param dctx The DispatchContext that this service is operating in. - * @param context Map containing the input parameters. - * @return Map with the result of the service, the output parameters. - */ - public static Map getPartiesFromExternalId(DispatchContext dctx, Map context) { - Map result = ServiceUtil.returnSuccess(); - Delegator delegator = dctx.getDelegator(); - List parties; - String externalId = (String) context.get("externalId"); - Locale locale = (Locale) context.get("locale"); - - try { - parties = EntityQuery.use(delegator).from("Party") - .where(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("externalId"), EntityOperator.EQUALS, EntityFunction.UPPER(externalId))) - .orderBy("externalId", "partyId") - .queryList(); - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "partyservices.cannot_get_party_entities_read", - UtilMisc.toMap("errMessage", e.getMessage()), locale)); - } - result.put("parties", parties); - return result; - } - public static Map getPerson(DispatchContext dctx, Map context) { Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator();