Class DicomDatabaseInformationModel

    • Field Detail

      • derivedStudyDateTimeColumnName

        protected static final java.lang.String derivedStudyDateTimeColumnName
        See Also:
        Constant Field Values
      • derivedSeriesDateTimeColumnName

        protected static final java.lang.String derivedSeriesDateTimeColumnName
        See Also:
        Constant Field Values
      • derivedContentDateTimeColumnName

        protected static final java.lang.String derivedContentDateTimeColumnName
        See Also:
        Constant Field Values
      • derivedAcquisitionDateTimeColumnName

        protected static final java.lang.String derivedAcquisitionDateTimeColumnName
        See Also:
        Constant Field Values
      • derivedLossyImageCompressionColumnName

        protected static final java.lang.String derivedLossyImageCompressionColumnName
        See Also:
        Constant Field Values
    • Constructor Detail

      • DicomDatabaseInformationModel

        public DicomDatabaseInformationModel​(java.lang.String databaseFileName,
                                             InformationEntity rootInformationEntity,
                                             DicomDictionary dictionary,
                                             java.lang.String databaseRootName)
                                      throws DicomException
        Parameters:
        databaseFileName -
        rootInformationEntity -
        dictionary -
        databaseRootName -
        Throws:
        DicomException
      • DicomDatabaseInformationModel

        public DicomDatabaseInformationModel​(java.lang.String databaseFileName,
                                             java.lang.String databaseServerName,
                                             InformationEntity rootInformationEntity,
                                             DicomDictionary dictionary)
                                      throws DicomException
        Parameters:
        databaseFileName -
        rootInformationEntity -
        dictionary -
        Throws:
        DicomException
      • DicomDatabaseInformationModel

        public DicomDatabaseInformationModel​(java.lang.String databaseFileName,
                                             java.lang.String databaseServerName,
                                             InformationEntity rootInformationEntity,
                                             DicomDictionary dictionary,
                                             java.lang.String databaseRootName)
                                      throws DicomException
        Parameters:
        databaseFileName -
        rootInformationEntity -
        dictionary -
        databaseRootName -
        Throws:
        DicomException
    • Method Detail

      • getNametoDescribeThisInstanceOfInformationEntity

        public java.lang.String getNametoDescribeThisInstanceOfInformationEntity​(InformationEntity ie,
                                                                                 java.util.Map returnedAttributes)
        Description copied from class: DatabaseInformationModel

        For a particular instance of an information entity, find a descriptive name for the entity suitable for rendering.

        For a patient, this might be the name Patient. For an instance, this will depend on the SOPClassUID, and might be an Image, a Waveform, etc.

        Specified by:
        getNametoDescribeThisInstanceOfInformationEntity in class DatabaseInformationModel
        Parameters:
        ie -
        returnedAttributes -
        Returns:
        a human-readable string name of the entity
      • extendInsertStatementStringWithPersonNameSearchColumnsForSelectedInformationEntity

        protected void extendInsertStatementStringWithPersonNameSearchColumnsForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                          AttributeList list,
                                                                                                          InformationEntity ie)
                                                                                                   throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the names of the additional search columns derived from person name attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        Specific to each concrete information model extending DatabaseInformationModel.

        Specified by:
        extendInsertStatementStringWithPersonNameSearchColumnsForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which a select statement is being constructed
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • extendInsertStatementStringWithPersonNameSearchValuesForSelectedInformationEntity

        protected void extendInsertStatementStringWithPersonNameSearchValuesForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                         AttributeList list,
                                                                                                         InformationEntity ie)
                                                                                                  throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the values of the additional search columns derived from person name attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        Specific to each concrete information model extending DatabaseInformationModel.

        Specified by:
        extendInsertStatementStringWithPersonNameSearchValuesForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which a select statement is being constructed
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • extendInsertStatementStringWithAttributeNamesForSelectedInformationEntity

        protected void extendInsertStatementStringWithAttributeNamesForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                 AttributeList list,
                                                                                                 InformationEntity ie)
                                                                                          throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the names of the attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        The default implementation adds values for all attributes that are present in the database tables and present in the instance.

        At the INSTANCE level, InstanceNumber is always added.

        At the INSTANCE level, ImageOrientationPatient within PlaneOrientationSequence within SharedFunctionalGroupsSequence is always added, if present.

        Specified by:
        extendInsertStatementStringWithAttributeNamesForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which an insert statement is being constructed
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • extendInsertStatementStringWithAttributeValuesForSelectedInformationEntity

        protected void extendInsertStatementStringWithAttributeValuesForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                  AttributeList list,
                                                                                                  InformationEntity ie,
                                                                                                  java.lang.String fileName)
                                                                                           throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the values of the attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        The default implementation adds values for all attributes that are present in the database tables and present in the instance.

        At the INSTANCE level, InstanceNumber is always added.

        At the INSTANCE level, ImageOrientationPatient within PlaneOrientationSequence within SharedFunctionalGroupsSequence is always added, if present.

        At the INSTANCE level, the file reference type is left empty since unknown.

        Specified by:
        extendInsertStatementStringWithAttributeValuesForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which an insert statement is being constructed
        fileName - the local filename, which may be non-null for INSTANCE level insertions
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • extendInsertStatementStringWithAttributeValuesForSelectedInformationEntity

        protected void extendInsertStatementStringWithAttributeValuesForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                  AttributeList list,
                                                                                                  InformationEntity ie,
                                                                                                  java.lang.String fileName,
                                                                                                  java.lang.String fileReferenceType)
                                                                                           throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the values of the attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        The default implementation adds values for all attributes that are present in the database tables and present in the instance.

        At the INSTANCE level, InstanceNumber is always added.

        At the INSTANCE level, ImageOrientationPatient within PlaneOrientationSequence within SharedFunctionalGroupsSequence is always added, if present.

        Specified by:
        extendInsertStatementStringWithAttributeValuesForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which an insert statement is being constructed
        fileName - the local filename, which may be non-null for INSTANCE level insertions
        fileReferenceType - "C" for copied (i.e., delete on purge), "R" for referenced (i.e., do not delete on purge)
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • extendInsertStatementStringWithDerivedAttributeNamesForSelectedInformationEntity

        protected void extendInsertStatementStringWithDerivedAttributeNamesForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                        AttributeList list,
                                                                                                        InformationEntity ie)
                                                                                                 throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the names of the derived attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        Specific to each concrete information model extending DatabaseInformationModel.

        Specified by:
        extendInsertStatementStringWithDerivedAttributeNamesForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which an insert statement is being constructed
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • getTimestampFromDate

        public java.sql.Timestamp getTimestampFromDate​(java.util.Date javaDate)
      • getDateFromDicomDateAndTime

        public java.util.Date getDateFromDicomDateAndTime​(java.lang.String date,
                                                          java.lang.String time,
                                                          java.lang.String timezone)
      • getDateFromDicomDateAndTime

        public java.util.Date getDateFromDicomDateAndTime​(java.lang.String dateTime)
      • getTimestampFromDicomDateAndTime

        public java.sql.Timestamp getTimestampFromDicomDateAndTime​(java.lang.String date,
                                                                   java.lang.String time,
                                                                   java.lang.String timezone)
      • getTimestampFromDicomDateAndTime

        public java.sql.Timestamp getTimestampFromDicomDateAndTime​(java.lang.String sdatetime)
      • extendInsertStatementStringWithDerivedAttributeValuesForSelectedInformationEntity

        protected void extendInsertStatementStringWithDerivedAttributeValuesForSelectedInformationEntity​(java.lang.StringBuffer b,
                                                                                                         AttributeList list,
                                                                                                         InformationEntity ie)
                                                                                                  throws DicomException

        Extend a SQL INSERT statement in the process of being constructed with the values of the derived attributes in the instance for the entity.

        Called when inserting a new record for an instance of the entity.

        Specific to each concrete information model extending DatabaseInformationModel.

        Specified by:
        extendInsertStatementStringWithDerivedAttributeValuesForSelectedInformationEntity in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        list - the DICOM attributes of a composite object, containing the attributes describing this instance of the entity
        ie - the InformationEntity for which an insert statement is being constructed
        Throws:
        DicomException - thrown if there are problems extracting the DICOM attributes
      • extendCreateStatementStringWithDerivedAttributes

        protected void extendCreateStatementStringWithDerivedAttributes​(java.lang.StringBuffer b,
                                                                        InformationEntity ie)

        Extend a SQL CREATE TABLE statement in the process of being constructed with any derived attributes (columns) that the model requires.

        Called when creating the tables for a new database.

        Specific to each concrete information model extending DatabaseInformationModel. Defaults to adding no extra columns if not overridden (i.e. it is not abstract).

        For example, there may be dates and times derived from DICOM attributes.

        Overrides:
        extendCreateStatementStringWithDerivedAttributes in class DatabaseInformationModel
        Parameters:
        b - the statement being constructed
        ie - the InformationEntity for which a create table statement is being constructed
      • getQuotedValueOrNULL

        public static java.lang.String getQuotedValueOrNULL​(java.lang.String value)

        Make a quoted string value suitable for using in a SQL statement from a (possibly null or empty) string.

        No attempt at escaping specially characters is made ... this is assumed already done.

        Leading or trailing whitespace is trimmed.

        Parameters:
        value - the string, which may be null or zero length
        Returns:
        the quoted string value of the attribute, or the (unquoted) string NULL if the value is null or zero length
      • getQuotedEscapedSingleStringValueOrNull

        public static java.lang.String getQuotedEscapedSingleStringValueOrNull​(Attribute a)
                                                                        throws DicomException

        Make a quoted string value suitable for using in a SQL statement from a DICOM attribute.

        Special characters should be escaped (actually they are just replaced with a hyphen).

        Multiple values are collapsed and separated by the usual DICOM backslash delimiter character (which doesn't bother SQL).

        Parameters:
        a - the DICOM attribute, which may be null, zero length or multi-valued
        Returns:
        the quoted string value of the attribute, or the (unquoted) string NULL if attribute is absent, has no value or is zero length
        Throws:
        DicomException
      • getQuotedUnescapedSingleStringValueOrNull

        public static java.lang.String getQuotedUnescapedSingleStringValueOrNull​(Attribute a)
                                                                          throws DicomException

        Make a quoted string value suitable for using in a SQL statement from a DICOM attribute.

        Does NOT escape special characters.

        Multiple values are collapsed and separated by the usual DICOM backslash delimiter character (which doesn't bother SQL).

        Parameters:
        a - the DICOM attribute, which may be null, zero length or multi-valued
        Returns:
        the quoted string value of the attribute, or the (unquoted) string NULL if attribute is absent, has no value or is zero length
        Throws:
        DicomException
      • getQuotedSingleStringValueOrNull

        public static java.lang.String getQuotedSingleStringValueOrNull​(Attribute a,
                                                                        boolean escapeSpecialCharacters)
                                                                 throws DicomException

        Make a quoted string value suitable for using in a SQL statement from a DICOM attribute.

        Special characters may be escaped (actually they are just replaced with a hyphen).

        Multiple values are collapsed and separated by the usual DICOM backslash delimiter character (which doesn't bother SQL).

        Leading or trailing whitespace in each value is trimmed.

        Parameters:
        a - the DICOM attribute, which may be null, zero length or multi-valued
        escapeSpecialCharacters - whether or not to escape special characters (currently only single quote)
        Returns:
        the quoted string value of the attribute, or the (unquoted) string NULL if attribute is absent, has no value or is zero length
        Throws:
        DicomException
      • getQueryResponseGeneratorFactory

        public QueryResponseGeneratorFactory getQueryResponseGeneratorFactory​(int debugLevel)

        Get a factory to manufacture a query response generator capable of performing a query and returning the results.

        Overrides:
        getQueryResponseGeneratorFactory in class DatabaseInformationModel
        Parameters:
        debugLevel - zero for no debugging messages, higher values more verbose messages
        Returns:
        the response generator factory
      • getRetrieveResponseGeneratorFactory

        public RetrieveResponseGeneratorFactory getRetrieveResponseGeneratorFactory​(int debugLevel)

        Get a factory to manufacture a retrieve response generator capable of performing a retrieve and returning the results.

        Overrides:
        getRetrieveResponseGeneratorFactory in class DatabaseInformationModel
        Parameters:
        debugLevel - zero for no debugging messages, higher values more verbose messages
        Returns:
        the response generator factory