| 1 package org.sapia.soto.state; 2 3 import org.apache.commons.lang.ClassUtils; 4 5 6 17 public class StateRef implements Step { 18 private String _id; 19 private String _module; 20 21 public StateRef() { 22 } 23 24 27 public String getName() { 28 return ClassUtils.getShortClassName(getClass()); 29 } 30 31 34 public void setId(String id) { 35 _id = id; 36 } 37 38 41 public String getId() { 42 return _id; 43 } 44 45 48 public void setModule(String module) { 49 _module = module; 50 } 51 52 55 public void execute(Result res) { 56 if (_id == null) { 57 throw new IllegalStateException ("'id' not specified on stateRef"); 58 } 59 60 String currentState = res.getCurrentStateId(); 61 62 try { 63 res.exec(_id, _module); 64 } catch (StateExecException e) { 65 res.error(e); 66 67 return; 68 } 69 70 res.setCurrentStateId(currentState); 71 } 72 } 73 | Popular Tags |