01: package org.drools.audit.event;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: /**
20: * A ruleflow event logged by the WorkingMemoryLogger.
21: * It is a snapshot of the event as it was thrown by the working memory.
22: * It contains the process name and id.
23: *
24: * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen </a>
25: */
26: public class RuleFlowLogEvent extends LogEvent {
27:
28: private String processId;
29: private String processName;
30:
31: /**
32: * Create a new ruleflow log event.
33: *
34: * @param type The type of event. This can only be RULEFLOW_CREATED or RULEFLOW_COMPLETED.
35: * @param processId The id of the process
36: * @param processName The name of the process
37: */
38: public RuleFlowLogEvent(final int type, final String processId,
39: final String processName) {
40: super (type);
41: this .processId = processId;
42: this .processName = processName;
43: }
44:
45: public String getProcessId() {
46: return this .processId;
47: }
48:
49: public String getProcessName() {
50: return this .processName;
51: }
52:
53: public String toString() {
54:
55: String msg = null;
56: switch (this .getType()) {
57: case RULEFLOW_CREATED:
58: msg = "RULEFLOW STARTED";
59: break;
60: case RULEFLOW_COMPLETED:
61: msg = "ACTIVATION CREATED";
62: break;
63: }
64: return msg + " process:" + this .processName + "[id="
65: + this .processId + "]";
66: }
67: }
|