Version Differences for Event Selector

Line 1:
    + This page lists event-selector (used for event triggers) scripts listed in the scripting site. These scripts were taken straight from the public JIRA site. Please note that some scripts may be snippets and probably WILL need modification to work properly for your situation. Treat these as templates that you can modify from.  
       
    + = Trigger on First Success After Failed Workflow =  
       
    + Script Notes:  
    + * This script goes in System --> Event Selector  
       
    + ==== AHPSCRIPTS-11 ====  
       
    + <pre>import com.urbancode.anthill3.domain.workflow.*;  
    + import com.urbancode.anthill3.domain.buildlife.*;  
       
    + result = false;  
       
    + if (event instanceof WorkflowEvent &&  
    + event.getCase().isComplete() &&  
    + event.getCase().getStatus().isSuccess()) {  
    + currentSuccess = event.getCase().getBuildLife();  
    + lastFailure = BuildLifeFactory.getInstance().restorePriorMostRecentFailureForProfile(currentSuccess, currentSuccess.getProfile());  
    + lastSuccess = BuildLifeFactory.getInstance().restorePriorMostRecentSuccessForProfile(currentSuccess, currentSuccess.getProfile());  
    + if (lastFailure != null) {  
    + if (lastSuccess == null || lastFailure.getStartDate().after(lastSuccess.getStartDate())) {  
    + // This is a build fix  
    + result = true;  
    + }  
    + }  
    + }  
       
    + return result;</pre>