1b8d6fd56f1735305d66894d1fc9d490338e8bf0
[public/netxms.git] / src / java / netxms-client / src / main / java / org / netxms / client / objects / Container.java
1 /**
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2012 Victor Kirhenshtein
4 *
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.
9 *
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.
14 *
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.
18 */
19 package org.netxms.client.objects;
20
21 import org.netxms.base.NXCPCodes;
22 import org.netxms.base.NXCPMessage;
23 import org.netxms.client.NXCSession;
24
25 /**
26 * Container object
27 */
28 public class Container extends GenericObject
29 {
30 public static final int CF_AUTO_BIND = 0x000001;
31 public static final int CF_AUTO_UNBIND = 0x000002;
32
33 private int category;
34 private int flags;
35 private String autoBindFilter;
36
37 /**
38 * @param msg
39 */
40 public Container(NXCPMessage msg, NXCSession session)
41 {
42 super(msg, session);
43 category = msg.getVariableAsInteger(NXCPCodes.VID_CATEGORY);
44 flags = msg.getVariableAsInteger(NXCPCodes.VID_FLAGS);
45 autoBindFilter = msg.getVariableAsString(NXCPCodes.VID_AUTOBIND_FILTER);
46 }
47
48 /**
49 * @return the category
50 */
51 public int getCategory()
52 {
53 return category;
54 }
55
56 /**
57 * @return true if automatic bind is enabled
58 */
59 public boolean isAutoBindEnabled()
60 {
61 return (flags & CF_AUTO_BIND) != 0;
62 }
63
64 /**
65 * @return true if automatic unbind is enabled
66 */
67 public boolean isAutoUnbindEnabled()
68 {
69 return (flags & CF_AUTO_UNBIND) != 0;
70 }
71
72 /**
73 * @return Filter script for automatic bind
74 */
75 public String getAutoBindFilter()
76 {
77 return autoBindFilter;
78 }
79
80 /* (non-Javadoc)
81 * @see org.netxms.client.objects.GenericObject#getObjectClassName()
82 */
83 @Override
84 public String getObjectClassName()
85 {
86 return "Container";
87 }
88
89 /**
90 * @return the flags
91 */
92 public int getFlags()
93 {
94 return flags;
95 }
96 }