private static Attributes storeTo(AttributeFilter filter, Entity entity, BasicAttributes attrs) { attrs.put("objectclass", "dcmAttributeFilter"); attrs.put("dcmEntity", entity.name()); attrs.put(tagsAttr("dcmTag", filter.getSelection())); storeNotNull(attrs, "dcmCustomAttribute1", filter.getCustomAttribute1()); storeNotNull(attrs, "dcmCustomAttribute2", filter.getCustomAttribute2()); storeNotNull(attrs, "dcmCustomAttribute3", filter.getCustomAttribute3()); return attrs; }
private void loadAttributeFilters(ArchiveDevice device, String deviceDN) throws NamingException { NamingEnumeration<SearchResult> ne = search(deviceDN, "(objectclass=dcmAttributeFilter)"); try { while (ne.hasMore()) { SearchResult sr = ne.next(); Attributes attrs = sr.getAttributes(); AttributeFilter filter = new AttributeFilter(tags(attrs.get("dcmTag"))); filter.setCustomAttribute1(valueSelector(attrs.get("dcmCustomAttribute1"))); filter.setCustomAttribute2(valueSelector(attrs.get("dcmCustomAttribute2"))); filter.setCustomAttribute3(valueSelector(attrs.get("dcmCustomAttribute3"))); device.setAttributeFilter(Entity.valueOf(stringValue(attrs.get("dcmEntity"))), filter); } } finally { safeClose(ne); } }
private List<ModificationItem> storeDiffs( AttributeFilter prev, AttributeFilter filter, List<ModificationItem> mods) { storeDiffTags(mods, "dcmTag", prev.getSelection(), filter.getSelection()); storeDiff( mods, "dcmCustomAttribute1", prev.getCustomAttribute1(), filter.getCustomAttribute1()); storeDiff( mods, "dcmCustomAttribute2", prev.getCustomAttribute2(), filter.getCustomAttribute2()); storeDiff( mods, "dcmCustomAttribute3", prev.getCustomAttribute3(), filter.getCustomAttribute3()); return mods; }