use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class MapSeedNodes 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());
List<Long> seedObjectIds = new ArrayList<Long>();
for (AbstractObject o : seedNodes) seedObjectIds.add(o.getObjectId());
md.setSeedObjectIds(seedObjectIds);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob("Update network map seed nodes", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
isModified = false;
}
@Override
protected String getErrorMessage() {
return "Network map seed node update failed";
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
MapSeedNodes.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ObjectPolling 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(object.getObjectId());
if (object.containPollerNode())
md.setPollerNode(pollerNode.getObjectId());
md.setObjectFlags(collectNodeFlags(), collectNodeFlagsMask());
if (object.containInterfaces())
md.setIfXTablePolicy(collectIfXTablePolicy());
if (object.containAgent())
md.setAgentCacheMode(collectAgentCacheMode());
if (object instanceof AbstractNode)
md.setRequiredPolls(pollCount.getSelection());
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().NodePolling_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().NodePolling_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ObjectPolling.this.setValid(true);
}
});
}
}
}.start();
return true;
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class RackPlacement 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.setRackPlacement(rackSelector.getObjectId(), rackImageFrontSelector.getImageGuid(), rackImageRearSelector.getImageGuid(), (short) rackPosition.getSelection(), (short) rackHeight.getSelection(), RackOrientation.getByValue(rackOrientation.getSelectionIndex()));
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format(Messages.get().RackPlacement_UpdatingRackPlacement, object.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().Comments_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
RackPlacement.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class SSH 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.setSshProxy(sshProxy.getObjectId());
md.setSshLogin(sshLogin.getText().trim());
md.setSshPassword(sshPassword.getText());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format("Updating SSH 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 SSH settings for node %s", node.getObjectName());
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
SSH.this.setValid(true);
}
});
}
}
}.start();
return true;
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class MapAppearance 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 data = new NXCObjectModificationData(object.getObjectId());
data.setImage(image.getImageGuid());
if (drillDownObject != null)
data.setDrillDownObjectId(drillDownObject.getObjectId());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().MapAppearance_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(data);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().MapAppearance_JobError, object.getObjectName());
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
MapAppearance.this.setValid(true);
}
});
}
}
}.schedule();
}
Aggregations