Hi Fabio,

I have configured the ServiceTask(s) as we discussed and those are getting triggered appropriately. But what ever changes I'm making while create/update are not getting propagated to Syncope. Let me explain what I have done:
          protected void doExecute(final DelegateExecution execution) throws Exception {
            UserTO userTO = (UserTO) execution.getVariable(ActivitiUserWorkflowAdapter.USER_TO);
            attrValue = userTO.getAttributeMap().get("email").getValues().get(0);
            //extract domain .......
             .......
               AttributeTO attributeTO = new AttributeTO();
            attributeTO.setValues(new ArrayList<String>(Arrays.asList(domain)));
            userTO.getAttributeMap().put("domain", attributeTO);
            execution.setVariable(
                    ActivitiUserWorkflowAdapter.USER_TO, userTO);
         }
    public void setStringAttributeValues(final SyncopeUser user, final String attributeName,
                                         final String[] attributeValues) {
        logger.info("Setting attribute {} for user {} with value {}.", new Object[]{attributeName, user,
                attributeValues});
        UAttr uAttr = user.getAttribute(attributeName);
        if (uAttr == null) {
            USchema attributeSchema = this.schemaDAO.find(attributeName, USchema.class);

            uAttr = new UAttr();
            uAttr.setSchema(attributeSchema);
            uAttr.setOwner(user);
            user.addAttribute(uAttr);

        }
        if (attributeValues == null) {
            uAttr.setValues(new ArrayList<AbstractAttrValue>());
        } else {
            List<UAttrValue> valueList = new ArrayList<UAttrValue>();
            for (String s : attributeValues) {
                UAttrValue uAttrValue = new UAttrValue();
                uAttrValue.setStringValue(s);
                valueList.add(uAttrValue);

            }
            uAttr.setValues(valueList);
        }

    }

Please let me know the correct approach for Create (CreateBefore) and Update (UpdateBefore).

Regards,
Antony.
On Fri, Mar 23, 2012 at 2:28 PM, Antony Pulicken <antony.pulicken@gmail.com> wrote:
Thanks Fabio. Even I was thinking in the same direction. I will try that.

Regards,
Antony.


On Fri, Mar 23, 2012 at 1:36 PM, Fabio Martelli <fabio.martelli@gmail.com> wrote:

Il giorno 23/mar/2012, alle ore 08.04, Antony Pulicken ha scritto:

> Hi,
>
> In the earlier version of Syncope, we could add pre and post functions for each 'action' in the Syncope OS Workflow XML for doing some additional processing/transformation of the data before/after the actions are executed.
>
> Does any one know how that can be done in Activiti ? I'm able to add listeners for the 'userTask' that listens to the events like create,complete, etc. But this doesn't seem to be working for 'serviceTask'. I will be posting this question in Activiti forums as well.  But please let me know in case any one has any suggestion.

Hi Antony,
I can suggest you to use one or more ServiceTask.

For example:

<sequenceFlow id="flow1" sourceRef="theStart" targetRef="beforeCreate"/>
<serviceTask id="beforeCreate" name="BeforeCreate" activiti:class="org.syncope.core.workflow.activiti.MyBeforeActions"/>
<sequenceFlow id="flow2" sourceRef="beforeCreate" targetRef="create"/>
<serviceTask id="create" name="Create" activiti:class="org.syncope.core.workflow.activiti.Create"/>
......
<sequenceFlow id="flow7" sourceRef="... source ref..." targetRef="afterCreate"/>
<serviceTask id="afterCreate" name="AfterCreate" activiti:class="org.syncope.core.workflow.activiti.MyAfterActions"/>
<sequenceFlow id="flow8" sourceRef="afterCreate" targetRef="theEnd"/>
<endEvent id="theEnd"/>

Regards,
F.