Package com.pixelmed.apps

## Class StudyReceiver

- java.lang.Object
- - com.pixelmed.apps.StudyReceiver

-     public class StudyReceiver
      extends java.lang.Object

  A class to wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.

  The class has no public methods other than the constructor and a main method that is useful as a utility.

  External (unsecure) SQL access to the database is possible if the Application.DatabaseServerName property is specified; further details are described in `com.pixelmed.database.DatabaseInformationModel`; for example:

      % java -cp lib/additional/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing --url "jdbc:hsqldb:hsql://localhost/testserverdb"

  For how to configure the necessary properties file, see:

  See Also:
    `NetworkApplicationProperties`, `DatabaseApplicationProperties`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected class` | `StudyReceiver.OurPatientStudySeriesInstanceModel` |
    `protected static class` | `StudyReceiver.OurReadTerminationStrategy` |
    `protected class` | `StudyReceiver.OurReceivedObjectHandler` |
    `protected class` | `StudyReceiver.ReceivedFileProcessor` |
    `protected class` | `StudyReceiver.WatchDatabaseAndProcessCompleteStudies` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected int` | `applicationDebugLevel` |
    `protected java.lang.String` | `buildDate` |
    `protected java.io.File` | `completedStudiesFolder` |
    `protected DatabaseInformationModel` | `databaseInformationModel` |
    `protected java.lang.String` | `defaultCompletedStudiesFolderName` |
    `protected java.lang.String` | `defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy` |
    `protected static java.lang.String` | `defaultPropertiesFileName` |
    `protected java.lang.String` | `defaultSleepTimeBetweenPassesToProcessReceivedFiles` |
    `protected java.lang.String` | `instanceHasBeenProcessedColumnName` |
    `protected java.lang.String` | `instanceLocalFileNameColumnName` |
    `protected java.lang.String` | `instanceLocalFileReferenceTypeColumnName` |
    `protected java.lang.String` | `instanceLocalPrimaryKeyColumnName` |
    `protected static int` | `intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy` |
    `protected NetworkApplicationInformationFederated` | `networkApplicationInformation` |
    `protected NetworkApplicationProperties` | `networkApplicationProperties` |
    `protected java.lang.String` | `ourCalledAETitle` |
    `protected java.util.Properties` | `properties` |
    `protected static java.lang.String` | `propertyName_ApplicationDebugLevel` |
    `protected static java.lang.String` | `propertyName_CompletedStudiesFolderName` |
    `protected static java.lang.String` | `propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy` |
    `protected static java.lang.String` | `propertyName_SleepTimeBetweenPassesToProcessReceivedFiles` |
    `protected java.io.File` | `savedImagesFolder` |
    `protected java.lang.String` | `seriesLocalPrimaryKeyColumnName` |
    `protected static int` | `sleepTimeBetweenPassesToProcessReceivedFiles` |
    `protected java.lang.String` | `sopClassUIDColumnName` |
    `protected StoredFilePathStrategy` | `storedFilePathStrategy` |
    `protected java.lang.String` | `studyHasBeenProcessedColumnName` |
    `protected java.lang.String` | `studyInstanceUIDColumnName` |
    `protected java.lang.String` | `studyMostRecentInsertionTimeColumnName` |
    `protected static AttributeList.ReadTerminationStrategy` | `terminateAfterRelationshipGroup` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StudyReceiver​(java.lang.String propertiesFileName)` | Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected java.lang.String` | `getBuildDate()` | Get the date the package was built.
    `protected java.io.File` | `getCompletedStudiesFolderNameCreatingItIfNecessary​(java.lang.String completedStudiesFolderName)` | Return the folder, creating it if necessary.
    `protected void` | `loadProperties​(java.lang.String propertiesFileName)` | Load properties.
    `static void` | `main​(java.lang.String[] arg)` | Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.
    `protected boolean` | `processStudy​(java.lang.String studyLocalPrimaryKeyValue)` |
    `protected boolean` | `processStudyIfComplete​(java.lang.String studyLocalPrimaryKeyValue)` |
    `protected void` | `updateStudyMostRecentInsertionTime​(java.lang.String studyInstanceUID, long insertionTime)` |

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

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

- - ### Field Detail

    - #### defaultPropertiesFileName

          protected static java.lang.String defaultPropertiesFileName

    - #### propertyName_CompletedStudiesFolderName

          protected static java.lang.String propertyName_CompletedStudiesFolderName

    - #### propertyName_SleepTimeBetweenPassesToProcessReceivedFiles

          protected static java.lang.String propertyName_SleepTimeBetweenPassesToProcessReceivedFiles

    - #### propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

          protected static java.lang.String propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

    - #### propertyName_ApplicationDebugLevel

          protected static java.lang.String propertyName_ApplicationDebugLevel

    - #### defaultCompletedStudiesFolderName

          protected java.lang.String defaultCompletedStudiesFolderName

    - #### defaultSleepTimeBetweenPassesToProcessReceivedFiles

          protected java.lang.String defaultSleepTimeBetweenPassesToProcessReceivedFiles

    - #### defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

          protected java.lang.String defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

    - #### sleepTimeBetweenPassesToProcessReceivedFiles

          protected static int sleepTimeBetweenPassesToProcessReceivedFiles

    - #### intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

          protected static int intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

    - #### properties

          protected java.util.Properties properties

    - #### networkApplicationProperties

          protected NetworkApplicationProperties networkApplicationProperties

    - #### networkApplicationInformation

          protected NetworkApplicationInformationFederated networkApplicationInformation

    - #### ourCalledAETitle

          protected java.lang.String ourCalledAETitle

    - #### databaseInformationModel

          protected DatabaseInformationModel databaseInformationModel

    - #### applicationDebugLevel

          protected int applicationDebugLevel

    - #### buildDate

          protected java.lang.String buildDate

    - #### completedStudiesFolder

          protected java.io.File completedStudiesFolder

    - #### savedImagesFolder

          protected java.io.File savedImagesFolder

    - #### storedFilePathStrategy

          protected StoredFilePathStrategy storedFilePathStrategy

    - #### studyHasBeenProcessedColumnName

          protected java.lang.String studyHasBeenProcessedColumnName

    - #### studyMostRecentInsertionTimeColumnName

          protected java.lang.String studyMostRecentInsertionTimeColumnName

    - #### instanceHasBeenProcessedColumnName

          protected java.lang.String instanceHasBeenProcessedColumnName

    - #### studyInstanceUIDColumnName

          protected java.lang.String studyInstanceUIDColumnName

    - #### sopClassUIDColumnName

          protected java.lang.String sopClassUIDColumnName

    - #### instanceLocalFileNameColumnName

          protected java.lang.String instanceLocalFileNameColumnName

    - #### instanceLocalFileReferenceTypeColumnName

          protected java.lang.String instanceLocalFileReferenceTypeColumnName

    - #### instanceLocalPrimaryKeyColumnName

          protected java.lang.String instanceLocalPrimaryKeyColumnName

    - #### seriesLocalPrimaryKeyColumnName

          protected java.lang.String seriesLocalPrimaryKeyColumnName

    - #### terminateAfterRelationshipGroup

          protected static final AttributeList.ReadTerminationStrategy terminateAfterRelationshipGroup

  - ### Constructor Detail

    - #### StudyReceiver

          public StudyReceiver​(java.lang.String propertiesFileName)
                        throws DicomException,
                               DicomNetworkException,
                               java.io.IOException,
                               java.lang.InterruptedException

      Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.

      Parameters:
        `propertiesFileName` -
      Throws:
        `DicomException`
        `DicomNetworkException`
        `java.io.IOException`
        `java.lang.InterruptedException`

  - ### Method Detail

    - #### getBuildDate

          protected java.lang.String getBuildDate()

      Get the date the package was built.

      Returns:
        the build date

    - #### loadProperties

          protected void loadProperties​(java.lang.String propertiesFileName)
                                 throws java.io.IOException

      Load properties.

      Throws:
        `java.io.IOException` - thrown if properties file is missing

    - #### processStudy

          protected boolean processStudy​(java.lang.String studyLocalPrimaryKeyValue)
                                  throws DicomException,
                                         java.io.IOException,
                                         java.lang.Exception

      Throws:
        `DicomException`
        `java.io.IOException`
        `java.lang.Exception`

    - #### processStudyIfComplete

          protected boolean processStudyIfComplete​(java.lang.String studyLocalPrimaryKeyValue)
                                            throws DicomException,
                                                   java.io.IOException,
                                                   java.lang.Exception

      Throws:
        `DicomException`
        `java.io.IOException`
        `java.lang.Exception`

    - #### updateStudyMostRecentInsertionTime

          protected void updateStudyMostRecentInsertionTime​(java.lang.String studyInstanceUID,
                                                            long insertionTime)
                                                     throws DicomException

      Throws:
        `DicomException`

    - #### getCompletedStudiesFolderNameCreatingItIfNecessary

          protected java.io.File getCompletedStudiesFolderNameCreatingItIfNecessary​(java.lang.String completedStudiesFolderName)
                                                                             throws java.io.IOException

      Return the folder, creating it if necessary.

      If not an absolute path, will be sought or created relative to the current user's home directory.

      Returns:
        the folder
      Throws:
        `java.io.IOException`

    - #### main

          public static void main​(java.lang.String[] arg)

      Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.

      Parameters:
        `arg` - none