| 1 16 package nl.hippo.cms.workflow.conditions; 17 18 import com.opensymphony.module.propertyset.PropertySet; 19 import com.opensymphony.workflow.Condition; 20 import com.opensymphony.workflow.WorkflowException; 21 import com.opensymphony.workflow.spi.Step; 22 import com.opensymphony.workflow.spi.WorkflowEntry; 23 import com.opensymphony.workflow.spi.WorkflowStore; 24 import java.util.Iterator ; 25 import java.util.List ; 26 import java.util.Map ; 27 import org.apache.avalon.framework.logger.AbstractLogEnabled; 28 import org.apache.avalon.framework.thread.ThreadSafe; 29 30 33 public class IsWorkflowInStep extends AbstractLogEnabled 34 implements Condition, ThreadSafe { 35 36 public IsWorkflowInStep() { 37 super(); 38 } 39 40 public boolean passesCondition(Map transientVars, Map args, PropertySet ps) 41 throws WorkflowException { 42 43 final WorkflowStore store = (WorkflowStore) transientVars.get("store"); 44 final WorkflowEntry entry = (WorkflowEntry) transientVars.get("entry"); 45 final int stepId = Integer.parseInt((String ) args.get("stepId")); 46 47 final List currentSteps = store.findCurrentSteps(entry.getId()); 48 final Iterator currentStepsIterator = currentSteps.iterator(); 49 50 while (currentStepsIterator.hasNext()) { 51 final Step currentStep = (Step) currentStepsIterator.next(); 52 if (currentStep.getStepId() == stepId) { 53 return true; 54 } 55 } 56 57 return false; 58 } 59 60 } 61 | Popular Tags |