KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > graph > log > ActionLog


1 package org.jbpm.graph.log;
2
3 import java.io.PrintWriter JavaDoc;
4 import java.io.StringWriter JavaDoc;
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 JavaDoc exception = null;
15
16   public ActionLog() {
17   }
18
19   public ActionLog(Action action) {
20     this.action = action;
21   }
22
23   public String JavaDoc toString() {
24     StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
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 JavaDoc exception) {
37     StringWriter JavaDoc stringWriter = new StringWriter JavaDoc();
38     exception.printStackTrace(new PrintWriter JavaDoc(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 JavaDoc getException() {
48     return exception;
49   }
50 }
51
Popular Tags