ImageServiceImpl

com.j0h1.contour.admin.server

## Class ImageServiceImpl

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
      - - com.google.gwt.user.server.rpc.RemoteServiceServlet
        - - com.j0h1.contour.admin.server.ImageServiceImpl

- All Implemented Interfaces:
    com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, ImageService, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

      public class ImageServiceImpl
      extends com.google.gwt.user.server.rpc.RemoteServiceServlet
      implements ImageService

  RemoteServiceServlet that implements methods defined in ImageService.
  Author:
    Johannes Riedmann
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static long` | `serialVersionUID`

    - ### Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

      `perThreadRequest, perThreadResponse`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageServiceImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `delete(int imageId)` Calls DAOImage to delete an image.
    `java.util.ArrayList<Image>` | `findAll()` Returns all non-deleted images (deleted flag not set) persisted on database.
    `java.lang.String` | `generateEdgeImage(java.lang.String originalImage, java.lang.String fileEnding, int threshold)` Generates base64 encoded edge image content, based on an input image and a threshold using OpenCV.
    `void` | `persist(java.lang.String titleEN, java.lang.String titleDE, java.lang.String originalImage, java.lang.String edgeImage)` Calls DAOImage to persist an image, along with its edge image to the database.

    - ### Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet

      `checkPermutationStrongName, doGetSerializationPolicy, getSerializationPolicy, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processPost, shouldCompressResponse`

    - ### Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

      `doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent`

    - ### Methods inherited from class javax.servlet.http.HttpServlet

      `doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service`

    - ### Methods inherited from class javax.servlet.GenericServlet

      `destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log`

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

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

- - ### Field Detail

    - #### serialVersionUID

          private static final long serialVersionUID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ImageServiceImpl

          public ImageServiceImpl()

  - ### Method Detail

    - #### persist

          public void persist(java.lang.String titleEN,
                              java.lang.String titleDE,
                              java.lang.String originalImage,
                              java.lang.String edgeImage)
                       throws DAOImageException

      Description copied from interface: `ImageService`
      Calls DAOImage to persist an image, along with its edge image to the database.
      Specified by:
        `persist` in interface `ImageService`
      Parameters:
        `titleEN` - English title of image.
        `titleDE` - German title of image.
        `originalImage` - Content of the original image (pre-images-processing).
        `edgeImage` - Content of edge image.
      Throws:
        `DAOImageException` - If persistence fails to write images to database, provide specific feedback.

    - #### generateEdgeImage

          public java.lang.String generateEdgeImage(java.lang.String originalImage,
                                                    java.lang.String fileEnding,
                                                    int threshold)

      Description copied from interface: `ImageService`
      Generates base64 encoded edge image content, based on an input image and a threshold using OpenCV.
      Specified by:
        `generateEdgeImage` in interface `ImageService`
      Parameters:
        `originalImage` - Content data of original image (pre-image-processing).
        `fileEnding` - Type of image file (jpg/png) needed for OpenCV image encoding.
        `threshold` - Lower threshold used by OpenCV's edge detection algorithm.
      Returns:
        Base64 encoded content data of edge image.

    - #### findAll

          public java.util.ArrayList<Image> findAll()
                                             throws DAOImageException

      Description copied from interface: `ImageService`
      Returns all non-deleted images (deleted flag not set) persisted on database.
      Specified by:
        `findAll` in interface `ImageService`
      Returns:
        List of non-deleted Image objects
      Throws:
        `DAOImageException` - if DAOImage fails to receive information from database

    - #### delete

          public void delete(int imageId)
                      throws DAOImageException

      Description copied from interface: `ImageService`
      Calls DAOImage to delete an image.
      Specified by:
        `delete` in interface `ImageService`
      Parameters:
        `imageId` - ID of image to be deleted.
      Throws:
        `DAOImageException` - If deletion of image fails (provides specific feedback).