You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/12/23 11:27:35 UTC
svn commit: r1819138 - in /ofbiz/ofbiz-framework/trunk/applications/party:
minilang/party/PartyServices.xml servicedef/services_view.xml
src/main/java/org/apache/ofbiz/party/party/PartyServices.java
Author: mbrohl
Date: Sat Dec 23 11:27:35 2017
New Revision: 1819138
URL: http://svn.apache.org/viewvc?rev=1819138&view=rev
Log:
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.
Modified:
ofbiz/ofbiz-framework/trunk/applications/party/minilang/party/PartyServices.xml
ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
Modified: ofbiz/ofbiz-framework/trunk/applications/party/minilang/party/PartyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/minilang/party/PartyServices.xml?rev=1819138&r1=1819137&r2=1819138&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/minilang/party/PartyServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/minilang/party/PartyServices.xml Sat Dec 23 11:27:35 2017
@@ -375,27 +375,6 @@ under the License.
<field-to-result field="parameters.contentId" result-name="contentId"/>
</simple-method>
- <!-- get parties based on PartyRelationship -->
- <simple-method method-name="getPartiesByRelationship"
- short-description="Gets all parties related to partyIdFrom using the PartyRelationship entity" login-required="false">
- <set from-field="parameters.partyIdFrom" field="lookupMap.partyIdFrom"/>
- <set from-field="parameters.partyIdTo" field="lookupMap.partyIdTo"/>
- <set from-field="parameters.roleTypeIdFrom" field="lookupMap.roleTypeIdFrom"/>
- <set from-field="parameters.roleTypeIdTo" field="lookupMap.roleTypeIdTo"/>
- <set from-field="parameters.statusId" field="lookupMap.statusId"/>
- <set from-field="parameters.priorityTypeId" field="lookupMap.priorityTypeId"/>
- <set from-field="parameters.partyRelationshipTypeId" field="lookupMap.partyRelationshipTypeId"/>
-
- <find-by-and entity-name="PartyRelationship" map="lookupMap" list="partyRelationships"/>
- <iterate list="partyRelationships" entry="partyRelationship">
- <get-related-one value-field="partyRelationship" relation-name="ToParty" to-value-field="party"/>
- <field-to-list field="party" list="parties"/>
- </iterate>
- <if-not-empty field="parties">
- <field-to-result field="parties"/>
- </if-not-empty>
- </simple-method>
-
<simple-method method-name="getParentOrganizations" short-description="Gets Parent Organizations for an Organization Party">
<set from-field="parameters.organizationPartyId" field="relatedPartyIdList[]"/>
<set from-field="parameters.getParentsOfParents" field="recurse"/>
Modified: ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml?rev=1819138&r1=1819137&r2=1819138&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml Sat Dec 23 11:27:35 2017
@@ -125,76 +125,6 @@ under the License.
<attribute name="lookupPerson" type="org.apache.ofbiz.entity.GenericValue" mode="OUT"/>
</service>
- <service name="getPartiesFromExactEmail" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromExactEmail">
- <description>Gets a collection of parties from an exact email address, uses SQL EQUALS</description>
- <attribute name="email" type="String" mode="IN"/>
- <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
- </service>
-
- <service name="getPartiesFromPartOfEmail" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPartOfEmail">
- <description>Gets a collection of parties from a part of an email address, uses SQL LIKE</description>
- <attribute name="email" type="String" mode="IN"/>
- <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
- </service>
-
- <service name="getPartiesFromPartOfUserloginId" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPartOfUserloginId">
- <description>Gets a collection of parties from a part of an UserloginId, uses SQL LIKE</description>
- <attribute name="userLoginId" type="String" mode="IN"/>
- <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
- </service>
-
- <service name="getPartiesFromName" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPerson">
- <description>Gets a collection of parties from a first/last name, uses SQL LIKE</description>
- <attribute name="firstName" type="String" mode="IN" optional="true"/>
- <attribute name="lastName" type="String" mode="IN" optional="true"/>
- <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
- </service>
-
- <service name="getPartiesFromGroupName" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromPartyGroup">
- <description>Gets a collection of parties from a group name, uses SQL LIKE</description>
- <attribute name="groupName" type="String" mode="IN" optional="false"/>
- <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
- </service>
-
- <service name="getPartiesFromExternalId" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartiesFromExternalId">
- <description>Gets a list of parties from a party externalId </description>
- <attribute name="externalId" type="String" mode="IN" optional="false"/>
- <attribute name="parties" type="java.util.List" mode="OUT" optional="true"/>
- </service>
-
- <service name="getPartiesByRelationship" engine="simple"
- location="component://party/minilang/party/PartyServices.xml" invoke="getPartiesByRelationship">
- <description>Gets all parties related to partyIdFrom through the PartyRelationship entity</description>
- <auto-attributes mode="IN" include="all" optional="true" entity-name="PartyRelationship"/>
- <attribute name="parties" type="java.util.Collection" mode="OUT" optional="true"/>
- <override name="partyIdFrom" optional="false"/>
- </service>
- <service name="getRelatedParties" engine="simple"
- location="component://party/minilang/party/PartyServices.xml" invoke="getRelatedParties">
- <description>
- 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"
- </description>
- <attribute name="partyIdFrom" type="String" mode="IN" optional="false"/>
- <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
- <attribute name="roleTypeIdFrom" type="String" mode="IN" optional="true"/>
- <attribute name="roleTypeIdFromInclueAllChildTypes" type="String" mode="IN" optional="true"/>
- <attribute name="roleTypeIdTo" type="String" mode="IN" optional="true"/>
- <attribute name="roleTypeIdToIncludeAllChildTypes" type="String" mode="IN" optional="true"/>
- <attribute name="includeFromToSwitched" type="String" mode="IN" optional="true"/>
- <attribute name="recurse" type="String" mode="IN" optional="true"/>
- <attribute name="useCache" type="String" mode="IN" optional="true"/>
- <attribute name="relatedPartyIdList" type="List" mode="OUT" optional="false"/>
- </service>
-
<service name="getParentOrganizations" engine="simple"
location="component://party/minilang/party/PartyServices.xml" invoke="getParentOrganizations">
<description>
Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java?rev=1819138&r1=1819137&r2=1819138&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java Sat Dec 23 11:27:35 2017
@@ -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.GenericEn
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<String, Object> getPartiesFromExactEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
- Map<String, Object> result = new HashMap<>();
- Delegator delegator = dctx.getDelegator();
- Collection<Map<String, GenericValue>> 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<GenericValue> 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.<String, GenericValue>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<String, Object> getPartiesFromPartOfEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
- Map<String, Object> result = new HashMap<>();
- Delegator delegator = dctx.getDelegator();
- Collection<Map<String, GenericValue>> 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<GenericValue> 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.<String, GenericValue>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<String, Object> getPartiesFromPartOfUserloginId(DispatchContext dctx, Map<String, ? extends Object> context) {
- Debug.logWarning("Running the getPartiesFromPartOfUserloginId Service...", module);
- Map<String, Object> result = new HashMap<>();
- Delegator delegator = dctx.getDelegator();
- Collection<Map<String, GenericValue>> 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<GenericValue> 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.<String, GenericValue>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<String, Object> getPartiesFromPerson(DispatchContext dctx, Map<String, ? extends Object> context) {
- Map<String, Object> result = new HashMap<>();
- Delegator delegator = dctx.getDelegator();
- Collection<Map<String, GenericValue>> 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<EntityExpr> 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<GenericValue> 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.<String, GenericValue>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<String, Object> getPartiesFromPartyGroup(DispatchContext dctx, Map<String, ? extends Object> context) {
- Map<String, Object> result = new HashMap<>();
- Delegator delegator = dctx.getDelegator();
- Collection<Map<String, GenericValue>> 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<GenericValue> 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.<String, GenericValue>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<String, Object> getPartiesFromExternalId(DispatchContext dctx, Map<String, ? extends Object> context) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
- Delegator delegator = dctx.getDelegator();
- List<GenericValue> 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<String, Object> getPerson(DispatchContext dctx, Map<String, ? extends Object> context) {
Map<String, Object> result = new HashMap<>();
Delegator delegator = dctx.getDelegator();