f563001625f852a5dafbef1eb4d1ff0d12ec079c
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2010 Victor Kirhenshtein
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 package org
.netxms
.client
.objects
;
21 import java
.util
.ArrayList
;
22 import java
.util
.List
;
24 import org
.netxms
.base
.NXCPCodes
;
25 import org
.netxms
.base
.NXCPMessage
;
26 import org
.netxms
.client
.NXCSession
;
27 import org
.netxms
.client
.datacollection
.ConditionDciInfo
;
33 public class Condition
extends GenericObject
35 private String script
;
36 private int activationEvent
;
37 private int deactivationEvent
;
38 private long eventSourceObject
;
39 private int activeStatus
;
40 private int inactiveStatus
;
41 private List
<ConditionDciInfo
> dciList
;
47 public Condition(NXCPMessage msg
, NXCSession session
)
51 script
= msg
.getVariableAsString(NXCPCodes
.VID_SCRIPT
);
52 activationEvent
= msg
.getVariableAsInteger(NXCPCodes
.VID_ACTIVATION_EVENT
);
53 deactivationEvent
= msg
.getVariableAsInteger(NXCPCodes
.VID_DEACTIVATION_EVENT
);
54 eventSourceObject
= msg
.getVariableAsInt64(NXCPCodes
.VID_SOURCE_OBJECT
);
55 activeStatus
= msg
.getVariableAsInteger(NXCPCodes
.VID_ACTIVE_STATUS
);
56 inactiveStatus
= msg
.getVariableAsInteger(NXCPCodes
.VID_INACTIVE_STATUS
);
58 int count
= msg
.getVariableAsInteger(NXCPCodes
.VID_NUM_ITEMS
);
59 dciList
= new ArrayList
<ConditionDciInfo
>(count
);
61 long varId
= NXCPCodes
.VID_DCI_LIST_BASE
;
62 for(int i
= 0; i
< count
; i
++)
64 dciList
.add(new ConditionDciInfo(msg
, varId
));
70 * @see org.netxms.client.NXCObject#getObjectClassName()
73 public String
getObjectClassName()
81 public String
getScript()
87 * @return the activationEvent
89 public int getActivationEvent()
91 return activationEvent
;
95 * @return the deactivationEvent
97 public int getDeactivationEvent()
99 return deactivationEvent
;
103 * @return the eventSourceObject
105 public long getEventSourceObject()
107 return eventSourceObject
;
111 * @return the activeStatus
113 public int getActiveStatus()
119 * @return the inactiveStatus
121 public int getInactiveStatus()
123 return inactiveStatus
;
127 * @return the dciList
129 public List
<ConditionDciInfo
> getDciList()