de.uplanet.lucy.server.auxiliaries
Class Gallery

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

@VelocityCallable(value="singleton")
public final class Gallery
extends java.lang.Object

Gallery.java Load an image, scale it down and save it as a JPEG file.

Version:
$Revision: 64100 $

Constructor Summary
Gallery()
           
 
Method Summary
 java.lang.String buildGallery(java.lang.String p_strType, java.lang.String p_strUploadTyp, java.lang.String p_strGalleryDG, java.lang.String p_strImgDG, java.lang.String p_strFilename, java.lang.String p_strSrcPath, java.lang.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)
 java.lang.String copyUploadImage(java.lang.String p_strImgDG, java.lang.String p_strFilename, java.lang.String p_strFileSrc, java.lang.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(java.lang.String p_strFolderName)
          Deletes the gallery specific directory and all images included
 void delFileDB(int p_iFileLid, java.lang.String p_strFileDG)
          Method to delete a record from the datagroup where uploaded files are stored
 boolean delImages(java.lang.String p_strImgDG, java.lang.String p_strGalleryName, int p_iGalId, java.lang.String p_strDelImgs)
          Method to delete images, received from a vm, all checked images in the listview.
 java.lang.String extractArchive(java.lang.String p_strImgDG, java.io.File p_fiArchive, java.io.File p_fiDestDir, 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
 java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.lang.String>> getFileList(java.lang.String p_strGalleryDG, java.lang.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(java.lang.String p_strImgDG, java.lang.String p_strGalleryName, int p_iImgId, java.lang.String p_strDirection)
          Method to rotate an image, calls more methods
 boolean rotateImages(java.lang.String p_strImgDG, int p_iGalleryId, int p_iAngle, java.lang.String p_strGalleryName, java.lang.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, java.lang.String p_strImagePath, float p_fComp)
          Method to rotate single image, original,preview,thumg,detail, calls other method
 void scaleGallery(java.lang.String p_strNewImages, java.lang.String p_strFolderName, java.lang.String p_strGalleryDG, java.lang.String p_strImageDG, int p_iGalleryId)
          Method to scale all images in a gallery
 void updFileDB(int p_iGalLid, java.lang.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 Detail

Gallery

public Gallery()
Method Detail

extractArchive

public java.lang.String extractArchive(java.lang.String p_strImgDG,
                                       java.io.File p_fiArchive,
                                       java.io.File p_fiDestDir,
                                       int p_iGalLid)
                                throws java.sql.SQLException,
                                       java.io.IOException
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_fiArchive - Zip Source File
p_fiDestDir - Destination where the files in the Zip-File are copied to
p_iGalLid - LID of the gallery in the gallery table.
Throws:
java.sql.SQLException
java.io.IOException

copyUploadImage

public java.lang.String copyUploadImage(java.lang.String p_strImgDG,
                                        java.lang.String p_strFilename,
                                        java.lang.String p_strFileSrc,
                                        java.lang.String p_strDirDst,
                                        int p_iGalLid)
                                 throws java.sql.SQLException,
                                        java.io.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:
java.sql.SQLException
java.io.IOException

buildGallery

public java.lang.String buildGallery(java.lang.String p_strType,
                                     java.lang.String p_strUploadTyp,
                                     java.lang.String p_strGalleryDG,
                                     java.lang.String p_strImgDG,
                                     java.lang.String p_strFilename,
                                     java.lang.String p_strSrcPath,
                                     java.lang.String p_strGalleryName,
                                     int p_iGalLid)
                              throws java.sql.SQLException,
                                     java.io.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:
java.sql.SQLException
java.io.IOException

delDirectory

public void delDirectory(java.lang.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,
                      java.lang.String p_strFileDG)
               throws java.sql.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:
java.sql.SQLException

updFileDB

public void updFileDB(int p_iGalLid,
                      java.lang.String p_strGalleryDG)
               throws java.sql.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:
java.sql.SQLException

scaleGallery

public void scaleGallery(java.lang.String p_strNewImages,
                         java.lang.String p_strFolderName,
                         java.lang.String p_strGalleryDG,
                         java.lang.String p_strImageDG,
                         int p_iGalleryId)
                  throws java.lang.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:
java.lang.Exception

getFileList

public java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.lang.String>> getFileList(java.lang.String p_strGalleryDG,
                                                                                               java.lang.String p_strImgDG,
                                                                                               int p_iGalleryId)
                                                                                        throws java.sql.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:
de.uplanet.lucy.server.businesslogic.BlException
java.sql.SQLException

rotate

public boolean rotate(java.lang.String p_strImgDG,
                      java.lang.String p_strGalleryName,
                      int p_iImgId,
                      java.lang.String p_strDirection)
               throws java.sql.SQLException,
                      java.io.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:
java.sql.SQLException
java.io.IOException

rotateImages

public boolean rotateImages(java.lang.String p_strImgDG,
                            int p_iGalleryId,
                            int p_iAngle,
                            java.lang.String p_strGalleryName,
                            java.lang.String p_strImageName)
                     throws java.sql.SQLException,
                            java.io.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:
java.sql.SQLException
java.io.IOException

rotateImg

public boolean rotateImg(int p_iAngle,
                         java.lang.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(java.lang.String p_strImgDG,
                         java.lang.String p_strGalleryName,
                         int p_iGalId,
                         java.lang.String p_strDelImgs)
                  throws java.sql.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:
java.sql.SQLException


Last updated: 2011-01-27
Copyright 2000-2010 United Planet. All Rights Reserved.