use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class Communication 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 (primaryNameChanged) {
// Validate primary name
final String hostName = primaryName.getText().trim();
if (// $NON-NLS-1$
!hostName.matches("^(([A-Za-z0-9\\-]+\\.)*[A-Za-z0-9\\-]+|[A-Fa-f0-9:]+)$")) {
MessageDialogHelper.openWarning(getShell(), Messages.get().Communication_Warning, String.format(Messages.get().Communication_WarningInvalidHostname, hostName));
return false;
}
md.setPrimaryName(hostName);
}
if (isApply)
setValid(false);
int flags = node.getFlags();
if (agentIsRemote.getSelection())
flags |= AbstractNode.NF_REMOTE_AGENT;
else
flags &= ~AbstractNode.NF_REMOTE_AGENT;
md.setObjectFlags(flags, AbstractNode.NF_REMOTE_AGENT);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format(Messages.get().Communication_JobName, node.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().Communication_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
Communication.this.setValid(true);
}
});
}
}
}.start();
return true;
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ConditionEvents 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 NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setActivationEvent((int) activationEvent.getEventCode());
md.setDeactivationEvent((int) deactivationEvent.getEventCode());
md.setSourceObject(sourceObject.getObjectId());
md.setActiveStatus(activeStatus.getSelection());
md.setInactiveStatus(inactiveStatus.getSelection());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().ConditionEvents_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().ConditionEvents_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ConditionEvents.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class CustomAttributes 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(object.getObjectId());
md.setCustomAttributes(attributes);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CustomAttributes_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
isModified = false;
}
@Override
protected String getErrorMessage() {
return Messages.get().CustomAttributes_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
CustomAttributes.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ExternalResources method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!modified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setUrls(new ArrayList<ObjectUrl>(urls));
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CustomAttributes_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
modified = false;
}
@Override
protected String getErrorMessage() {
return "Cannot update object's URL list";
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ExternalResources.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ICMP 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.setIcmpProxy(icmpProxy.getObjectId());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format("Updating ICMP 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 ICMP settings for node %s", node.getObjectName());
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ICMP.this.setValid(true);
}
});
}
}
}.start();
return true;
}
Aggregations