use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ResponsibleUsers method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
List<Long> userIds = new ArrayList<Long>(userList.size());
for (AbstractUserObject o : userList) userIds.add(o.getId());
md.setResponsibleUsers(userIds);
new ConsoleJob(String.format(Messages.get().AccessControl_JobName, object.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ResponsibleUsers.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().AccessControl_JobError;
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class RackPassiveElements method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!isModified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCObjectModificationData md = new NXCObjectModificationData(rack.getObjectId());
try {
md.setPassiveElements(passiveElements.createXml());
} catch (Exception e) {
MessageDialogHelper.openError(getShell(), "Rack attribute error", "Unable to save rack attribute configuration" + e.getMessage());
}
final NXCSession session = ConsoleSharedData.getSession();
new ConsoleJob("Update rack attributes", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
isModified = false;
}
@Override
protected String getErrorMessage() {
return "Rack attribute update error";
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
isModified = true;
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class SNMP method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected boolean applyChanges(final boolean isApply) {
final NXCObjectModificationData md = new NXCObjectModificationData(node.getObjectId());
if (isApply)
setValid(false);
md.setSnmpVersion(snmpIndexToVersion(snmpVersion.getSelectionIndex()));
try {
md.setSnmpPort(Integer.parseInt(snmpPort.getText(), 10));
} catch (NumberFormatException e) {
MessageDialog.openWarning(getShell(), Messages.get().Communication_Warning, Messages.get().Communication_WarningInvalidSNMPPort);
if (isApply)
setValid(true);
return false;
}
md.setSnmpProxy(snmpProxy.getObjectId());
md.setSnmpAuthMethod(snmpAuth.getSelectionIndex());
md.setSnmpPrivMethod(snmpPriv.getSelectionIndex());
md.setSnmpAuthName(snmpAuthName.getText());
md.setSnmpAuthPassword(snmpAuthPassword.getText());
md.setSnmpPrivPassword(snmpPrivPassword.getText());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format("Updating SNMP settings for node %s", node.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return String.format("Cannot update SNMP settings for node %s", node.getObjectName());
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
SNMP.this.setValid(true);
}
});
}
}
}.start();
return true;
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class TrustedNodes method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!isModified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
Set<Long> idList = trustedNodes.keySet();
long[] nodes = new long[idList.size()];
int i = 0;
for (long id : idList) nodes[i++] = id;
md.setTrustedNodes(nodes);
new ConsoleJob(String.format(Messages.get().TrustedNodes_JobName, object.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
TrustedNodes.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().TrustedNodes_JobError;
}
}.schedule();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ZoneCommunications method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected boolean applyChanges(final boolean isApply) {
if (isApply)
setValid(false);
final NXCObjectModificationData md = new NXCObjectModificationData(zone.getObjectId());
md.setZoneProxy(agentProxy.getObjectId());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format(Messages.get().ZoneCommunications_JobName, zone.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().ZoneCommunications_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ZoneCommunications.this.setValid(true);
}
});
}
}
}.start();
return true;
}
Aggregations