com.pixelmed.query

## Interface QueryResponseGenerator

-     public interface QueryResponseGenerator

  This interface abstracts the communication between a query (C-FIND) server that implements the network service, and the source of information with which to respond to the query.

  Typically, the server, which has been supplied a factory to generate instances of a class that implements this interface, calls the methods with the following pattern:

              ... receive C-FIND request from the network into AttributeList identifier ...
              QueryResponseGenerator queryResponseGenerator = queryResponseGeneratorFactory.newInstance();
              queryResponseGenerator.performQuery(affectedSOPClassUID,identifier,false);
              AttributeList responseIdentifierList;
              while ((responseIdentifierList = queryResponseGenerator.next()) != null) {
                      ... send response in responseIdentifierList over the network ...
              }
              queryResponseGenerator.close();

  See Also:
    `QueryResponseGeneratorFactory`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `allOptionalKeysSuppliedWereSupported()` Determine information needed to qualify pending response statuses.
    `void` | `close()` Clean up after the query has completed.
    `java.lang.String` | `getErrorComment()` Get any error comment in the case of an error status.
    `AttributeTagAttribute` | `getOffendingElement()` Get the offending element in the case of an error status.
    `int` | `getStatus()` Get a status suitable for the C-FIND response.
    `AttributeList` | `next()` Get the next query response.
    `void` | `performQuery(java.lang.String querySOPClassUID, AttributeList queryIdentifier, boolean relational)` Perform the query whose results will be returned by the next() method.

- - ### Method Detail

    - #### performQuery

          void performQuery(java.lang.String querySOPClassUID,
                            AttributeList queryIdentifier,
                            boolean relational)

      Perform the query whose results will be returned by the next() method.

      Whether or not the query is actually performed during this call, or the parameters cached and perform on the first next() call, or indeed next() represents a dynamic query, is unspecified and up to the implementor of the interface.

      Parameters:
        `querySOPClassUID` - defines the information model to use (e.g., study root, patient root)
        `queryIdentifier` - the query itself, as received in the C-FIND dataset
        `relational` - whether or not to perform relational queries (as determined by extended negotiation)

    - #### next

          AttributeList next()

      Get the next query response.

      Returns:
        the next query response as a list of DICOM attributes suitable for a C-FIND response dataset

    - #### getStatus

          int getStatus()

      Get a status suitable for the C-FIND response.

      Returns:
        the retrieve status

    - #### getOffendingElement

          AttributeTagAttribute getOffendingElement()

      Get the offending element in the case of an error status.

      Returns:
        the offending element

    - #### getErrorComment

          java.lang.String getErrorComment()

      Get any error comment in the case of an error status.

      Returns:
        the error comment, or null if none

    - #### close

          void close()

      Clean up after the query has completed.

      Typically, will discarded cached information, close any database connections, etc.

    - #### allOptionalKeysSuppliedWereSupported

          boolean allOptionalKeysSuppliedWereSupported()

      Determine information needed to qualify pending response statuses.

      Returns:
        false if any of the keys in the queryIdentifier were not supported as matching or return keys by the model