コード例 #1
0
 @Override
 protected void storeChilds(String deviceDN, Device device) throws NamingException {
   super.storeChilds(deviceDN, device);
   if (!(device instanceof ArchiveDevice)) return;
   ArchiveDevice arcDev = (ArchiveDevice) device;
   for (Entity entity : Entity.values())
     createSubcontext(
         dnOf("dcmEntity", entity.toString(), deviceDN),
         storeTo(arcDev.getAttributeFilter(entity), entity, new BasicAttributes(true)));
 }
コード例 #2
0
  @Override
  protected void mergeChilds(Device prev, Device device, String deviceDN) throws NamingException {
    super.mergeChilds(prev, device, deviceDN);
    if (!(prev instanceof ArchiveDevice && device instanceof ArchiveDevice)) return;

    ArchiveDevice aa = (ArchiveDevice) prev;
    ArchiveDevice bb = (ArchiveDevice) device;
    for (Entity entity : Entity.values())
      modifyAttributes(
          dnOf("dcmEntity", entity.toString(), deviceDN),
          storeDiffs(
              aa.getAttributeFilter(entity),
              bb.getAttributeFilter(entity),
              new ArrayList<ModificationItem>()));
  }
コード例 #3
0
 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;
 }
コード例 #4
0
 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);
   }
 }