Class Gallery
java.lang.Object
de.uplanet.lucy.server.auxiliaries.Gallery
Gallery.java Load an image, scale it down and save it as a JPEG file.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbuildGallery(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 ImageDGvoiddelDirectory(String p_strFolderName) Deletes the gallery specific directory and all images includedvoidMethod to delete a record from the datagroup where uploaded files are storedbooleanMethod 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 afterwardsgetFileList(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 imagesbooleanMethod to rotate an image, calls more methodsbooleanrotateImages(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 downbooleanMethod to rotate single image, original,preview,thumg,detail, calls other methodvoidscaleGallery(String p_strNewImages, String p_strFolderName, String p_strGalleryDG, String p_strImageDG, int p_iGalleryId) Method to scale all images in a galleryvoidMethod 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
- 
Constructor Details- 
Gallerypublic Gallery()
 
- 
- 
Method Details- 
extractArchiveMethod 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.
 
- 
copyUploadImagepublic 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
 
- 
buildGallerypublic 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
 
- 
delDirectoryDeletes the gallery specific directory and all images included- Parameters:
- p_strFolderName- The name of the directory to delete
 
- 
delFileDBMethod 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
 
- 
updFileDBMethod 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
 
- 
scaleGallerypublic 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
 
- 
getFileListpublic 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
 
- 
rotatepublic 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
 
- 
rotateImagespublic 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
 
- 
rotateImgMethod 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.
 
- 
delImagespublic 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
 
 
-