private void loadRetries(ProxyAEExtension proxyAEE, String aeDN) throws NamingException { NamingEnumeration<SearchResult> ne = config.search(aeDN, "(objectclass=dcmRetry)"); try { List<Retry> retries = new ArrayList<Retry>(); while (ne.hasMore()) { SearchResult sr = ne.next(); Attributes attrs = sr.getAttributes(); Retry retry = new Retry(RetryObject.valueOf(LdapUtils.stringValue(attrs.get("dcmRetryObject"), null)), LdapUtils.intValue(attrs.get("dcmRetryDelay"), 60), LdapUtils.intValue( attrs.get("dcmRetryNum"), 10), LdapUtils.booleanValue( attrs.get("dcmDeleteAfterFinalRetry"), false)); retries.add(retry); } proxyAEE.setRetries(retries); } finally { LdapUtils.safeClose(ne); } }
private List<ModificationItem> storeDiffs(ConfigurationChanges.ModifiedObject ldapObj, ImageReaderParam prevParam, ImageReaderParam param, List<ModificationItem> mods) { LdapUtils.storeDiffObject(ldapObj, mods, "dcmIIOFormatName", prevParam.formatName, param.formatName, null); LdapUtils.storeDiffObject(ldapObj, mods, "dcmJavaClassName", prevParam.className, param.className, null); LdapUtils.storeDiffObject(ldapObj, mods, "dcmPatchJPEGLS", prevParam.patchJPEGLS, param.patchJPEGLS, null); LdapUtils.storeDiff(ldapObj, mods, "dcmImageReadParam", prevParam.getImageReadParams(), param.getImageReadParams()); return mods; }
private static Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, BasicBulkDataDescriptor descriptor, BasicAttributes attrs) { attrs.put("objectclass", "dcmBulkDataDescriptor"); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmBulkDataDescriptorID", descriptor.getBulkDataDescriptorID(), null); LdapUtils.storeNotDef(ldapObj, attrs, "dcmBulkDataExcludeDefaults", descriptor.isExcludeDefaults(), false); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmAttributeSelector", descriptor.getAttributeSelectors()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmBulkDataVRLengthThreshold", descriptor.getLengthsThresholdsAsStrings()); return attrs; }
private CompressionRule compressionRule(Attributes attrs) throws NamingException { return new CompressionRule( LdapUtils.stringValue(attrs.get("cn"), null), LdapUtils.stringArray(attrs.get("dcmPhotometricInterpretation")), LdapUtils.intArray(attrs.get("dcmBitsStored")), LdapUtils.intValue(attrs.get("dcmPixelRepresentation"), -1), LdapUtils.stringArray(attrs.get("dcmAETitle")), LdapUtils.stringArray(attrs.get("dcmSOPClass")), LdapUtils.stringArray(attrs.get("dcmBodyPartExamined")), LdapUtils.stringValue(attrs.get("dicomTransferSyntax"), null), LdapUtils.stringArray(attrs.get("dcmImageWriteParam"))); }
private void loadFrom(Connection conn, Attributes attrs, boolean extended) throws NamingException { conn.setCommonName(LdapUtils.stringValue(attrs.get("cn"), null)); conn.setHostname(LdapUtils.stringValue(attrs.get("dicomHostname"), null)); conn.setPort(LdapUtils.intValue(attrs.get("dicomPort"), Connection.NOT_LISTENING)); conn.setTlsCipherSuites(LdapUtils.stringArray(attrs.get("dicomTLSCipherSuite"))); conn.setInstalled(LdapUtils.booleanValue(attrs.get("dicomInstalled"), null)); if (!extended) return; conn.setProtocol(LdapUtils.enumValue(Protocol.class, attrs.get("dcmProtocol"), Protocol.DICOM)); conn.setHttpProxy(LdapUtils.stringValue(attrs.get("dcmHTTPProxy"), null)); conn.setBlacklist(LdapUtils.stringArray(attrs.get("dcmBlacklistedHostname"))); conn.setBacklog(LdapUtils.intValue(attrs.get("dcmTCPBacklog"), Connection.DEF_BACKLOG)); conn.setConnectTimeout(LdapUtils.intValue(attrs.get("dcmTCPConnectTimeout"), Connection.NO_TIMEOUT)); conn.setRequestTimeout(LdapUtils.intValue(attrs.get("dcmAARQTimeout"), Connection.NO_TIMEOUT)); conn.setAcceptTimeout(LdapUtils.intValue(attrs.get("dcmAAACTimeout"), Connection.NO_TIMEOUT)); conn.setReleaseTimeout(LdapUtils.intValue(attrs.get("dcmARRPTimeout"), Connection.NO_TIMEOUT)); conn.setResponseTimeout(LdapUtils.intValue(attrs.get("dcmResponseTimeout"), Connection.NO_TIMEOUT)); conn.setRetrieveTimeout(LdapUtils.intValue(attrs.get("dcmRetrieveTimeout"), Connection.NO_TIMEOUT)); conn.setRetrieveTimeoutTotal(LdapUtils.booleanValue(attrs.get("dcmRetrieveTimeoutTotal"), false)); conn.setIdleTimeout(LdapUtils.intValue(attrs.get("dcmIdleTimeout"), Connection.NO_TIMEOUT)); conn.setSocketCloseDelay(LdapUtils.intValue(attrs.get("dcmTCPCloseDelay"),
private void loadFrom(Device device, Attributes attrs) throws NamingException, CertificateException { device.setDescription(LdapUtils.stringValue(attrs.get("dicomDescription"), null)); device.setDeviceUID(LdapUtils.stringValue(attrs.get("dicomDeviceUID"), null)); device.setManufacturer(LdapUtils.stringValue(attrs.get("dicomManufacturer"), null)); device.setManufacturerModelName(LdapUtils.stringValue(attrs.get("dicomManufacturerModelName"), null)); device.setSoftwareVersions(LdapUtils.stringArray(attrs.get("dicomSoftwareVersion"))); device.setStationName(LdapUtils.stringValue(attrs.get("dicomStationName"), null)); device.setDeviceSerialNumber(LdapUtils.stringValue(attrs.get("dicomDeviceSerialNumber"), null)); device.setIssuerOfPatientID( issuerValue(attrs.get("dicomIssuerOfPatientID"))); device.setIssuerOfSpecimenIdentifier( issuerValue(attrs.get("dicomIssuerOfSpecimenIdentifier"))); device.setInstitutionNames(LdapUtils.stringArray(attrs.get("dicomInstitutionName"))); device.setInstitutionCodes(LdapUtils.codeArray(attrs.get("dicomInstitutionCode"))); device.setInstitutionAddresses(LdapUtils.stringArray(attrs.get("dicomInstitutionAddress"))); device.setInstitutionalDepartmentNames( LdapUtils.stringArray(attrs.get("dicomInstitutionDepartmentName"))); device.setPrimaryDeviceTypes(LdapUtils.stringArray(attrs.get("dicomPrimaryDeviceType"))); device.setRelatedDeviceRefs(LdapUtils.stringArray(attrs.get("dicomRelatedDeviceReference"))); for (String dn : LdapUtils.stringArray(attrs.get("dicomAuthorizedNodeCertificateReference"))) device.setAuthorizedNodeCertificates(dn, loadCertificates(dn)); for (String dn : LdapUtils.stringArray(attrs.get("dicomThisNodeCertificateReference"))) device.setThisNodeCertificates(dn, loadCertificates(dn)); device.setVendorData(byteArrays(attrs.get("dicomVendorData"))); device.setInstalled(LdapUtils.booleanValue(attrs.get("dicomInstalled"), true)); if (!LdapUtils.hasObjectClass(attrs, "dcmDevice")) return;
private void loadFrom(WebApplication webapp, Attributes attrs) throws NamingException { webapp.setDescription(LdapUtils.stringValue(attrs.get("dicomDescription"), null)); webapp.setServicePath(LdapUtils.stringValue(attrs.get("dcmWebServicePath"), null)); webapp.setServiceClasses(LdapUtils.enumArray(WebApplication.ServiceClass.class, attrs.get("dcmWebServiceClass"))); webapp.setAETitle(LdapUtils.stringValue(attrs.get("dicomAETitle"), null)); webapp.setApplicationClusters(LdapUtils.stringArray(attrs.get("dicomApplicationCluster"))); webapp.setInstalled(LdapUtils.booleanValue(attrs.get("dicomInstalled"), null)); }
private BasicBulkDataDescriptor loadBulkDataDescriptor(SearchResult sr) throws NamingException { Attributes attrs = sr.getAttributes(); BasicBulkDataDescriptor descriptor = new BasicBulkDataDescriptor( LdapUtils.stringValue(attrs.get("dcmBulkDataDescriptorID"), null)); descriptor.excludeDefaults(LdapUtils.booleanValue(attrs.get("dcmBulkDataExcludeDefaults"), false)); descriptor.setAttributeSelectorsFromStrings(LdapUtils.stringArray(attrs.get("dcmAttributeSelector"))); descriptor.setLengthsThresholdsFromStrings(LdapUtils.stringArray(attrs.get("dcmBulkDataVRLengthThreshold"))); return descriptor ; }
private WebApplication loadWebApplication(SearchResult sr, String deviceDN, Device device) throws NamingException, ConfigurationException { Attributes attrs = sr.getAttributes(); WebApplication webapp = new WebApplication(LdapUtils.stringValue(attrs.get("dcmWebAppName"), null)); loadFrom(webapp, attrs); for (String connDN : LdapUtils.stringArray(attrs.get("dicomNetworkConnectionReference"))) webapp.addConnection(LdapUtils.findConnection(connDN, deviceDN, device)); return webapp ; }
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, AuditLogger logger, String deviceDN, Attributes attrs) { attrs.put(new BasicAttribute("objectclass", "dcmAuditLogger")); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "cn", logger.getCommonName(), null); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditFacility", logger.getFacility().ordinal(), 10); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditSuccessSeverity", logger.getSuccessSeverity().ordinal(), 5); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditMinorFailureSeverity", logger.getMinorFailureSeverity().ordinal(), 4); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditSeriousFailureSeverity", logger.getSeriousFailureSeverity().ordinal(), 3); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditMajorFailureSeverity", logger.getMajorFailureSeverity().ordinal(), 2); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditSourceID", logger.getAuditSourceID(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditEnterpriseSiteID", logger.getAuditEnterpriseSiteID(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmAuditSourceTypeCode", logger.getAuditSourceTypeCodes()); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditApplicationName", logger.getApplicationName(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditMessageID", logger.getMessageID(), AuditLogger.MESSAGE_ID); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditMessageEncoding", logger.getEncoding(), "UTF-8"); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditMessageSchemaURI", logger.getSchemaURI(), AuditMessages.SCHEMA_URI); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditMessageBOM", logger.isIncludeBOM(), true); LdapUtils.storeNotDef(ldapObj, attrs, "dcmAuditMessageFormatXML",
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, String tsuid, ImageReaderParam param, Attributes attrs) { attrs.put("objectclass", "dcmImageReader"); attrs.put("dicomTransferSyntax", tsuid); attrs.put("dcmIIOFormatName", param.formatName); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmJavaClassName", param.className, null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmPatchJPEGLS", param.patchJPEGLS, null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmImageReadParam", param.getImageReadParams()); return attrs; }
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, TransferCapability tc, Attributes attrs) { BasicAttribute objectclass = new BasicAttribute("objectclass", "dicomTransferCapability"); attrs.put(objectclass); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "cn", tc.getCommonName(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomSOPClass", tc.getSopClass(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomTransferRole", tc.getRole(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomTransferSyntax", tc.getTransferSyntaxes()); if (!extended) return attrs; LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmPreferredTransferSyntax", LdapUtils.addOrdinalPrefix(tc.getPreferredTransferSyntaxes())); EnumSet<QueryOption> queryOpts = tc.getQueryOptions(); if (queryOpts != null) { LdapUtils.storeNotDef(ldapObj, attrs, "dcmRelationalQueries", queryOpts.contains(QueryOption.RELATIONAL), false); LdapUtils.storeNotDef(ldapObj, attrs, "dcmCombinedDateTimeMatching", queryOpts.contains(QueryOption.DATETIME), false); LdapUtils.storeNotDef(ldapObj, attrs, "dcmFuzzySemanticMatching", queryOpts.contains(QueryOption.FUZZY), false); LdapUtils.storeNotDef(ldapObj, attrs, "dcmTimezoneQueryAdjustment", queryOpts.contains(QueryOption.TIMEZONE), false); LdapUtils.storeInt(ldapObj, attrs, "dcmStorageConformance", storageOpts.getLevelOfSupport().ordinal()); LdapUtils.storeInt(ldapObj, attrs, "dcmDigitalSignatureSupport", storageOpts.getDigitalSignatureSupport().ordinal()); LdapUtils.storeInt(ldapObj, attrs, "dcmDataElementCoercion", storageOpts.getElementCoercion().ordinal());
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, Device device, Attributes attrs) { BasicAttribute objectclass = new BasicAttribute("objectclass", "dicomDevice"); attrs.put(objectclass); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDeviceName", device.getDeviceName(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDescription", device.getDescription(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDeviceUID", device.getDeviceUID(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomManufacturer", device.getManufacturer(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomManufacturerModelName", device.getManufacturerModelName(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomSoftwareVersion", device.getSoftwareVersions()); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomStationName", device.getStationName(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDeviceSerialNumber", device.getDeviceSerialNumber(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomIssuerOfPatientID", device.getIssuerOfPatientID(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomIssuerOfAccessionNumber", device.getIssuerOfAccessionNumber(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomOrderPlacerIdentifier", device.getOrderPlacerIdentifier(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomOrderFillerIdentifier", device.getOrderFillerIdentifier(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomIssuerOfAdmissionID", device.getIssuerOfAdmissionID(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomIssuerOfServiceEpisodeID", device.getIssuerOfServiceEpisodeID(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomIssuerOfContainerIdentifier", device.getIssuerOfContainerIdentifier(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomIssuerOfSpecimenIdentifier", device.getIssuerOfSpecimenIdentifier(), null);
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, WebApplication webapp, String deviceDN, Attributes attrs) { BasicAttribute objectclass = new BasicAttribute("objectclass", "dcmWebApp"); attrs.put(objectclass); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmWebAppName", webapp.getApplicationName(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDescription", webapp.getDescription(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmWebServicePath", webapp.getServicePath(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmWebServiceClass", webapp.getServiceClasses()); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomAETitle", webapp.getAETitle(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomApplicationCluster", webapp.getApplicationClusters()); LdapUtils.storeConnRefs(ldapObj, attrs, webapp.getConnections(), deviceDN); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomInstalled", webapp.getInstalled(), null); return attrs; }
@SuppressWarnings("unchecked") public static boolean hasObjectClass(Attributes attrs, String objectClass) throws NamingException { NamingEnumeration<String> ne = (NamingEnumeration<String>) attrs.get("objectclass").getAll(); try { while (ne.hasMore()) if (objectClass.equals(ne.next())) return true; } finally { LdapUtils.safeClose(ne); } return false; }
private void loadFrom(TransferCapability tc, Attributes attrs) throws NamingException { tc.setCommonName(LdapUtils.stringValue(attrs.get("cn"), null)); tc.setSopClass(LdapUtils.stringValue(attrs.get("dicomSOPClass"), null)); tc.setRole(TransferCapability.Role.valueOf( LdapUtils.stringValue(attrs.get("dicomTransferRole"), null))); tc.setTransferSyntaxes(LdapUtils.stringArray(attrs.get("dicomTransferSyntax"))); if (!LdapUtils.hasObjectClass(attrs, "dcmTransferCapability")) return; tc.setPreferredTransferSyntaxes(LdapUtils.removeOrdinalPrefix( LdapUtils.stringArray(attrs.get("dcmPreferredTransferSyntax")))); tc.setQueryOptions(toQueryOptions(attrs)); tc.setStorageOptions(toStorageOptions(attrs)); }
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, ApplicationEntity ae, String deviceDN, Attributes attrs) { BasicAttribute objectclass = new BasicAttribute("objectclass", "dicomNetworkAE"); attrs.put(objectclass); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomAETitle", ae.getAETitle(), null); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDescription", ae.getDescription(), null); storeNotEmpty(ldapObj, attrs, "dicomVendorData", ae.getVendorData()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomApplicationCluster", ae.getApplicationClusters()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomPreferredCallingAETitle", ae.getPreferredCallingAETitles()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomPreferredCalledAETitle", ae.getPreferredCalledAETitles()); LdapUtils.storeBoolean(ldapObj, attrs, "dicomAssociationInitiator", ae.isAssociationInitiator()); LdapUtils.storeBoolean(ldapObj, attrs, "dicomAssociationAcceptor", ae.isAssociationAcceptor()); LdapUtils.storeConnRefs(ldapObj, attrs, ae.getConnections(), deviceDN); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomSupportedCharacterSet", ae.getSupportedCharacterSets()); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomInstalled", ae.getInstalled(), null); if (!extended) return attrs; objectclass.add("dcmNetworkAE"); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmPreferredTransferSyntax", LdapUtils.addOrdinalPrefix(ae.getPreferredTransferSyntaxes())); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7ApplicationName", ae.getHl7ApplicationName(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmAcceptedCallingAETitle", ae.getAcceptedCallingAETitles()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmOtherAETitle", ae.getOtherAETitles()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmMasqueradeCallingAETitle", ae.getMasqueradeCallingAETitles()); for (LdapDicomConfigurationExtension ext : extensions) ext.storeTo(ldapObj, ae, attrs); return attrs; }
private void storeDiffs(ConfigurationChanges.ModifiedObject ldapObj, EnumSet<QueryOption> prev, EnumSet<QueryOption> val, List<ModificationItem> mods) { if (prev != null ? prev.equals(val) : val == null) return; LdapUtils.storeDiff(ldapObj, mods, "dcmRelationalQueries", prev != null && prev.contains(QueryOption.RELATIONAL), val != null && val.contains(QueryOption.RELATIONAL), false); LdapUtils.storeDiff(ldapObj, mods, "dcmCombinedDateTimeMatching", prev != null && prev.contains(QueryOption.DATETIME), val != null && val.contains(QueryOption.DATETIME), false); LdapUtils.storeDiff(ldapObj, mods, "dcmFuzzySemanticMatching", prev != null && prev.contains(QueryOption.FUZZY), val != null && val.contains(QueryOption.FUZZY), false); LdapUtils.storeDiff(ldapObj, mods, "dcmTimezoneQueryAdjustment", prev != null && prev.contains(QueryOption.TIMEZONE), val != null && val.contains(QueryOption.TIMEZONE), false); }
private List<ModificationItem> storeDiffs(ConfigurationChanges.ModifiedObject ldapObj, TransferCapability a, TransferCapability b, List<ModificationItem> mods) { LdapUtils.storeDiffObject(ldapObj, mods, "dicomSOPClass", a.getSopClass(), b.getSopClass(), null); LdapUtils.storeDiffObject(ldapObj, mods, "dicomTransferRole", a.getRole(), b.getRole(), null); LdapUtils.storeDiff(ldapObj, mods, "dicomTransferSyntax", a.getTransferSyntaxes(), b.getTransferSyntaxes()); if (!extended) return mods; LdapUtils.storeDiffWithOrdinalPrefix(ldapObj, mods, "dcmPreferredTransferSyntax", a.getPreferredTransferSyntaxes(), b.getPreferredTransferSyntaxes()); storeDiffs(ldapObj, a.getQueryOptions(), b.getQueryOptions(), mods); storeDiffs(ldapObj, a.getStorageOptions(), b.getStorageOptions(), mods); return mods; }