private ConfigurationChanges configurationChangesOf(EnumSet<Option> options) { return options != null && (options.contains(Option.CONFIGURATION_CHANGES) || options.contains(Option.CONFIGURATION_CHANGES_VERBOSE)) ? new ConfigurationChanges(options.contains(Option.CONFIGURATION_CHANGES_VERBOSE)) : null; }
private ConfigurationChanges configurationChangesOf(EnumSet<Option> options) { return options != null && (options.contains(Option.CONFIGURATION_CHANGES) || options.contains(Option.CONFIGURATION_CHANGES_VERBOSE)) ? new ConfigurationChanges(options.contains(Option.CONFIGURATION_CHANGES_VERBOSE)) : null; }
@Override public synchronized ConfigurationChanges removeDevice(String name, EnumSet<Option> options) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); String dn = deviceRef(name); removeDeviceWithDN(dn, options != null && options.contains(Option.REGISTER)); ConfigurationChanges diffs = new ConfigurationChanges(false); ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.D); return diffs; }
@Override public synchronized ConfigurationChanges removeDevice(String name, EnumSet<Option> options) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); String dn = deviceRef(name); removeDeviceWithDN(dn, options != null && options.contains(Option.REGISTER)); ConfigurationChanges diffs = new ConfigurationChanges(false); ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.D); return diffs; }
@Override public ConfigurationChanges updateDeviceVendorData(String deviceName, byte[]... vendorData) throws ConfigurationException { String deviceRef = deviceRef(deviceName); if (!configurationExists()) throw new ConfigurationNotFoundException(); ConfigurationChanges diffs = new ConfigurationChanges(false); try { Attributes attrs = getAttributes(deviceRef, new String[]{"dicomVendorData"}); byte[][] prev = byteArrays(attrs.get("dicomVendorData")); ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, deviceRef, ConfigurationChanges.ChangeType.C); List<ModificationItem> mods = new ArrayList<>(1); storeDiff(ldapObj, mods, "dicomVendorData", prev, vendorData); modifyAttributes(deviceRef, mods); } catch (NameNotFoundException e) { throw new ConfigurationNotFoundException("Device with specified name not found", e); } catch (NamingException e) { throw new ConfigurationException(e); } return diffs; }
@Override public ConfigurationChanges updateDeviceVendorData(String deviceName, byte[]... vendorData) throws ConfigurationException { String deviceRef = deviceRef(deviceName); if (!configurationExists()) throw new ConfigurationNotFoundException(); ConfigurationChanges diffs = new ConfigurationChanges(false); try { Attributes attrs = getAttributes(deviceRef, new String[]{"dicomVendorData"}); byte[][] prev = byteArrays(attrs.get("dicomVendorData")); ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, deviceRef, ConfigurationChanges.ChangeType.C); List<ModificationItem> mods = new ArrayList<>(1); storeDiff(ldapObj, mods, "dicomVendorData", prev, vendorData); modifyAttributes(deviceRef, mods); } catch (NameNotFoundException e) { throw new ConfigurationNotFoundException("Device with specified name not found", e); } catch (NamingException e) { throw new ConfigurationException(e); } return diffs; }