1 package org.sapia.soto.state; 2 3 import org.sapia.util.xml.confix.ConfigurationException; 4 import org.sapia.util.xml.confix.ObjectHandlerIF; 5 6 7 21 public class StepState extends ExecContainer implements State, ObjectHandlerIF { 22 private String _errState; 23 private String _successState; 24 private String _id; 25 26 public StepState() { 27 super(); 28 } 29 30 35 public void setId(String id) { 36 _id = id; 37 } 38 39 42 public String getId() { 43 return _id; 44 } 45 46 50 public void setError(String errState) { 51 _errState = errState; 52 } 53 54 58 public void setSuccess(String successState) { 59 _successState = successState; 60 } 61 62 65 public void handleObject(String name, Object obj) 66 throws ConfigurationException { 67 if (obj instanceof Step) { 68 _execs.add(obj); 69 } 70 } 71 72 75 protected void handleError(Result res) { 76 if (_errState != null) { 77 try { 78 res.exec(_errState, null); 79 } catch (StateExecException e) { 80 res.error(e); 81 82 return; 83 } 84 } 85 } 86 87 90 protected void handleSuccess(Result st) { 91 st.setNextStateId(_successState); 92 } 93 } 94 | Popular Tags |