use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class AccessControl 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 boolean inheritAccessRights = checkInherit.getSelection();
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setACL(acl.values().toArray(new AccessListElement[acl.size()]));
md.setInheritAccessRights(inheritAccessRights);
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() {
AccessControl.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 AutoBind 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 (checkboxEnableBind.getSelection())
flags |= Container.CF_AUTO_BIND;
else
flags &= ~Container.CF_AUTO_BIND;
if (checkboxEnableUnbind.getSelection())
flags |= Container.CF_AUTO_UNBIND;
else
flags &= ~Container.CF_AUTO_UNBIND;
if ((flags == initialFlags) && initialAutoBindFilter.equals(filterSource.getText()))
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setObjectFlags(flags);
md.setAutoBindFilter(filterSource.getText());
new ConsoleJob(Messages.get().AutoBind_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
initialFlags = md.getObjectFlags();
initialAutoBindFilter = md.getAutoBindFilter();
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
AutoBind.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().AutoBind_JobError;
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class NetworkServicePolling 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());
try {
int ipPort = Integer.parseInt(port.getText());
if ((ipPort < 1) || (ipPort > 65535))
throw new NumberFormatException();
md.setIpPort(ipPort);
} catch (NumberFormatException e) {
MessageDialogHelper.openWarning(getShell(), Messages.get().NetworkServicePolling_Warning, Messages.get().NetworkServicePolling_WarningInvalidPort);
return false;
}
md.setRequiredPolls(pollCount.getSelection());
md.setServiceType(serviceType.getSelectionIndex());
String addr = ipAddress.getText().trim();
if (!addr.isEmpty()) {
try {
md.setIpAddress(new InetAddressEx(InetAddress.getByName(addr)));
} catch (UnknownHostException e) {
MessageDialogHelper.openWarning(getShell(), Messages.get().AddAddressListElementDialog_Warning, Messages.get().AddAddressListElementDialog_AddressValidationError);
return false;
}
} else {
md.setIpAddress(new InetAddressEx());
}
md.setRequest(request.getText());
md.setResponse(response.getText());
md.setPollerNode(pollerNode.getObjectId());
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().NetworkServicePolling_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().NetworkServicePolling_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
NetworkServicePolling.this.setValid(true);
}
});
}
}
}.start();
return true;
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class RackProperties 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(rack.getObjectId());
md.setHeight(rackHeight.getSelection());
md.setRackNumberingTopBottom(numberingScheme.getSelectionIndex() == 1);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(String.format(Messages.get().RackProperties_UpdatingRackProperties, rack.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() {
RackProperties.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class SensorProperties method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected boolean applyChanges(final boolean isApply) {
if (!commonData.validate())
return false;
final NXCObjectModificationData md = new NXCObjectModificationData(sensor.getObjectId());
md.setMacAddress(commonData.getMacAddress());
md.setDeviceClass(commonData.getDeviceClass());
md.setVendor(commonData.getVendor());
md.setSerialNumber(commonData.getSerial());
md.setDeviceAddress(commonData.getDeviceAddress());
md.setMetaType(commonData.getMetaType());
md.setDescription(commonData.getDescription());
md.setSensorProxy(commonData.getProxyNode());
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().SensorPolling_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().SensorPolling_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
SensorProperties.this.setValid(true);
}
});
}
}
}.start();
return true;
}
Aggregations