@Override
 protected void loadChilds(Device device, String deviceDN) throws NamingException {
   super.loadChilds(device, deviceDN);
   if (!(device instanceof ArchiveDevice)) return;
   ArchiveDevice arcdev = (ArchiveDevice) device;
   loadAttributeFilters(arcdev, deviceDN);
 }
 @Override
 protected void loadFrom(HL7Application hl7App, Attributes attrs) throws NamingException {
   super.loadFrom(hl7App, attrs);
   if (!(hl7App instanceof ArchiveHL7Application)) return;
   ArchiveHL7Application arcHL7App = (ArchiveHL7Application) hl7App;
   arcHL7App.setTemplatesURIs(stringArray(attrs.get("labeledURI")));
 }
  @Override
  protected Attributes storeTo(HL7Application hl7App, String deviceDN, Attributes attrs) {
    super.storeTo(hl7App, deviceDN, attrs);
    if (!(hl7App instanceof ArchiveHL7Application)) return attrs;

    ArchiveHL7Application arcHL7App = (ArchiveHL7Application) hl7App;
    storeNotEmpty(attrs, "labeledURI", arcHL7App.getTemplatesURIs());
    return attrs;
  }
 @Override
 protected void loadFrom(Device device, Attributes attrs)
     throws NamingException, CertificateException {
   super.loadFrom(device, attrs);
   if (!(device instanceof ArchiveDevice)) return;
   ArchiveDevice arcdev = (ArchiveDevice) device;
   arcdev.setFuzzyAlgorithmClass(stringValue(attrs.get("dcmFuzzyAlgorithmClass")));
   arcdev.setConfigurationStaleTimeout(intValue(attrs.get("dcmConfigurationStaleTimeout"), 0));
 }
 @Override
 protected void loadChilds(ApplicationEntity ae, String aeDN) throws NamingException {
   super.loadChilds(ae, aeDN);
   if (!(ae instanceof ArchiveApplicationEntity)) return;
   ArchiveApplicationEntity arcae = (ArchiveApplicationEntity) ae;
   load(arcae.getAttributeCoercions(), aeDN);
   loadStoreDuplicates(arcae.getStoreDuplicates(), aeDN);
   loadRejectionNotes(arcae.getRejectionNotes(), aeDN);
 }
 @Override
 protected Attributes storeTo(Device device, Attributes attrs) {
   super.storeTo(device, attrs);
   if (!(device instanceof ArchiveDevice)) return attrs;
   ArchiveDevice arcDev = (ArchiveDevice) device;
   storeNotNull(attrs, "dcmFuzzyAlgorithmClass", arcDev.getFuzzyAlgorithmClass());
   storeNotDef(attrs, "dcmConfigurationStaleTimeout", arcDev.getConfigurationStaleTimeout(), 0);
   return attrs;
 }
 @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)));
 }
  @Override
  protected List<ModificationItem> storeDiffs(
      HL7Application a, HL7Application b, String deviceDN, List<ModificationItem> mods) {
    super.storeDiffs(a, b, deviceDN, mods);
    if (!(a instanceof ArchiveHL7Application && b instanceof ArchiveHL7Application)) return mods;

    ArchiveHL7Application aa = (ArchiveHL7Application) a;
    ArchiveHL7Application bb = (ArchiveHL7Application) b;
    storeDiff(mods, "labeledURI", aa.getTemplatesURIs(), bb.getTemplatesURIs());
    return mods;
  }
 @Override
 protected void storeChilds(String aeDN, ApplicationEntity ae) throws NamingException {
   super.storeChilds(aeDN, ae);
   if (!(ae instanceof ArchiveApplicationEntity)) return;
   ArchiveApplicationEntity arcAE = (ArchiveApplicationEntity) ae;
   store(arcAE.getAttributeCoercions(), aeDN);
   for (StoreDuplicate sd : arcAE.getStoreDuplicates())
     createSubcontext(dnOf(sd, aeDN), storeTo(sd, new BasicAttributes(true)));
   for (RejectionNote rn : arcAE.getRejectionNotes())
     createSubcontext(dnOf(rn, aeDN), storeTo(rn, new BasicAttributes(true)));
 }
 @Override
 protected Attributes storeTo(ApplicationEntity ae, String deviceDN, Attributes attrs) {
   super.storeTo(ae, deviceDN, attrs);
   if (!(ae instanceof ArchiveApplicationEntity)) return attrs;
   ArchiveApplicationEntity arcAE = (ArchiveApplicationEntity) ae;
   storeNotNull(attrs, "dcmFileSystemGroupID", arcAE.getFileSystemGroupID());
   storeNotNull(attrs, "dcmSpoolFilePathFormat", arcAE.getSpoolFilePathFormat());
   storeNotNull(attrs, "dcmStorageFilePathFormat", arcAE.getStorageFilePathFormat());
   storeNotNull(attrs, "dcmDigestAlgorithm", arcAE.getDigestAlgorithm());
   storeNotNull(attrs, "dcmExternalRetrieveAET", arcAE.getExternalRetrieveAET());
   storeNotEmpty(attrs, "dcmRetrieveAET", arcAE.getRetrieveAETs());
   storeNotDef(attrs, "dcmMatchUnknown", arcAE.isMatchUnknown(), false);
   storeNotDef(attrs, "dcmSendPendingCGet", arcAE.isSendPendingCGet(), false);
   storeNotDef(attrs, "dcmSendPendingCMoveInterval", arcAE.getSendPendingCMoveInterval(), 0);
   storeNotDef(
       attrs,
       "dcmSuppressWarningCoercionOfDataElements",
       arcAE.isSuppressWarningCoercionOfDataElements(),
       false);
   storeNotDef(attrs, "dcmStoreOriginalAttributes", arcAE.isStoreOriginalAttributes(), false);
   storeNotDef(
       attrs, "dcmPreserveSpoolFileOnFailure", arcAE.isPreserveSpoolFileOnFailure(), false);
   storeNotNull(attrs, "dcmModifyingSystem", arcAE.getModifyingSystem());
   storeNotDef(attrs, "dcmStgCmtDelay", arcAE.getStorageCommitmentDelay(), 0);
   storeNotDef(attrs, "dcmStgCmtMaxRetries", arcAE.getStorageCommitmentMaxRetries(), 0);
   storeNotDef(
       attrs,
       "dcmStgCmtRetryInterval",
       arcAE.getStorageCommitmentRetryInterval(),
       ArchiveApplicationEntity.DEF_RETRY_INTERVAL);
   storeNotEmpty(attrs, "dcmFwdMppsDestination", arcAE.getForwardMPPSDestinations());
   storeNotDef(attrs, "dcmFwdMppsMaxRetries", arcAE.getForwardMPPSMaxRetries(), 0);
   storeNotDef(
       attrs,
       "dcmFwdMppsRetryInterval",
       arcAE.getForwardMPPSRetryInterval(),
       ArchiveApplicationEntity.DEF_RETRY_INTERVAL);
   storeNotEmpty(attrs, "dcmIanDestination", arcAE.getIANDestinations());
   storeNotDef(attrs, "dcmIanMaxRetries", arcAE.getIANMaxRetries(), 0);
   storeNotDef(
       attrs,
       "dcmIanRetryInterval",
       arcAE.getIANRetryInterval(),
       ArchiveApplicationEntity.DEF_RETRY_INTERVAL);
   storeNotDef(attrs, "dcmShowEmptySeries", arcAE.isShowEmptySeries(), false);
   storeNotDef(attrs, "dcmShowEmptyStudy", arcAE.isShowEmptyStudy(), false);
   storeNotDef(attrs, "dcmReturnOtherPatientIDs", arcAE.isReturnOtherPatientIDs(), false);
   storeNotDef(attrs, "dcmReturnOtherPatientNames", arcAE.isReturnOtherPatientNames(), false);
   storeNotNull(attrs, "hl7PIXConsumerApplication", arcAE.getLocalPIXConsumerApplication());
   storeNotNull(attrs, "hl7PIXManagerApplication", arcAE.getRemotePIXManagerApplication());
   return attrs;
 }
  @Override
  protected void mergeChilds(ApplicationEntity prev, ApplicationEntity ae, String aeDN)
      throws NamingException {
    super.mergeChilds(prev, ae, aeDN);
    if (!(prev instanceof ArchiveApplicationEntity && ae instanceof ArchiveApplicationEntity))
      return;

    ArchiveApplicationEntity aa = (ArchiveApplicationEntity) prev;
    ArchiveApplicationEntity bb = (ArchiveApplicationEntity) ae;
    merge(aa.getAttributeCoercions(), bb.getAttributeCoercions(), aeDN);
    mergeStoreDuplicates(aa.getStoreDuplicates(), bb.getStoreDuplicates(), aeDN);
    mergeRejectionNotes(aa.getRejectionNotes(), bb.getRejectionNotes(), aeDN);
  }
  @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>()));
  }
  @Override
  protected List<ModificationItem> storeDiffs(Device a, Device b, List<ModificationItem> mods) {
    super.storeDiffs(a, b, mods);
    if (!(a instanceof ArchiveDevice && b instanceof ArchiveDevice)) return mods;

    ArchiveDevice aa = (ArchiveDevice) a;
    ArchiveDevice bb = (ArchiveDevice) b;
    storeDiff(
        mods, "dcmFuzzyAlgorithmClass", aa.getFuzzyAlgorithmClass(), bb.getFuzzyAlgorithmClass());
    storeDiff(
        mods,
        "dcmConfigurationStaleTimeout",
        aa.getConfigurationStaleTimeout(),
        bb.getConfigurationStaleTimeout(),
        0);
    return mods;
  }
 @Override
 protected void loadFrom(ApplicationEntity ae, Attributes attrs) throws NamingException {
   super.loadFrom(ae, attrs);
   if (!(ae instanceof ArchiveApplicationEntity)) return;
   ArchiveApplicationEntity arcae = (ArchiveApplicationEntity) ae;
   arcae.setFileSystemGroupID(stringValue(attrs.get("dcmFileSystemGroupID")));
   arcae.setSpoolFilePathFormat(attributesFormat(attrs.get("dcmSpoolFilePathFormat")));
   arcae.setStorageFilePathFormat(attributesFormat(attrs.get("dcmStorageFilePathFormat")));
   arcae.setDigestAlgorithm(stringValue(attrs.get("dcmDigestAlgorithm")));
   arcae.setExternalRetrieveAET(stringValue(attrs.get("dcmExternalRetrieveAET")));
   arcae.setRetrieveAETs(stringArray(attrs.get("dcmRetrieveAET")));
   arcae.setMatchUnknown(booleanValue(attrs.get("dcmMatchUnknown"), false));
   arcae.setSendPendingCGet(booleanValue(attrs.get("dcmSendPendingCGet"), false));
   arcae.setSendPendingCMoveInterval(intValue(attrs.get("dcmSendPendingCMoveInterval"), 0));
   arcae.setSuppressWarningCoercionOfDataElements(
       booleanValue(attrs.get("dcmSuppressWarningCoercionOfDataElements"), false));
   arcae.setStoreOriginalAttributes(booleanValue(attrs.get("dcmStoreOriginalAttributes"), false));
   arcae.setPreserveSpoolFileOnFailure(
       booleanValue(attrs.get("dcmPreserveSpoolFileOnFailure"), false));
   arcae.setModifyingSystem(stringValue(attrs.get("dcmModifyingSystem")));
   arcae.setStorageCommitmentDelay(intValue(attrs.get("dcmStgCmtDelay"), 0));
   arcae.setStorageCommitmentMaxRetries(intValue(attrs.get("dcmStgCmtMaxRetries"), 0));
   arcae.setStorageCommitmentRetryInterval(
       intValue(attrs.get("dcmStgCmtRetryInterval"), ArchiveApplicationEntity.DEF_RETRY_INTERVAL));
   arcae.setForwardMPPSDestinations(stringArray(attrs.get("dcmFwdMppsDestination")));
   arcae.setForwardMPPSMaxRetries(intValue(attrs.get("dcmFwdMppsMaxRetries"), 0));
   arcae.setForwardMPPSRetryInterval(
       intValue(
           attrs.get("dcmFwdMppsRetryInterval"), ArchiveApplicationEntity.DEF_RETRY_INTERVAL));
   arcae.setIANDestinations(stringArray(attrs.get("dcmIanDestination")));
   arcae.setIANMaxRetries(intValue(attrs.get("dcmIanMaxRetries"), 0));
   arcae.setIANRetryInterval(
       intValue(attrs.get("dcmIanRetryInterval"), ArchiveApplicationEntity.DEF_RETRY_INTERVAL));
   arcae.setShowEmptySeries(booleanValue(attrs.get("dcmShowEmptySeries"), false));
   arcae.setShowEmptyStudy(booleanValue(attrs.get("dcmShowEmptyStudy"), false));
   arcae.setReturnOtherPatientIDs(booleanValue(attrs.get("dcmReturnOtherPatientIDs"), false));
   arcae.setReturnOtherPatientNames(booleanValue(attrs.get("dcmReturnOtherPatientNames"), false));
   arcae.setLocalPIXConsumerApplication(stringValue(attrs.get("hl7PIXConsumerApplication")));
   arcae.setRemotePIXManagerApplication(stringValue(attrs.get("hl7PIXManagerApplication")));
 }
 @Override
 protected Attribute objectClassesOf(HL7Application app, Attribute attr) {
   super.objectClassesOf(app, attr);
   if (app instanceof ArchiveHL7Application) attr.add("dcmArchiveHL7Application");
   return attr;
 }
 @Override
 protected Attribute objectClassesOf(ApplicationEntity ae, Attribute attr) {
   super.objectClassesOf(ae, attr);
   if (ae instanceof ArchiveApplicationEntity) attr.add("dcmArchiveNetworkAE");
   return attr;
 }
 @Override
 protected Attribute objectClassesOf(Device device, Attribute attr) {
   super.objectClassesOf(device, attr);
   if (device instanceof ArchiveDevice) attr.add("dcmArchiveDevice");
   return attr;
 }