1 package org.sapia.soto.state.util; 2 3 import org.apache.commons.lang.ClassUtils; 4 5 import org.sapia.soto.state.Result; 6 import org.sapia.soto.state.Step; 7 8 9 18 public class Push implements Step { 19 private String _from; 20 private String _key; 21 22 25 public String getName() { 26 return ClassUtils.getShortClassName(getClass()); 27 } 28 29 public void setFrom(String from) { 30 _from = from; 31 } 32 33 public void setKey(String key) { 34 _key = key; 35 } 36 37 40 public void execute(Result res) { 41 if (_key == null) { 42 throw new IllegalStateException ("'key' not specified"); 43 } 44 45 Object toExport; 46 47 if (_from != null) { 48 toExport = res.getContext().get(_key, _from); 49 } else { 50 toExport = res.getContext().get(_key); 51 } 52 53 if (toExport != null) { 54 res.getContext().push(toExport); 55 } 56 } 57 } 58 | Popular Tags |