com.pixelmed.query

## Class QueryInformationModel

- java.lang.Object
- - com.pixelmed.query.QueryInformationModel

Direct Known Subclasses:
  StudyRootQueryInformationModel

    public abstract class QueryInformationModel
    extends java.lang.Object

The `QueryInformationModel` class is an abstract class that contains the core functionality for performing DICOM query and retrieval over the network.

It hides the underlying DICOM network implementation.

Concrete sub-classes implement the behavior for specific query models, such as `StudyRootQueryInformationModel`, the description of which contains an exampleof building an identifier and performing a query.

The majority of methods are protected and are for the benefit of those implementing their own query models as concrete sub-classes. The public methods of primary interest to application builders are:

- `QueryInformationModel()`
- `performHierarchicalQuery()`
- `performHierarchicalMove()`
- `performHierarchicalMoveFrom()`
- `performHierarchicalMoveTo()`
- `performHierarchicalMoveFromTo()`

See Also:
  `StudyRootQueryInformationModel`

### Field Summary

Fields
`protected int` `debugLevel`

### Constructor Summary

Constructors
Constructor and Description
`QueryInformationModel(java.lang.String hostname, int port, java.lang.String calledAETitle, java.lang.String callingAETitle, int debugLevel)` Construct a query information model.

### Method Summary

Methods
`protected abstract java.util.HashSet` `getAllInformationEntitiesToIncludeAtThisQueryLevel(InformationEntity ie)`
`protected AttributeTag` `getAttributeTagOfCountOfChildren(InformationEntity ie)`
`java.lang.String` `getCalledAETitle()`
`protected abstract InformationEntity` `getChildTypeForParent(InformationEntity ie)`
`protected abstract java.lang.String` `getFindSOPClassUID()`
`protected abstract java.lang.String` `getMoveSOPClassUID()`
`java.lang.String` `getQueryLevelName(InformationEntity ie)`
`protected abstract InformationEntity` `getRoot()`
`protected abstract java.lang.String` `getStringValueForTreeFromResponseIdentifier(InformationEntity ie, AttributeList responseIdentifier)`
`AttributeTag` `getUniqueKeyForInformationEntity(InformationEntity ie)`
`void` `performHierarchicalMove(AttributeList identifier)` Retrieve DICOM object(s).
`void` `performHierarchicalMove(AttributeList identifier, java.lang.String retrieveAE)` Deprecated. See `performHierarchicalMoveFrom()`.
`void` `performHierarchicalMoveFrom(AttributeList identifier, java.lang.String retrieveAE)` Retrieve DICOM object(s) from the specified location.
`void` `performHierarchicalMoveFromTo(AttributeList identifier, java.lang.String retrieveAE, java.lang.String moveDestination)` Retrieve DICOM object(s) from the specified location to the specified location.
`void` `performHierarchicalMoveTo(AttributeList identifier, java.lang.String moveDestination)` Retrieve DICOM object(s) to the specified location.
`QueryTreeModel` `performHierarchicalQuery(AttributeList filter)` Perform a hierarchical query and return the response as a tree.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### debugLevel

    protected int debugLevel

### Constructor Detail

#### QueryInformationModel

    public QueryInformationModel(java.lang.String hostname,
                         int port,
                         java.lang.String calledAETitle,
                         java.lang.String callingAETitle,
                         int debugLevel)

Construct a query information model.

Does not actually open an association or perform a query or retrieval; for that see:

- `performHierarchicalQuery()`
- `performHierarchicalMove()`
- `performHierarchicalMoveFrom()`
- `performHierarchicalMoveTo()`
- `performHierarchicalMoveFromTo()`

Parameters:
  `hostname` - their hostname or IP address
  `port` - their port number
  `calledAETitle` - their AE title
  `callingAETitle` - our AE title (both when we query or retrieve and where we are listening as a storage SCP)
  `debugLevel` - 0 is no debugging (silent), > 0 more verbose levels of debugging

### Method Detail

#### getCalledAETitle

    public final java.lang.String getCalledAETitle()

#### getRoot

    protected abstract InformationEntity getRoot()

#### getChildTypeForParent

    protected abstract InformationEntity getChildTypeForParent(InformationEntity ie)

Parameters:
  `ie` -

#### getAllInformationEntitiesToIncludeAtThisQueryLevel

    protected abstract java.util.HashSet getAllInformationEntitiesToIncludeAtThisQueryLevel(InformationEntity ie)

Parameters:
  `ie` -

#### getFindSOPClassUID

    protected abstract java.lang.String getFindSOPClassUID()

#### getMoveSOPClassUID

    protected abstract java.lang.String getMoveSOPClassUID()

#### getStringValueForTreeFromResponseIdentifier

    protected abstract java.lang.String getStringValueForTreeFromResponseIdentifier(InformationEntity ie,
                                                               AttributeList responseIdentifier)

Parameters:
  `ie` -
  `responseIdentifier` -

#### getQueryLevelName

    public java.lang.String getQueryLevelName(InformationEntity ie)

Parameters:
  `ie` -

#### getUniqueKeyForInformationEntity

    public AttributeTag getUniqueKeyForInformationEntity(InformationEntity ie)

Parameters:
  `ie` -

#### getAttributeTagOfCountOfChildren

    protected AttributeTag getAttributeTagOfCountOfChildren(InformationEntity ie)

Parameters:
  `ie` -

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### performHierarchicalQuery

    public QueryTreeModel performHierarchicalQuery(AttributeList filter)
                                            throws java.io.IOException,
                                                   DicomException,
                                                   DicomNetworkException

Perform a hierarchical query and return the response as a tree.

Performs a query recursively from the requested level of the information model down to the lowest level of the query model, using the matching keys present in the supplied identifier (filter) (if any), requesting the return keys listed in the request identifier.

It starts out at the highest level of the model, and for each response returned at that level, uses each unique key returned at that level of the response to perform another query at the next level down, and so on, recursively.

The actual queries at lower levels may be deferred and not performed until the tree is actually expanded whilst browsing, to avoid delays in making the top level nodes available.

If the filter contains the attributes to count the number of subsidiary entities (e.g., NumberOfStudyRelatedSeries), then an immediate subsidiary query to determine the presence and number of a node's children will be avoided, or at least deferred until that node is expanded when browsing.

Parameters:
  `filter` - the query request identifier as a list of DICOM attributes
Returns:
  the results of query as a tree suitable for browing
Throws:
  `java.io.IOException` - thrown if there is an generic IO problem
  `DicomException` - thrown if there is a problem performing or parsing the query
  `DicomNetworkException` - thrown if there is a problem with the DICOM network protocol

#### performHierarchicalMove

    public void performHierarchicalMove(AttributeList identifier)
                                 throws java.io.IOException,
                                        DicomException,
                                        DicomNetworkException

Retrieve DICOM object(s).

Assumes that the objects are available at the`calledAETitle` specified in the constructor in this class instance.

Assumes that we have a storage SCP listening as the `callingAETitle` specified in the constructor in this class instance.

Parameters:
  `identifier` - the move request identifier as a list of DICOM attributes
Throws:
  `java.io.IOException` - thrown if there is an generic IO problem
  `DicomException` - thrown if there is a problem performing or parsing the query
  `DicomNetworkException` - thrown if there is a problem with the DICOM network protocol

#### performHierarchicalMove

    public void performHierarchicalMove(AttributeList identifier,
                               java.lang.String retrieveAE)
                                 throws java.io.IOException,
                                        DicomException,
                                        DicomNetworkException

Deprecated. See `performHierarchicalMoveFrom()`.

Throws:
  `java.io.IOException`
  `DicomException`
  `DicomNetworkException`

#### performHierarchicalMoveFrom

    public void performHierarchicalMoveFrom(AttributeList identifier,
                                   java.lang.String retrieveAE)
                                     throws java.io.IOException,
                                            DicomException,
                                            DicomNetworkException

Retrieve DICOM object(s) from the specified location.

Assumes that we have a storage SCP listening as the `callingAETitle` specified in the constructor in this class instance.

Note that the `retrieveAE` argument may differ from the `calledAETitle` used in the constructor of this class instance.

Parameters:
  `identifier` - the move request identifier as a list of DICOM attributes
  `retrieveAE` - the AE title of where to move the object(s) from
Throws:
  `java.io.IOException` - thrown if there is an generic IO problem
  `DicomException` - thrown if there is a problem performing or parsing the query
  `DicomNetworkException` - thrown if there is a problem with the DICOM network protocol

#### performHierarchicalMoveTo

    public void performHierarchicalMoveTo(AttributeList identifier,
                                 java.lang.String moveDestination)
                                   throws java.io.IOException,
                                          DicomException,
                                          DicomNetworkException

Retrieve DICOM object(s) to the specified location.

Assumes that the objects are available at the `calledAETitle` specified in the constructor in this class instance.

Further assumes that `calledAETitle` knows how to resolve the `moveDestination` into a presentation address (hostname and port number).

Parameters:
  `identifier` - the move request identifier as a list of DICOM attributes
  `moveDestination` - the AE title of where to move the object(s) to
Throws:
  `java.io.IOException` - thrown if there is an generic IO problem
  `DicomException` - thrown if there is a problem performing or parsing the query
  `DicomNetworkException` - thrown if there is a problem with the DICOM network protocol

#### performHierarchicalMoveFromTo

    public void performHierarchicalMoveFromTo(AttributeList identifier,
                                     java.lang.String retrieveAE,
                                     java.lang.String moveDestination)
                                       throws java.io.IOException,
                                              DicomException,
                                              DicomNetworkException

Retrieve DICOM object(s) from the specified location to the specified location.

Parameters:
  `identifier` - the move request identifier as a list of DICOM attributes
  `retrieveAE` - the AE title of where to move the object(s) from
  `moveDestination` - the AE title of where to move the object(s) to
Throws:
  `java.io.IOException` - thrown if there is an generic IO problem
  `DicomException` - thrown if there is a problem performing or parsing the query
  `DicomNetworkException` - thrown if there is a problem with the DICOM network protocol