f66ce6523e375f0ba0c716f02f5e1d312ca9e904
[public/netxms.git] / src / java / netxms-client / src / main / java / org / netxms / client / NXCObjectModificationData.java
1 /**
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2010 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;
20
21 import java.net.InetAddress;
22 import java.util.Map;
23
24 /**
25 * @author Victor
26 *
27 * This class is used to hold data for NXCSession.modifyObject()
28 *
29 */
30 public class NXCObjectModificationData
31 {
32 // Modification flags
33 public static final long MODIFY_NAME = 0x00000001L;
34 public static final long MODIFY_ACL = 0x00000002L;
35 public static final long MODIFY_CUSTOM_ATTRIBUTES = 0x00000004L;
36 public static final long MODIFY_AUTO_APPLY = 0x00000008L;
37 public static final long MODIFY_AUTO_BIND = 0x00000010L;
38 public static final long MODIFY_POLICY_CONFIG = 0x00000020L;
39 public static final long MODIFY_VERSION = 0x00000040L;
40 public static final long MODIFY_DESCRIPTION = 0x00000080L;
41 public static final long MODIFY_AGENT_PORT = 0x00000100L;
42 public static final long MODIFY_AGENT_AUTH = 0x00000200L;
43 public static final long MODIFY_SNMP_VERSION = 0x00000400L;
44 public static final long MODIFY_SNMP_AUTH = 0x00000800L;
45 public static final long MODIFY_AGENT_PROXY = 0x00001000L;
46 public static final long MODIFY_SNMP_PROXY = 0x00002000L;
47 public static final long MODIFY_TRUSTED_NODES = 0x00004000L;
48 public static final long MODIFY_GEOLOCATION = 0x00008000L;
49 public static final long MODIFY_PRIMARY_IP = 0x00010000L;
50
51 private long flags; // Flags which indicates what object's data should be modified
52 private long objectId;
53 private String name;
54 private AccessListElement[] acl;
55 private boolean inheritAccessRights;
56 private Map<String, String> customAttributes;
57 private boolean autoApplyEnabled;
58 private String autoApplyFilter;
59 private boolean autoBindEnabled;
60 private String autoBindFilter;
61 private String configFileName;
62 private String configFileContent;
63 private int version;
64 private String description;
65 private int agentPort;
66 private int agentAuthMethod;
67 private String agentSecret;
68 private long agentProxy;
69 private int snmpVersion;
70 private int snmpAuthMethod;
71 private int snmpPrivMethod;
72 private String snmpAuthName;
73 private String snmpAuthPassword;
74 private String snmpPrivPassword;
75 private long snmpProxy;
76 private long[] trustedNodes;
77 private GeoLocation geolocation;
78 private InetAddress primaryIpAddress;
79
80 /**
81 * Constructor for creating modification data for given object
82 */
83 public NXCObjectModificationData(long objectId)
84 {
85 this.objectId = objectId;
86 flags = 0;
87 }
88
89 /**
90 * @return the objectId
91 */
92 public long getObjectId()
93 {
94 return objectId;
95 }
96
97 /**
98 * @param objectId the objectId to set
99 */
100 public void setObjectId(long objectId)
101 {
102 this.objectId = objectId;
103 }
104
105 /**
106 * @return the name
107 */
108 public String getName()
109 {
110 return name;
111 }
112
113 /**
114 * @param name the name to set
115 */
116 public void setName(final String name)
117 {
118 this.name = name;
119 flags |= MODIFY_NAME;
120 }
121
122 /**
123 * @return the flags
124 */
125 public long getFlags()
126 {
127 return flags;
128 }
129
130 /**
131 * @return the acl
132 */
133 public AccessListElement[] getACL()
134 {
135 return (acl != null) ? acl : new AccessListElement[0];
136 }
137
138 /**
139 * @param acl the acl to set
140 */
141 public void setACL(AccessListElement[] acl)
142 {
143 this.acl = acl;
144 flags |= MODIFY_ACL;
145 }
146
147 /**
148 * @return the inheritAccessRights
149 */
150 public boolean isInheritAccessRights()
151 {
152 return inheritAccessRights;
153 }
154
155 /**
156 * @param inheritAccessRights the inheritAccessRights to set
157 */
158 public void setInheritAccessRights(boolean inheritAccessRights)
159 {
160 this.inheritAccessRights = inheritAccessRights;
161 flags |= MODIFY_ACL;
162 }
163
164 /**
165 * @return the customAttributes
166 */
167 public Map<String, String> getCustomAttributes()
168 {
169 return customAttributes;
170 }
171
172 /**
173 * @param customAttributes the customAttributes to set
174 */
175 public void setCustomAttributes(Map<String, String> customAttributes)
176 {
177 this.customAttributes = customAttributes;
178 flags |= MODIFY_CUSTOM_ATTRIBUTES;
179 }
180
181 /**
182 * @return the autoApplyEnabled
183 */
184 public boolean isAutoApplyEnabled()
185 {
186 return autoApplyEnabled;
187 }
188
189 /**
190 * @param autoApplyEnabled the autoApplyEnabled to set
191 */
192 public void setAutoApplyEnabled(boolean autoApplyEnabled)
193 {
194 this.autoApplyEnabled = autoApplyEnabled;
195 flags |= MODIFY_AUTO_APPLY;
196 }
197
198 /**
199 * @return the autoApplyFilter
200 */
201 public String getAutoApplyFilter()
202 {
203 return autoApplyFilter;
204 }
205
206 /**
207 * @param autoApplyFilter the autoApplyFilter to set
208 */
209 public void setAutoApplyFilter(String autoApplyFilter)
210 {
211 this.autoApplyFilter = autoApplyFilter;
212 flags |= MODIFY_AUTO_APPLY;
213 }
214
215 /**
216 * @return the autoApplyEnabled
217 */
218 public boolean isAutoBindEnabled()
219 {
220 return autoBindEnabled;
221 }
222
223 /**
224 * @param autoApplyEnabled the autoApplyEnabled to set
225 */
226 public void setAutoBindEnabled(boolean autoBindEnabled)
227 {
228 this.autoBindEnabled = autoBindEnabled;
229 flags |= MODIFY_AUTO_BIND;
230 }
231
232 /**
233 * @return the autoApplyFilter
234 */
235 public String getAutoBindFilter()
236 {
237 return autoBindFilter;
238 }
239
240 /**
241 * @param autoApplyFilter the autoApplyFilter to set
242 */
243 public void setAutoBindFilter(String autoBindFilter)
244 {
245 this.autoBindFilter = autoBindFilter;
246 flags |= MODIFY_AUTO_BIND;
247 }
248
249 /**
250 * @return the configFileName
251 */
252 public String getConfigFileName()
253 {
254 return configFileName;
255 }
256
257 /**
258 * @param configFileName the configFileName to set
259 */
260 public void setConfigFileName(String configFileName)
261 {
262 this.configFileName = configFileName;
263 flags |= MODIFY_POLICY_CONFIG;
264 }
265
266 /**
267 * @return the configFileContent
268 */
269 public String getConfigFileContent()
270 {
271 return configFileContent;
272 }
273
274 /**
275 * @param configFileContent the configFileContent to set
276 */
277 public void setConfigFileContent(String configFileContent)
278 {
279 this.configFileContent = configFileContent;
280 flags |= MODIFY_POLICY_CONFIG;
281 }
282
283 /**
284 * @return the version
285 */
286 public int getVersion()
287 {
288 return version;
289 }
290
291 /**
292 * @param version the version to set
293 */
294 public void setVersion(int version)
295 {
296 this.version = version;
297 flags |= MODIFY_VERSION;
298 }
299
300 /**
301 * @return the description
302 */
303 public String getDescription()
304 {
305 return description;
306 }
307
308 /**
309 * @param description the description to set
310 */
311 public void setDescription(String description)
312 {
313 this.description = description;
314 flags |= MODIFY_DESCRIPTION;
315 }
316
317 public int getAgentPort()
318 {
319 return agentPort;
320 }
321
322 public void setAgentPort(int agentPort)
323 {
324 this.agentPort = agentPort;
325 flags |= MODIFY_AGENT_PORT;
326 }
327
328 /**
329 * @return the agentAuthMethod
330 */
331 public int getAgentAuthMethod()
332 {
333 return agentAuthMethod;
334 }
335
336 /**
337 * @param agentAuthMethod the agentAuthMethod to set
338 */
339 public void setAgentAuthMethod(int agentAuthMethod)
340 {
341 this.agentAuthMethod = agentAuthMethod;
342 flags |= MODIFY_AGENT_AUTH;
343 }
344
345 /**
346 * @return the agentSecret
347 */
348 public String getAgentSecret()
349 {
350 return agentSecret;
351 }
352
353 /**
354 * @param agentSecret the agentSecret to set
355 */
356 public void setAgentSecret(String agentSecret)
357 {
358 this.agentSecret = agentSecret;
359 flags |= MODIFY_AGENT_AUTH;
360 }
361
362 /**
363 * @return the agentProxy
364 */
365 public long getAgentProxy()
366 {
367 return agentProxy;
368 }
369
370 /**
371 * @param agentProxy the agentProxy to set
372 */
373 public void setAgentProxy(long agentProxy)
374 {
375 this.agentProxy = agentProxy;
376 flags |= MODIFY_AGENT_PROXY;
377 }
378
379 /**
380 * @return the snmpVersion
381 */
382 public int getSnmpVersion()
383 {
384 return snmpVersion;
385 }
386
387 /**
388 * @param snmpVersion the snmpVersion to set
389 */
390 public void setSnmpVersion(int snmpVersion)
391 {
392 this.snmpVersion = snmpVersion;
393 flags |= MODIFY_SNMP_VERSION;
394 }
395
396 /**
397 * @return the snmpAuthMethod
398 */
399 public int getSnmpAuthMethod()
400 {
401 return snmpAuthMethod;
402 }
403
404 /**
405 * @param snmpAuthMethod the snmpAuthMethod to set
406 */
407 public void setSnmpAuthMethod(int snmpAuthMethod)
408 {
409 this.snmpAuthMethod = snmpAuthMethod;
410 flags |= MODIFY_SNMP_AUTH;
411 }
412
413 /**
414 * @return the snmpPrivMethod
415 */
416 public int getSnmpPrivMethod()
417 {
418 return snmpPrivMethod;
419 }
420
421 /**
422 * @param snmpPrivMethod the snmpPrivMethod to set
423 */
424 public void setSnmpPrivMethod(int snmpPrivMethod)
425 {
426 this.snmpPrivMethod = snmpPrivMethod;
427 flags |= MODIFY_SNMP_AUTH;
428 }
429
430 /**
431 * @return the snmpAuthName
432 */
433 public String getSnmpAuthName()
434 {
435 return snmpAuthName;
436 }
437
438 /**
439 * @param snmpAuthName the snmpAuthName to set
440 */
441 public void setSnmpAuthName(String snmpAuthName)
442 {
443 this.snmpAuthName = snmpAuthName;
444 flags |= MODIFY_SNMP_AUTH;
445 }
446
447 /**
448 * @return the snmpAuthPassword
449 */
450 public String getSnmpAuthPassword()
451 {
452 return snmpAuthPassword;
453 }
454
455 /**
456 * @param snmpAuthPassword the snmpAuthPassword to set
457 */
458 public void setSnmpAuthPassword(String snmpAuthPassword)
459 {
460 this.snmpAuthPassword = snmpAuthPassword;
461 flags |= MODIFY_SNMP_AUTH;
462 }
463
464 /**
465 * @return the snmpPrivPassword
466 */
467 public String getSnmpPrivPassword()
468 {
469 return snmpPrivPassword;
470 }
471
472 /**
473 * @param snmpPrivPassword the snmpPrivPassword to set
474 */
475 public void setSnmpPrivPassword(String snmpPrivPassword)
476 {
477 this.snmpPrivPassword = snmpPrivPassword;
478 flags |= MODIFY_SNMP_AUTH;
479 }
480
481 /**
482 * @return the snmpProxy
483 */
484 public long getSnmpProxy()
485 {
486 return snmpProxy;
487 }
488
489 /**
490 * @param snmpProxy the snmpProxy to set
491 */
492 public void setSnmpProxy(long snmpProxy)
493 {
494 this.snmpProxy = snmpProxy;
495 flags |= MODIFY_SNMP_PROXY;
496 }
497
498 /**
499 * @return the trustedNodes
500 */
501 public long[] getTrustedNodes()
502 {
503 return trustedNodes;
504 }
505
506 /**
507 * @param trustedNodes the trustedNodes to set
508 */
509 public void setTrustedNodes(long[] trustedNodes)
510 {
511 this.trustedNodes = trustedNodes;
512 flags |= MODIFY_TRUSTED_NODES;
513 }
514
515 /**
516 * @return the geolocation
517 */
518 public GeoLocation getGeolocation()
519 {
520 return geolocation;
521 }
522
523 /**
524 * @param geolocation the geolocation to set
525 */
526 public void setGeolocation(GeoLocation geolocation)
527 {
528 this.geolocation = geolocation;
529 flags |= MODIFY_GEOLOCATION;
530 }
531
532 /**
533 * @return the primaryIpAddress
534 */
535 public InetAddress getPrimaryIpAddress()
536 {
537 return primaryIpAddress;
538 }
539
540 /**
541 * @param primaryIpAddress the primaryIpAddress to set
542 */
543 public void setPrimaryIpAddress(InetAddress primaryIpAddress)
544 {
545 this.primaryIpAddress = primaryIpAddress;
546 flags |= MODIFY_PRIMARY_IP;
547 }
548 }