1 package org.jbpm.graph.log; 2 3 import java.io.PrintWriter ; 4 import java.io.StringWriter ; 5 6 import org.jbpm.graph.def.Action; 7 import org.jbpm.logging.log.CompositeLog; 8 9 public class ActionLog extends CompositeLog { 10 11 private static final long serialVersionUID = 1L; 12 13 protected Action action = null; 14 protected String exception = null; 15 16 public ActionLog() { 17 } 18 19 public ActionLog(Action action) { 20 this.action = action; 21 } 22 23 public String toString() { 24 StringBuffer buffer = new StringBuffer (); 25 buffer.append("action["); 26 buffer.append(action); 27 if (exception!=null) { 28 buffer.append(", threw '"); 29 buffer.append(exception); 30 buffer.append("'"); 31 } 32 buffer.append("]"); 33 return buffer.toString(); 34 } 35 36 public void setException(Throwable exception) { 37 StringWriter stringWriter = new StringWriter (); 38 exception.printStackTrace(new PrintWriter (stringWriter)); 39 this.exception = stringWriter.toString(); 40 } 41 public Action getAction() { 42 return action; 43 } 44 public void setAction(Action action) { 45 this.action = action; 46 } 47 public String getException() { 48 return exception; 49 } 50 } 51 | Popular Tags |