Trigger dependent workflows on build life status assignment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Trigger dependent workflows on build life status assignment

James Martin
Hello,

 

I have some originating workflows that have several dependencies
defined.  I would like these workflows to generate a new build life
whenever any one of its dependencies has had one of its build lives
promoted with a specific status label.

 

I thought that this could be achieved using Event Scripts, but I can't
seem to find a way to do something like this given the set of events and
event data that are available from the API.  We are on version 3.8.3 of
AnthillPro.

 

Has anyone out there done something similar?  How do you do it?

 

Thanks,

James

_______________________________________________
Anthill-pro mailing list
[hidden email]
http://lists.urbancode.com/mailman/listinfo/anthill-pro
Reply | Threaded
Open this post in threaded view
|

Re: Trigger dependent workflows on build life status assignment

Jon Neel
Here is an example event filter that fires when a build life is archived.
 You should be able to use this as a starting point to fire an event off
when a certain status is applied.  I suggest taking a look at
BuildLifeStatusAppliedEvent.

import java.util.*;

import com.urbancode.anthill3.domain.persistent.Handle;
import com.urbancode.anthill3.domain.trigger.event.*;
import com.urbancode.anthill3.domain.workflow.*;
import com.urbancode.anthill3.services.event.*;
import com.urbancode.anthill3.services.event.criteria.*;
import com.urbancode.anthill3.domain.buildlife.BuildLifeStatusAppliedEvent;
import com.urbancode.anthill3.domain.status.Status;

import org.apache.log4j.Logger;

    // Event filter script to detect when a build life is archived.

    public class BuildLifeArchivedEventFilter implements EventFilter {
        Handle triggerHandle = null;


//----------------------------------------------------------------------
        public BuildLifeArchivedEventFilter (EventTrigger trigger) {
            this.triggerHandle = new Handle(trigger);
        }


//----------------------------------------------------------------------
        public Class getEventClass() {
            //return WorkflowEndEvent.class;
            return BuildLifeStatusAppliedEvent.class;
        }


//----------------------------------------------------------------------
        public Criteria[] getCriteria() {
            Criteria[] result = null;

            EventTrigger trigger =
(EventTrigger)triggerHandle.dereference();

            result = new Criteria[]{
                    new FieldEqualsCriteria("project", project),
                    new FieldEqualsCriteria("status",
Status.STATUS_ARCHIVED)
            };

            return result;
        }

    };

return new BuildLifeArchivedEventFilter(trigger);

Thanks,
Jon Neel
Support Developer
Urbancode, Inc.
Direct Line: (216) 539-0141
http://support.urbancode.com
http://www.urbancode.com



On Mon, Oct 15, 2012 at 11:10 AM, James Martin <[hidden email]> wrote:

> Hello,
>
>
>
> I have some originating workflows that have several dependencies
> defined.  I would like these workflows to generate a new build life
> whenever any one of its dependencies has had one of its build lives
> promoted with a specific status label.
>
>
>
> I thought that this could be achieved using Event Scripts, but I can't
> seem to find a way to do something like this given the set of events and
> event data that are available from the API.  We are on version 3.8.3 of
> AnthillPro.
>
>
>
> Has anyone out there done something similar?  How do you do it?
>
>
>
> Thanks,
>
> James
>
> _______________________________________________
> Anthill-pro mailing list
> [hidden email]
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>
_______________________________________________
Anthill-pro mailing list
[hidden email]
http://lists.urbancode.com/mailman/listinfo/anthill-pro