incubator-syncope-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Pulicken <>
Subject Re: Task Listeners in Syncope workflow for <serviceTask>
Date Wed, 28 Mar 2012 05:50:10 GMT
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:

   - Configured service task before the Create/Update tasks
   - The tasks that I created are extending AbstractActivitiDelegate
   (Thought it will help in case I need to make use of UserDataBinder, ConfDAO
   - Let me give an example of the processing that I need to do in In the
   doExecute method in my service task. I'm trying to extract the domain name
   from the email and assign it to another filed that I created in the schema
   by name 'domain'
   - In case of createBefore, I'm retrieving the email value from UserTO

          protected void doExecute(final DelegateExecution execution)
throws Exception {
            UserTO userTO = (UserTO)
            attrValue =
            //extract domain .......
               AttributeTO attributeTO = new AttributeTO();
            userTO.getAttributeMap().put("domain", attributeTO);
                    ActivitiUserWorkflowAdapter.USER_TO, userTO);

   - Then the org.syncope.core.workflow.activiti.Create gets invoked and I
   can' find the above changes in there
   - In case of update, I tried the approach that we were using with the
   old version and that also doesn't seem to work. Please see the code snippet

    public void setStringAttributeValues(final SyncopeUser user, final
String attributeName,
                                         final String[] attributeValues) {"Setting attribute {} for user {} with value {}.", new
Object[]{attributeName, user,
        UAttr uAttr = user.getAttribute(attributeName);
        if (uAttr == null) {
            USchema attributeSchema = this.schemaDAO.find(attributeName,

            uAttr = new UAttr();

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



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

On Fri, Mar 23, 2012 at 2:28 PM, Antony Pulicken

> 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 <>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.

View raw message