http://ofbiz.116.s1.nabble.com/Dev-entity-insert-event-tp167999p168010.html
entity back in context. so I guess I'll leave it out
> Jacopo,
>
> Do I have to put the updated entity back in context or can I take that
> line out?
>
> Thanx for your help.
> Fred
>
>
> Jacopo Cappellato wrote:
>
>>Fred,
>>
>>try to change the "event" attribute from "return" to "validate" (in the
>>eca definition).
>>
>>Jacopo
>>
>>
>>
>>Fred Forester wrote:
>>
>>
>>>Hi Jacopo,
>>>
>>>Seems you are more awake than I :)
>>>
>>>
>>>
>>>Jacopo Cappellato wrote:
>>>
>>>
>>>>Hi Fred,
>>>>
>>>>there is no patch here...
>>>>
>>>>Jacopo
>>>>
>>>>Fred Forester wrote:
>>>>
>>>>
>>>>
>>>>>I Have it coded up and the EECA is getting control and I see the
>>>>>converted sha password in the log but the updates to the entity are
>>>>>not getting back to the databasse. the eeca's do not seem to have a
>>>>>result value as most of the seca's do. I tried storing the updated
>>>>>entity back in the context and also tried returning a result.
>>>>>
>>>>>I attached a patch. maybe someone can tell me what I am missing.
>>>>>
>>>>>Thanx
>>>>>Fred
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>David E Jones wrote:
>>>>>
>>>>>
>>>>>
>>>>>>I guess a good way to put it is to say that SECAs should be used for
>>>>>>logic and process oriented things, and EECAs should really only be
>>>>>>used for data maintenance, like populating fields derived from other
>>>>>>fields (in the same or other entities).
>>>>>>
>>>>>>-David
>>>>>>
>>>>>>
>>>>>>Si Chen wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Just going off our Payments EECA discussion--perhaps "deprecated"
>>>>>>>is the wrong word, but I guess it's not really recommended for
>>>>>>>tying things together. Si
>>>>>>>
>>>>>>>David E Jones wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Si,
>>>>>>>>
>>>>>>>>Yeah, what do you mean by deprecated? The Entity ECAs are not
>>>>>>>>deprecated to the best of my knowledge, but there are certainly
>>>>>>>>circumstances where they should and should not be used...
>>>>>>>>
>>>>>>>>-David
>>>>>>>>
>>>>>>>>
>>>>>>>>Si Chen wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Yes that is what you want, but FYI it is "deprecated"--search
>>>>>>>>>this archive for comments.
>>>>>>>>>
>>>>>>>>>Si
>>>>>>>>>
>>>>>>>>>Fred Forester wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>looks like entity-eca is what I want
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Fred Forester wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>Hi all,
>>>>>>>>>>>
>>>>>>>>>>>I need to see how to run an event when an entity is created. is
>>>>>>>>>>>there something like that in ofbiz I can look at?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Thanx
>>>>>>>>>>>Fred
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>_______________________________________________
>>>>>>>>>>>Dev mailing list
>>>>>>>>>>>
[hidden email]
>>>>>>>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>_______________________________________________
>>>>>>>>>>Dev mailing list
>>>>>>>>>>
[hidden email]
>>>>>>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>------------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>_______________________________________________
>>>>>>>>>Dev mailing list
>>>>>>>>>
[hidden email]
>>>>>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>>>>>
>>>>>>>>
>>>>>>>>_______________________________________________
>>>>>>>>Dev mailing list
>>>>>>>>
[hidden email]
>>>>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>------------------------------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>_______________________________________________
>>>>>>>Dev mailing list
>>>>>>>
[hidden email]
>>>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>>
>>>>>>
>>>>>>_______________________________________________
>>>>>>Dev mailing list
>>>>>>
[hidden email]
>>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>Dev mailing list
>>>>>
[hidden email]
>>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>>
>>>>
>>>>
>>>>
>>>>_______________________________________________
>>>>Dev mailing list
>>>>
[hidden email]
>>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>>
>>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>Index: applications/party/servicedef/services.xml
>>>===================================================================
>>>--- applications/party/servicedef/services.xml (revision 28)
>>>+++ applications/party/servicedef/services.xml (working copy)
>>>@@ -28,6 +28,13 @@
>>> <version>1.0</version>
>>>
>>> <!-- Party services -->
>>>+
>>>+ <service name="convertImportedPassword" engine="java"
>>>+ location="org.ofbiz.party.party.PartyServices" invoke="convertImportedPassword" auth="false">
>>>+ <description></description>
>>>+ <attribute name="userLoginInstance" type="GenericValue" mode="IN" optional="true"/>
>>>+ </service>
>>>+
>>> <service name="createAddressMatchMap" engine="simple" default-entity-name="AddressMatchMap" auth="true"
>>> location="org/ofbiz/party/party/PartyServices.xml" invoke="createAddressMatchMap">
>>> <description>Create an AddressMatchMap record</description>
>>>Index: applications/party/src/org/ofbiz/party/party/PartyServices.java
>>>===================================================================
>>>--- applications/party/src/org/ofbiz/party/party/PartyServices.java (revision 28)
>>>+++ applications/party/src/org/ofbiz/party/party/PartyServices.java (working copy)
>>>@@ -62,6 +62,8 @@
>>>import org.ofbiz.service.LocalDispatcher;
>>>import org.ofbiz.service.GenericServiceException;
>>>
>>>+import org.ofbiz.base.crypto.HashCrypt;
>>>+
>>>/**
>>> * Services for Party/Person/Group maintenance
>>> *
>>>@@ -76,6 +78,32 @@
>>> public static final String resource = "PartyUiLabels";
>>>
>>> /**
>>>+ * Converts a cleartext password
>>>+ * @param ctx 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 convertImportedPassword(DispatchContext ctx, Map context) {
>>>+ Map result = ServiceUtil.returnSuccess();
>>>+ GenericValue userLogin = (GenericValue) context.get("userLoginInstance");
>>>+ Debug.logInfo("convertImportedPassword", module);
>>>+ if (userLogin != null)
>>>+ {
>>>+ String currentPassword = (String)userLogin.get("currentPassword");
>>>+ String newPassword = HashCrypt.getDigestHash(currentPassword);
>>>+ userLogin.set("currentPassword",newPassword);
>>>+ userLogin.set("importConvertPassword","N");
>>>+ context.put("userLoginInstance",userLogin);
>>>+ Debug.logInfo("converting password : " + userLogin.get("currentPassword"), module);
>>>+ }
>>>+ else
>>>+ {
>>>+ return ServiceUtil.returnError("No Content found.");
>>>+ }
>>>+ return result;
>>>+ }
>>>+
>>>+ /**
>>> * Deletes a Party.
>>> * @param ctx The DispatchContext that this service is operating in.
>>> * @param context Map containing the input parameters.
>>>Index: applications/party/ofbiz-component.xml
>>>===================================================================
>>>--- applications/party/ofbiz-component.xml (revision 28)
>>>+++ applications/party/ofbiz-component.xml (working copy)
>>>@@ -32,6 +32,7 @@
>>>
>>> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
>>> <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
>>>+ <entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/>
>>> <entity-resource type="data" reader-name="seed" loader="main" location="data/PartyTypeData.xml"/>
>>> <entity-resource type="data" reader-name="seed" loader="main" location="data/PartySecurityData.xml"/>
>>> <service-resource type="model" loader="main" location="servicedef/services.xml"/>
>>>Index: applications/party/entitydef/eecas.xml
>>>===================================================================
>>>--- applications/party/entitydef/eecas.xml (revision 33)
>>>+++ applications/party/entitydef/eecas.xml (working copy)
>>>@@ -24,8 +24,11 @@
>>><entity-eca xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:noNamespaceSchemaLocation="
http://www.ofbiz.org/dtds/entity-eca.xsd">
>>> <!-- Product Keyword Indexing ECAs -->
>>>+
>>> <eca entity="UserLogin" operation="create-store" event="return">
>>> <condition field-name="importConvertPassword" operator="equals" value="Y"/>
>>> <action service="convertImportedPassword" mode="sync" value-attr="userLoginInstance"/>
>>> </eca>
>>>+
>>>+
>>></entity-eca>
>>>Index: framework/security/entitydef/entitymodel.xml
>>>===================================================================
>>>--- framework/security/entitydef/entitymodel.xml (revision 28)
>>>+++ framework/security/entitydef/entitymodel.xml (working copy)
>>>@@ -66,6 +66,7 @@
>>> <field name="lastLocale" type="very-short"></field>
>>> <field name="disabledDateTime" type="date-time"></field>
>>> <field name="successiveFailedLogins" type="numeric"></field>
>>>+ <field name="importConvertPassword" type="indicator"></field>
>>> <prim-key field="userLoginId"/>
>>> <relation type="one" fk-name="USER_PARTY" rel-entity-name="Party">
>>> <key-map field-name="partyId"/>
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>
>>>_______________________________________________
>>>Dev mailing list
>>>
[hidden email]
>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>
>>
>>
>>_______________________________________________
>>Dev mailing list
>>
[hidden email]
>>
http://lists.ofbiz.org/mailman/listinfo/dev>>
>>
>
>
> _______________________________________________
> Dev mailing list
>
[hidden email]
>
http://lists.ofbiz.org/mailman/listinfo/dev>
>