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-group 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 ruleflow group name and its size.
23: *
24: * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen </a>
25: */
26: public class RuleFlowGroupLogEvent extends LogEvent {
27:
28: private String groupName;
29: private int size;
30:
31: /**
32: * Create a new ruleflow group log event.
33: *
34: * @param type The type of event. This can only be RULEFLOW_GROUP_ACTIVATED or RULEFLOW_GROUP_DEACTIVATED.
35: * @param groupName The name of the ruleflow group
36: * @param size The size of the ruleflow group
37: */
38: public RuleFlowGroupLogEvent(final int type,
39: final String groupName, final int size) {
40: super (type);
41: this .groupName = groupName;
42: this .size = size;
43: }
44:
45: public String getGroupName() {
46: return this .groupName;
47: }
48:
49: public int getSize() {
50: return this .size;
51: }
52:
53: public String toString() {
54:
55: String msg = null;
56: switch (this .getType()) {
57: case RULEFLOW_GROUP_ACTIVATED:
58: msg = "RULEFLOW GROUP ACTIVATED";
59: break;
60: case RULEFLOW_GROUP_DEACTIVATED:
61: msg = "ACTIVATION GROUP DEACTIVATED";
62: break;
63: }
64: return msg + " group:" + this .groupName + "[size=" + this .size
65: + "]";
66: }
67: }
|