Author: jleroux
Date: Mon Jan 11 19:49:20 2010
New Revision: 898030
URL:
http://svn.apache.org/viewvc?rev=898030&view=revLog:
Enhance the importVCard service to allow to use other services than the one used OOTB.
I have simply added a serviceContext map which may receive the extra parameters needed by other services. These services still need to create a Party.
Modified:
ofbiz/trunk/applications/marketing/servicedef/services.xml
ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=898030&r1=898029&r2=898030&view=diff==============================================================================
--- ofbiz/trunk/applications/marketing/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/marketing/servicedef/services.xml Mon Jan 11 19:49:20 2010
@@ -480,6 +480,7 @@
<service name="importVCard" engine="java" location="org.ofbiz.sfa.vcard.VCard" invoke="importVCard">
<attribute name="infile" type="java.nio.ByteBuffer" mode="IN" optional="false"/>
<attribute name="partyId" type="String" mode="OUT" optional="false"/>
+ <attribute name="serviceContext" type="Map" mode="IN" optional="false"/>
<attribute name="serviceName" type="String" mode="IN" optional="false"/>
</service>
<service name="exportVCard" engine="java" location="org.ofbiz.sfa.vcard.VCard" invoke="exportVCard">
Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=898030&r1=898029&r2=898030&view=diff==============================================================================
--- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original)
+++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Mon Jan 11 19:49:20 2010
@@ -47,6 +47,7 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
@@ -166,6 +167,10 @@
GenericValue userLogin = (GenericValue) context.get("userLogin");
serviceCtx.put("userLogin", userLogin);
String serviceName = (String) context.get("serviceName");
+ Map<String, Object> serviceContext = UtilGenerics.cast(context.get("serviceContext"));
+ for(Map.Entry<String, Object> entry : serviceContext.entrySet()) {
+ serviceCtx.put(entry.getKey(), entry.getValue());
+ }
Map<String, Object> resp = dispatcher.runSync(serviceName, serviceCtx);
result.put("partyId", resp.get("partyId"));
}