use of org.netxms.client.NXCSession in project netxms by netxms.
the class Comments method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (initialComments.equals(comments.getText()))
// Nothing to apply
return;
if (isApply)
setValid(false);
final String newComments = new String(comments.getText());
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format(Messages.get().Comments_JobName, object.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.updateObjectComments(object.getObjectId(), newComments);
initialComments = newComments;
}
@Override
protected String getErrorMessage() {
return Messages.get().Comments_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
Comments.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCSession in project netxms by netxms.
the class ConditionData 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.setDciList(dciList);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().ConditionData_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().ConditionData_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ConditionData.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCSession in project netxms by netxms.
the class Dashboards 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 = dashboards.keySet();
Long[] dlist = new Long[idList.size()];
int i = 0;
for (Long id : idList) dlist[i++] = id;
md.setDashboards(dlist);
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() {
Dashboards.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().TrustedNodes_JobError;
}
}.schedule();
}
use of org.netxms.client.NXCSession in project netxms by netxms.
the class AutoDeploy method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
int flags = object.getFlags();
if (checkboxEnableDeploy.getSelection())
flags |= AgentPolicy.PF_AUTO_DEPLOY;
else
flags &= ~AgentPolicy.PF_AUTO_DEPLOY;
if (checkboxEnableUninstall.getSelection())
flags |= AgentPolicy.PF_AUTO_UNINSTALL;
else
flags &= ~Container.CF_AUTO_UNBIND;
if ((flags == initialFlags) && initialAutoDeployFilter.equals(filterSource.getText()))
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setObjectFlags(flags);
md.setAutoBindFilter(filterSource.getText());
new ConsoleJob("Updating autodeploy configuration", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
initialFlags = md.getObjectFlags();
initialAutoDeployFilter = md.getAutoBindFilter();
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
AutoDeploy.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return "Cannot update autodeploy configuration";
}
}.start();
}
use of org.netxms.client.NXCSession in project netxms by netxms.
the class ClusterResources 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());
md.setResourceList(resources);
new ConsoleJob(Messages.get().ClusterResources_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().ClusterResources_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ClusterResources.this.setValid(true);
}
});
}
}
}.start();
}
Aggregations