DAOImage

com.j0h1.contour.server.dao

## Interface DAOImage

- All Known Implementing Classes:
    DAOImageImpl

      public interface DAOImage

  Defines database access methods concerning Image objects.
  Author:
    Johannes Riedmann

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.ArrayList<Image>` | `findEdgeImagesByTrackId(int trackId, java.lang.String language)` Queries for a list of edge images of a specific track and language.
    `Image` | `getDrawingByImageIdAndSessionId(int imageId, int sessionId)` Queries for the user drawing data for specific image in a specific session.
    `Image` | `getEdgeImageByImageId(int imageId)` Queries for the edge image data for a given imageId.
    `Image` | `getOriginalImageByImageId(int imageId)` Queries for the original image data for a given imageId.
    `Image` | `getScoreImageByImageIdAndSessionId(int imageId, int sessionId)` Queries for the score image data for specific image in a specific session.
    `java.util.ArrayList<Image>` | `getSessionDetails(int sessionId, java.lang.String language)` Retrieves the meta data (no image data) of all images persisted for a specific session in a given language (for the image names to be displayed in the correct language).
    `int` | `persist(java.lang.String titleEN, java.lang.String titleDE, java.lang.String originalContent, java.lang.String edgeContent)` Persists an new image to the database.

- - ### Method Detail

    - #### findEdgeImagesByTrackId

          java.util.ArrayList<Image> findEdgeImagesByTrackId(int trackId,
                                                             java.lang.String language)
                                                      throws DAOImageException

      Queries for a list of edge images of a specific track and language.
      Parameters:
        `trackId` - TrackId of the Track the edge images are assigned to.
        `language` - Language code ("en"/"de"), that defines if the image name should be returned in english ("en") or german ("de").
      Returns:
        List of edge images in a given track in a specific language. Empty List if no Images were found.
      Throws:
        `DAOImageException` - When the query fails, a DAOImageException is thrown.

    - #### getOriginalImageByImageId

          Image getOriginalImageByImageId(int imageId)
                                   throws DAOImageException

      Queries for the original image data for a given imageId.
      Parameters:
        `imageId` - ID of the image to get the original data from.
      Returns:
        Image object that contains the original image data for a given imageId. If image is not found, an empty Image object is returned.
      Throws:
        `DAOImageException` - When the query fails, a DAOImageException is thrown.

    - #### getEdgeImageByImageId

          Image getEdgeImageByImageId(int imageId)
                               throws DAOImageException

      Queries for the edge image data for a given imageId.
      Parameters:
        `imageId` - ID of the image to get the edge data from.
      Returns:
        Image object that contains the edge image data for a given imageId. If image is not found, an empty Image object is returned.
      Throws:
        `DAOImageException` - When the query fails, a DAOImageException is thrown.

    - #### getDrawingByImageIdAndSessionId

          Image getDrawingByImageIdAndSessionId(int imageId,
                                                int sessionId)
                                         throws DAOImageException

      Queries for the user drawing data for specific image in a specific session.
      Parameters:
        `imageId` - ID of the image to get the drawing data from.
        `sessionId` - Id of the session, the drawing of the image was done.
      Returns:
        Image object that contains the drawing data for a given imageId and sessionId. If image is not found, an empty Image object is returned.
      Throws:
        `DAOImageException` - When the query fails, a DAOImageException is thrown.

    - #### getScoreImageByImageIdAndSessionId

          Image getScoreImageByImageIdAndSessionId(int imageId,
                                                   int sessionId)
                                            throws DAOImageException

      Queries for the score image data for specific image in a specific session.
      Parameters:
        `imageId` - ID of the image to get the score image data from.
        `sessionId` - Id of the session, the score image of the drawing was generated.
      Returns:
        Image object that contains the score image data for a given imageId and sessionId. If image is not found, an empty Image object is returned.
      Throws:
        `DAOImageException` - When the query fails, a DAOImageException is thrown.

    - #### getSessionDetails

          java.util.ArrayList<Image> getSessionDetails(int sessionId,
                                                       java.lang.String language)
                                                throws DAOImageException

      Retrieves the meta data (no image data) of all images persisted for a specific session in a given language (for the image names to be displayed in the correct language).
      Parameters:
        `sessionId` - Id of the session to retreive details image metadata from.
        `language` - Language code ("en"/"de) to get the image names in the specified language.
      Returns:
        Meta data of a session containing the images with the achieved scores. If no image meta data is found, an empty list is returned.
      Throws:
        `DAOImageException` - When the query fails, a DAOImageException is thrown.

    - #### persist

          int persist(java.lang.String titleEN,
                      java.lang.String titleDE,
                      java.lang.String originalContent,
                      java.lang.String edgeContent)
               throws DAOImageException

      Persists an new image to the database.
      Parameters:
        `titleEN` - German name of the image.
        `titleDE` - English name of the image.
        `originalContent` - Original image data.
        `edgeContent` - Edge image data.
      Returns:
        The generated ID of the image.
      Throws:
        `DAOImageException` - When the persistence process fails, a DAOImageException is thrown.