Class Gallery

java.lang.Object
de.uplanet.lucy.server.auxiliaries.Gallery

@VelocityCallable("singleton") public final class Gallery extends Object
Gallery.java Load an image, scale it down and save it as a JPEG file.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    buildGallery(String p_strType, String p_strUploadTyp, String p_strGalleryDG, String p_strImgDG, String p_strFilename, String p_strSrcPath, String p_strGalleryName, int p_iGalLid)
    Method to build up a new Gallery, method calls are depending on filetype - CopyUploadImage(if img) - ExtractArchive(if zip) - DelFile(if neither zip nor img)
    copyUploadImage(String p_strImgDG, String p_strFilename, String p_strFileSrc, String p_strDirDst, int p_iGalLid)
    Method to copy an uploaded image in the right folder and insert the data in the ImageDG
    void
    delDirectory(String p_strFolderName)
    Deletes the gallery specific directory and all images included
    void
    delFileDB(int p_iFileLid, String p_strFileDG)
    Method to delete a record from the datagroup where uploaded files are stored
    boolean
    delImages(String p_strImgDG, String p_strGalleryName, int p_iGalId, String p_strDelImgs)
    Method to delete images, received from a vm, all checked images in the listview.
    extractArchive(String p_strImgDG, File p_fileArchive, File p_dirDest, int p_iGalLid)
    Method to extract a Zip-File and insert the data in the database at the same time The Zip-File is deleted afterwards
    getFileList(String p_strGalleryDG, String p_strImgDG, int p_iGalleryId)
    Method to return a map of images back to the vm, to realize the browsing through the images
    boolean
    rotate(String p_strImgDG, String p_strGalleryName, int p_iImgId, String p_strDirection)
    Method to rotate an image, calls more methods
    boolean
    rotateImages(String p_strImgDG, int p_iGalleryId, int p_iAngle, String p_strGalleryName, String p_strImageName)
    Method to rotate all images, original,preview,thumg,detail, calls other method if keeporiginal = true, then rotate original, and scale it down
    boolean
    rotateImg(int p_iAngle, String p_strImagePath, float p_fComp)
    Method to rotate single image, original,preview,thumg,detail, calls other method
    void
    scaleGallery(String p_strNewImages, String p_strFolderName, String p_strGalleryDG, String p_strImageDG, int p_iGalleryId)
    Method to scale all images in a gallery
    void
    updFileDB(int p_iGalLid, String p_strGalleryDG)
    Method to update a record from the Gallery datagroup FILE_DATEIAUSWAHL Key has to be deleted after deleting the related record in the upload file datagroup

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Gallery

      public Gallery()
  • Method Details

    • extractArchive

      public String extractArchive(String p_strImgDG, File p_fileArchive, File p_dirDest, int p_iGalLid)
      Method to extract a Zip-File and insert the data in the database at the same time The Zip-File is deleted afterwards
      Parameters:
      p_strImgDG - Tablename of image table
      p_fileArchive - Zip Source File
      p_dirDest - Destination where the files in the Zip-File are copied to
      p_iGalLid - LID of the gallery in the gallery table.
    • copyUploadImage

      public String copyUploadImage(String p_strImgDG, String p_strFilename, String p_strFileSrc, String p_strDirDst, int p_iGalLid) throws SQLException, IOException
      Method to copy an uploaded image in the right folder and insert the data in the ImageDG
      Parameters:
      p_strImgDG - Name of image table.
      p_strFilename - Name of the file.
      p_strFileSrc - Sourcepath of the file.
      p_strDirDst - Destination path of the file.
      p_iGalLid - LID of the gallery in the Gallerytable
      Throws:
      SQLException
      IOException
    • buildGallery

      public String buildGallery(String p_strType, String p_strUploadTyp, String p_strGalleryDG, String p_strImgDG, String p_strFilename, String p_strSrcPath, String p_strGalleryName, int p_iGalLid) throws SQLException, IOException
      Method to build up a new Gallery, method calls are depending on filetype - CopyUploadImage(if img) - ExtractArchive(if zip) - DelFile(if neither zip nor img)
      Parameters:
      p_strType - defines what kind of upload: new or update
      p_strUploadTyp - defines what kind of file is being uploaded: jpg or zip
      p_strGalleryDG - Datagroup for Galleries
      p_strImgDG - Datagroup for Images
      p_strFilename - Name of the File
      p_strSrcPath - Sourcepath of the File
      p_strGalleryName - Name of the Gallery
      p_iGalLid - LID of the Gallery in the Gallerytable
      Throws:
      SQLException
      IOException
    • delDirectory

      public void delDirectory(String p_strFolderName)
      Deletes the gallery specific directory and all images included
      Parameters:
      p_strFolderName - The name of the directory to delete
    • delFileDB

      public void delFileDB(int p_iFileLid, String p_strFileDG) throws SQLException
      Method to delete a record from the datagroup where uploaded files are stored
      Parameters:
      p_iFileLid - Id of the file to delete.
      p_strFileDG - Name of the file to delete.
      Throws:
      SQLException
    • updFileDB

      public void updFileDB(int p_iGalLid, String p_strGalleryDG) throws SQLException
      Method to update a record from the Gallery datagroup FILE_DATEIAUSWAHL Key has to be deleted after deleting the related record in the upload file datagroup
      Parameters:
      p_iGalLid - Id of the gallery to update
      p_strGalleryDG - Name of the gallery to update
      Throws:
      SQLException
    • scaleGallery

      public void scaleGallery(String p_strNewImages, String p_strFolderName, String p_strGalleryDG, String p_strImageDG, int p_iGalleryId) throws Exception
      Method to scale all images in a gallery
      Parameters:
      p_strNewImages - String including all id's of the images to scale
      p_strFolderName - Name of the folder of the gallery
      p_strGalleryDG - Datagroup of the galleries
      p_strImageDG - Name of the image datagroup
      p_iGalleryId - Id of the gallery
      Throws:
      Exception
    • getFileList

      public Iterator<Map.Entry<Integer,String>> getFileList(String p_strGalleryDG, String p_strImgDG, int p_iGalleryId) throws SQLException
      Method to return a map of images back to the vm, to realize the browsing through the images
      Parameters:
      p_strGalleryDG - Datagroup of the galleries
      p_strImgDG - Datagroup of the images
      p_iGalleryId - Id of the gallery
      Returns:
      A map of images.
      Throws:
      SQLException
    • rotate

      public boolean rotate(String p_strImgDG, String p_strGalleryName, int p_iImgId, String p_strDirection) throws SQLException, IOException
      Method to rotate an image, calls more methods
      Parameters:
      p_strImgDG - Datagroup of the images
      p_strGalleryName - Name of the gallery
      p_iImgId - Id of the image to rotate
      p_strDirection - Direction of the rotation: left,right, always 90degrees
      Returns:
      True, if no errors during rotation, else false.
      Throws:
      SQLException
      IOException
    • rotateImages

      public boolean rotateImages(String p_strImgDG, int p_iGalleryId, int p_iAngle, String p_strGalleryName, String p_strImageName) throws SQLException, IOException
      Method to rotate all images, original,preview,thumg,detail, calls other method if keeporiginal = true, then rotate original, and scale it down
      Parameters:
      p_strImgDG - Datagroup of the images
      p_iGalleryId - Id of the gallery
      p_iAngle - degrees to rotate: 90,-90
      p_strGalleryName - Name of the gallery
      p_strImageName - Name of the image
      Returns:
      True, if no errors during rotation.
      Throws:
      SQLException
      IOException
    • rotateImg

      public boolean rotateImg(int p_iAngle, String p_strImagePath, float p_fComp)
      Method to rotate single image, original,preview,thumg,detail, calls other method
      Parameters:
      p_iAngle - degrees to rotate: 90,-90
      p_strImagePath - Fullqualified path to the image to rotate
      p_fComp - Compression ratio
      Returns:
      True, if no errors during rotation.
    • delImages

      public boolean delImages(String p_strImgDG, String p_strGalleryName, int p_iGalId, String p_strDelImgs) throws SQLException
      Method to delete images, received from a vm, all checked images in the listview. Deletes the images from the image datagroup and calls method to delete images from filesystem
      Parameters:
      p_strImgDG - Name of the image datagroup
      p_strGalleryName - Name of the gallery
      p_iGalId - Id of the gallery
      p_strDelImgs - String containing all IDs of the images to delete
      Returns:
      True, if deletion worked withour errors.
      Throws:
      SQLException