1 16 package org.springframework.webflow.engine.support; 17 18 import org.springframework.util.Assert; 19 import org.springframework.webflow.engine.ActionExecutor; 20 import org.springframework.webflow.engine.TransitionCriteria; 21 import org.springframework.webflow.execution.Action; 22 import org.springframework.webflow.execution.Event; 23 import org.springframework.webflow.execution.RequestContext; 24 25 38 public class ActionTransitionCriteria implements TransitionCriteria { 39 40 44 private String trueEventId = "success"; 45 46 50 private Action action; 51 52 56 public ActionTransitionCriteria(Action action) { 57 this.action = action; 58 } 59 60 65 public String getTrueEventId() { 66 return trueEventId; 67 } 68 69 74 public void setTrueEventId(String trueEventId) { 75 Assert.notNull(trueEventId, "The trueEventId is required"); 76 this.trueEventId = trueEventId; 77 } 78 79 83 protected Action getAction() { 84 return action; 85 } 86 87 public boolean test(RequestContext context) { 88 Event result = ActionExecutor.execute(getAction(), context); 89 return result != null && getTrueEventId().equals(result.getId()); 90 } 91 } | Popular Tags |