svn commit: r1815300 - in /ofbiz/ofbiz-framework/trunk/applications/party: servicedef/services_view.xml src/main/java/org/apache/ofbiz/party/party/PartyServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1815300 - in /ofbiz/ofbiz-framework/trunk/applications/party: servicedef/services_view.xml src/main/java/org/apache/ofbiz/party/party/PartyServices.java

jleroux@apache.org
Author: jleroux
Date: Wed Nov 15 10:19:21 2017
New Revision: 1815300

URL: http://svn.apache.org/viewvc?rev=1815300&view=rev
Log:
Improved: Refactoring methods of PartyServices.java
(OFBIZ-9982)

The methods names and services were ambiguous, this renames them to clearly
show they return a list of parties and not a party

Thanks: Suraj and Michael for discussion at
http://markmail.org/message/ii7w4vgwusaqxjla

Modified:
    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/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml?rev=1815300&r1=1815299&r2=1815300&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services_view.xml Wed Nov 15 10:19:21 2017
@@ -125,37 +125,44 @@ under the License.
         <attribute name="lookupPerson" type="org.apache.ofbiz.entity.GenericValue" mode="OUT"/>
     </service>
 
-    <service name="getPartyFromEmail" engine="java"
-            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartyFromEmail">
-        <description>Gets a collection of parties from an email address</description>
+    <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="getPartyFromUserLogin" engine="java"
-            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartyFromUserLogin">
-        <description>Gets a collection of parties from an email address</description>
+    <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="getPartyFromName" engine="java"
-            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartyFromPerson">
-        <description>Gets a collection of parties from a first/last name</description>
+    <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="getPartyFromGroupName" engine="java"
-            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartyFromPartyGroup">
-        <description>Gets a collection of parties from a party group namee</description>
+    <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="getPartyFromExternalId" engine="java"
-            location="org.apache.ofbiz.party.party.PartyServices" invoke="getPartyFromExternalId">
+    <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"/>

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=1815300&r1=1815299&r2=1815300&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 Wed Nov 15 10:19:21 2017
@@ -701,7 +701,7 @@ public class PartyServices {
      * @param context Map containing the input parameters.
      * @return Map with the result of the service, the output parameters.
      */
-    public static Map<String, Object> getPartyFromExactEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
+    public static Map<String, Object> getPartiesFromExactEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> result = new HashMap<String, Object>();
         Delegator delegator = dctx.getDelegator();
         Collection<Map<String, GenericValue>> parties = new LinkedList<Map<String,GenericValue>>();
@@ -739,7 +739,7 @@ public class PartyServices {
         return result;
     }
 
-    public static Map<String, Object> getPartyFromEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
+    public static Map<String, Object> getPartiesFromPartOfEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> result = new HashMap<String, Object>();
         Delegator delegator = dctx.getDelegator();
         Collection<Map<String, GenericValue>> parties = new LinkedList<Map<String,GenericValue>>();
@@ -783,8 +783,8 @@ public class PartyServices {
      * @param context Map containing the input parameters.
      * @return Map with the result of the service, the output parameters.
      */
-    public static Map<String, Object> getPartyFromUserLogin(DispatchContext dctx, Map<String, ? extends Object> context) {
-        Debug.logWarning("Running the getPartyFromUserLogin Service...", module);
+    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<String, Object>();
         Delegator delegator = dctx.getDelegator();
         Collection<Map<String, GenericValue>> parties = new LinkedList<Map<String,GenericValue>>();
@@ -827,7 +827,7 @@ public class PartyServices {
      * @param context Map containing the input parameters.
      * @return Map with the result of the service, the output parameters.
      */
-    public static Map<String, Object> getPartyFromPerson(DispatchContext dctx, Map<String, ? extends Object> context) {
+    public static Map<String, Object> getPartiesFromPerson(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> result = new HashMap<String, Object>();
         Delegator delegator = dctx.getDelegator();
         Collection<Map<String, GenericValue>> parties = new LinkedList<Map<String,GenericValue>>();
@@ -877,7 +877,7 @@ public class PartyServices {
      * @param context Map containing the input parameters.
      * @return Map with the result of the service, the output parameters.
      */
-    public static Map<String, Object> getPartyFromPartyGroup(DispatchContext dctx, Map<String, ? extends Object> context) {
+    public static Map<String, Object> getPartiesFromPartyGroup(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> result = new HashMap<String, Object>();
         Delegator delegator = dctx.getDelegator();
         Collection<Map<String, GenericValue>> parties = new LinkedList<Map<String,GenericValue>>();
@@ -886,7 +886,7 @@ public class PartyServices {
 
         if (groupName.length() == 0) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource,
-                    "PartyCannotGetPartyFromPartyGroup", locale));
+                    "PartyCannotgetPartiesFromPartyGroup", locale));
         }
 
         try {
@@ -920,7 +920,7 @@ public class PartyServices {
      * @param context Map containing the input parameters.
      * @return Map with the result of the service, the output parameters.
      */
-    public static Map<String, Object> getPartyFromExternalId(DispatchContext dctx, Map<String, ? extends Object> context) {
+    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 = new ArrayList<>();