org.infoglue.cms.controllers.kernel.impl.simple
Class DigitalAssetController

java.lang.Object
  extended by org.infoglue.cms.controllers.kernel.impl.simple.BaseController
      extended by org.infoglue.cms.controllers.kernel.impl.simple.DigitalAssetController
Direct Known Subclasses:
PortletAssetController

public class DigitalAssetController
extends BaseController

Author:
Mattias Bogeblad

Constructor Summary
DigitalAssetController()
           
 
Method Summary
 java.lang.String archiveDigitalAssets(java.lang.String[] digitalAssetIdStrings, java.lang.StringBuffer archiveFileSize)
          This method archives selected assets and puts them into a zip-file which is returned as a url.
protected  void copyInputStream(java.io.InputStream in, java.io.OutputStream out)
          Just copies the files...
 DigitalAsset create(org.exolab.castor.jdo.Database db, DigitalAssetVO digitalAssetVO, java.io.InputStream is)
          This method creates a new digital asset in the database.
static DigitalAssetVO create(DigitalAssetVO digitalAssetVO, java.io.InputStream is, ContentVersion contentVersion, org.exolab.castor.jdo.Database db)
          This method creates a new digital asset in the database and connects it to the contentVersion it belongs to.
static DigitalAssetVO create(DigitalAssetVO digitalAssetVO, java.io.InputStream is, java.lang.Integer contentVersionId)
          This method creates a new digital asset in the database and connects it to the contentVersion it belongs to.
static DigitalAssetVO create(DigitalAssetVO digitalAssetVO, java.io.InputStream is, java.lang.String entity, java.lang.Integer entityId)
          This method creates a new digital asset in the database and connects it to the contentVersion it belongs to.
 DigitalAssetVO createByCopy(java.lang.Integer originalContentVersionId, java.lang.String oldAssetKey, java.lang.Integer newContentVersionId, java.lang.String newAssetKey, org.exolab.castor.jdo.Database db)
          This method creates a new digital asset in the database and connects it to the contentVersion it belongs to.
static void delete(java.lang.Integer digitalAssetId)
          This method deletes a digital asset in the database.
 void delete(java.lang.Integer digitalAssetId, org.exolab.castor.jdo.Database db)
          This method deletes a digital asset in the database.
 void delete(java.lang.Integer digitalAssetId, java.lang.String entity, java.lang.Integer entityId)
          This method deletes a digital asset in the database.
static void deleteCachedDigitalAssets(java.lang.Integer digitalAssetId)
          This method removes all images in the digitalAsset directory which belongs to a certain digital asset.
static void dumpDigitalAsset(DigitalAsset digitalAsset, java.lang.String fileName, java.lang.String filePath)
          This method checks if the given file exists on disk.
 java.io.InputStream getAssetInputStream(DigitalAsset digitalAsset)
          This is a method that stores the asset on disk if not there allready and returns the asset as an InputStream from that location.
static DigitalAssetController getController()
           
 DigitalAsset getDigitalAsset(java.lang.Integer contentVersionId, java.lang.String assetKey, org.exolab.castor.jdo.Database db)
          This method gets a asset with a special key inside the given transaction.
static java.lang.String getDigitalAssetFilePath(java.lang.Integer digitalAssetId)
          This method should return a String containing the URL for this digital asset.
static java.lang.String getDigitalAssetThumbnailUrl(java.lang.Integer digitalAssetId)
          This method should return a String containing the URL for this digital assets icon/thumbnail.
static java.lang.String getDigitalAssetThumbnailUrl(java.lang.Integer contentId, java.lang.Integer languageId)
          This method should return a String containing the URL for this digital assets icon/thumbnail.
 java.lang.String getDigitalAssetUrl(DigitalAssetVO digitalAssetVO, org.exolab.castor.jdo.Database db)
          This method should return a String containing the URL for this digital asset.
static java.lang.String getDigitalAssetUrl(java.lang.Integer digitalAssetId)
          This method should return a String containing the URL for this digital asset.
static java.lang.String getDigitalAssetUrl(java.lang.Integer contentId, java.lang.Integer languageId)
          This method should return a String containing the URL for this digital asset.
static java.lang.String getDigitalAssetUrl(java.lang.Integer contentId, java.lang.Integer languageId, java.lang.String assetKey, boolean useLanguageFallback)
          This method should return a String containing the URL for this digital asset.
static java.lang.String getDigitalAssetUrl(java.lang.Integer contentId, java.lang.Integer languageId, java.lang.String assetKey, boolean useLanguageFallback, org.exolab.castor.jdo.Database db)
          This method should return a String containing the URL for this digital asset.
static DigitalAsset getDigitalAssetWithId(java.lang.Integer digitalAssetId, org.exolab.castor.jdo.Database db)
          returns a digitalasset
static DigitalAssetVO getDigitalAssetVO(java.lang.Integer contentId, java.lang.Integer languageId, java.lang.String assetKey, boolean useLanguageFallback)
          This method should return a String containing the URL for this digital asset.
static DigitalAssetVO getDigitalAssetVO(java.lang.Integer contentId, java.lang.Integer languageId, java.lang.String assetKey, boolean useLanguageFallback, org.exolab.castor.jdo.Database db)
          This method should return a DigitalAssetVO
static java.util.List getDigitalAssetVOList(java.lang.Integer contentVersionId)
          This method should return a list of those digital assets the contentVersion has.
static java.util.List getDigitalAssetVOList(java.lang.Integer contentId, java.lang.Integer languageId, boolean useLanguageFallback)
          This method should return a String containing the URL for this digital asset.
static java.util.List getDigitalAssetVOList(java.lang.Integer contentId, java.lang.Integer languageId, boolean useLanguageFallback, org.exolab.castor.jdo.Database db)
          This method should return a String containing the URL for this digital asset.
static DigitalAssetVO getDigitalAssetVOWithId(java.lang.Integer digitalAssetId)
          returns the digital asset VO
 BaseEntityVO getNewVO()
          This is a method that gives the user back an newly initialized ValueObject for this entity that the controller is handling.
 void restoreAssetArchive(java.io.File archiveFile)
          This method restores digital assets from a zip into the database again.
protected  void unzipFile(java.io.File file, java.lang.String targetFolder)
          This method unzips the cms war-file.
static DigitalAssetVO update(DigitalAssetVO digitalAssetVO, java.io.InputStream is)
          This method updates a digital asset in the database.
 
Methods inherited from class org.infoglue.cms.controllers.kernel.impl.simple.BaseController
beginTransaction, beginTransaction, closeDatabase, commitTransaction, createEntity, createEntity, createQuery, deleteEntity, deleteEntity, deleteEntity, deleteEntity, executeQuery, executeQuery, executeQuery, executeQuery, getAllObjects, getAllVOObjects, getAllVOObjects, getAllVOObjects, getAllVOObjects, getObjectWithId, getObjectWithId, getObjectWithIdAsReadOnly, getVOWithId, getVOWithId, getVOWithId, getVOWithId, intercept, intercept, rollbackTransaction, toModifiableVOList, toVOList, updateEntity, updateEntity, updateEntity, updateEntity, validateEntity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigitalAssetController

public DigitalAssetController()
Method Detail

getController

public static DigitalAssetController getController()

getDigitalAssetVOWithId

public static DigitalAssetVO getDigitalAssetVOWithId(java.lang.Integer digitalAssetId)
                                              throws SystemException,
                                                     Bug
returns the digital asset VO

Throws:
SystemException
Bug

getDigitalAssetWithId

public static DigitalAsset getDigitalAssetWithId(java.lang.Integer digitalAssetId,
                                                 org.exolab.castor.jdo.Database db)
                                          throws SystemException,
                                                 Bug
returns a digitalasset

Throws:
SystemException
Bug

create

public static DigitalAssetVO create(DigitalAssetVO digitalAssetVO,
                                    java.io.InputStream is,
                                    java.lang.Integer contentVersionId)
                             throws SystemException
This method creates a new digital asset in the database and connects it to the contentVersion it belongs to. The asset is send in as an InputStream which castor inserts automatically.

Throws:
SystemException

create

public static DigitalAssetVO create(DigitalAssetVO digitalAssetVO,
                                    java.io.InputStream is,
                                    ContentVersion contentVersion,
                                    org.exolab.castor.jdo.Database db)
                             throws SystemException,
                                    java.lang.Exception
This method creates a new digital asset in the database and connects it to the contentVersion it belongs to. The asset is send in as an InputStream which castor inserts automatically.

Throws:
SystemException
java.lang.Exception

create

public static DigitalAssetVO create(DigitalAssetVO digitalAssetVO,
                                    java.io.InputStream is,
                                    java.lang.String entity,
                                    java.lang.Integer entityId)
                             throws ConstraintException,
                                    SystemException
This method creates a new digital asset in the database and connects it to the contentVersion it belongs to. The asset is send in as an InputStream which castor inserts automatically.

Throws:
ConstraintException
SystemException

create

public DigitalAsset create(org.exolab.castor.jdo.Database db,
                           DigitalAssetVO digitalAssetVO,
                           java.io.InputStream is)
                    throws SystemException,
                           java.lang.Exception
This method creates a new digital asset in the database. The asset is send in as an InputStream which castor inserts automatically.

Throws:
SystemException
java.lang.Exception

createByCopy

public DigitalAssetVO createByCopy(java.lang.Integer originalContentVersionId,
                                   java.lang.String oldAssetKey,
                                   java.lang.Integer newContentVersionId,
                                   java.lang.String newAssetKey,
                                   org.exolab.castor.jdo.Database db)
                            throws ConstraintException,
                                   SystemException
This method creates a new digital asset in the database and connects it to the contentVersion it belongs to. The asset is send in as an InputStream which castor inserts automatically.

Throws:
ConstraintException
SystemException

getDigitalAsset

public DigitalAsset getDigitalAsset(java.lang.Integer contentVersionId,
                                    java.lang.String assetKey,
                                    org.exolab.castor.jdo.Database db)
                             throws SystemException
This method gets a asset with a special key inside the given transaction.

Throws:
SystemException

delete

public static void delete(java.lang.Integer digitalAssetId)
                   throws ConstraintException,
                          SystemException
This method deletes a digital asset in the database.

Throws:
ConstraintException
SystemException

delete

public void delete(java.lang.Integer digitalAssetId,
                   org.exolab.castor.jdo.Database db)
            throws ConstraintException,
                   SystemException
This method deletes a digital asset in the database.

Throws:
ConstraintException
SystemException

delete

public void delete(java.lang.Integer digitalAssetId,
                   java.lang.String entity,
                   java.lang.Integer entityId)
            throws ConstraintException,
                   SystemException
This method deletes a digital asset in the database.

Throws:
ConstraintException
SystemException

deleteCachedDigitalAssets

public static void deleteCachedDigitalAssets(java.lang.Integer digitalAssetId)
                                      throws SystemException,
                                             java.lang.Exception
This method removes all images in the digitalAsset directory which belongs to a certain digital asset.

Throws:
SystemException
java.lang.Exception

update

public static DigitalAssetVO update(DigitalAssetVO digitalAssetVO,
                                    java.io.InputStream is)
                             throws ConstraintException,
                                    SystemException
This method updates a digital asset in the database.

Throws:
ConstraintException
SystemException

getDigitalAssetVOList

public static java.util.List getDigitalAssetVOList(java.lang.Integer contentVersionId)
                                            throws SystemException,
                                                   Bug
This method should return a list of those digital assets the contentVersion has.

Throws:
SystemException
Bug

getDigitalAssetVOList

public static java.util.List getDigitalAssetVOList(java.lang.Integer contentId,
                                                   java.lang.Integer languageId,
                                                   boolean useLanguageFallback)
                                            throws SystemException,
                                                   Bug
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug

getDigitalAssetVOList

public static java.util.List getDigitalAssetVOList(java.lang.Integer contentId,
                                                   java.lang.Integer languageId,
                                                   boolean useLanguageFallback,
                                                   org.exolab.castor.jdo.Database db)
                                            throws SystemException,
                                                   Bug,
                                                   java.lang.Exception
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug
java.lang.Exception

getDigitalAssetUrl

public static java.lang.String getDigitalAssetUrl(java.lang.Integer digitalAssetId)
                                           throws SystemException,
                                                  Bug
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug

getDigitalAssetFilePath

public static java.lang.String getDigitalAssetFilePath(java.lang.Integer digitalAssetId)
                                                throws SystemException,
                                                       Bug
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug

getAssetInputStream

public java.io.InputStream getAssetInputStream(DigitalAsset digitalAsset)
                                        throws java.lang.Exception
This is a method that stores the asset on disk if not there allready and returns the asset as an InputStream from that location. To avoid trouble with in memory blobs.

Throws:
java.lang.Exception

getDigitalAssetUrl

public java.lang.String getDigitalAssetUrl(DigitalAssetVO digitalAssetVO,
                                           org.exolab.castor.jdo.Database db)
                                    throws SystemException,
                                           Bug,
                                           java.lang.Exception
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug
java.lang.Exception

getDigitalAssetThumbnailUrl

public static java.lang.String getDigitalAssetThumbnailUrl(java.lang.Integer digitalAssetId)
                                                    throws SystemException,
                                                           Bug
This method should return a String containing the URL for this digital assets icon/thumbnail. In the case of an image the downscaled image is returned - otherwise an icon that represents the content-type of the file. It always fetches the latest one if several assets exists.

Throws:
SystemException
Bug

getDigitalAssetUrl

public static java.lang.String getDigitalAssetUrl(java.lang.Integer contentId,
                                                  java.lang.Integer languageId)
                                           throws SystemException,
                                                  Bug
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug

getDigitalAssetUrl

public static java.lang.String getDigitalAssetUrl(java.lang.Integer contentId,
                                                  java.lang.Integer languageId,
                                                  java.lang.String assetKey,
                                                  boolean useLanguageFallback)
                                           throws SystemException,
                                                  Bug
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug

getDigitalAssetUrl

public static java.lang.String getDigitalAssetUrl(java.lang.Integer contentId,
                                                  java.lang.Integer languageId,
                                                  java.lang.String assetKey,
                                                  boolean useLanguageFallback,
                                                  org.exolab.castor.jdo.Database db)
                                           throws SystemException,
                                                  Bug,
                                                  java.lang.Exception
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug
java.lang.Exception

getDigitalAssetVO

public static DigitalAssetVO getDigitalAssetVO(java.lang.Integer contentId,
                                               java.lang.Integer languageId,
                                               java.lang.String assetKey,
                                               boolean useLanguageFallback)
                                        throws SystemException,
                                               Bug
This method should return a String containing the URL for this digital asset.

Throws:
SystemException
Bug

getDigitalAssetVO

public static DigitalAssetVO getDigitalAssetVO(java.lang.Integer contentId,
                                               java.lang.Integer languageId,
                                               java.lang.String assetKey,
                                               boolean useLanguageFallback,
                                               org.exolab.castor.jdo.Database db)
                                        throws SystemException,
                                               Bug,
                                               java.lang.Exception
This method should return a DigitalAssetVO

Throws:
SystemException
Bug
java.lang.Exception

getDigitalAssetThumbnailUrl

public static java.lang.String getDigitalAssetThumbnailUrl(java.lang.Integer contentId,
                                                           java.lang.Integer languageId)
                                                    throws SystemException,
                                                           Bug
This method should return a String containing the URL for this digital assets icon/thumbnail. In the case of an image the downscaled image is returned - otherwise an icon that represents the content-type of the file. It always fetches the latest one if several assets exists.

Throws:
SystemException
Bug

dumpDigitalAsset

public static void dumpDigitalAsset(DigitalAsset digitalAsset,
                                    java.lang.String fileName,
                                    java.lang.String filePath)
                             throws java.lang.Exception
This method checks if the given file exists on disk. If it does it's ignored because that means that the file is allready cached on the server. If not we take out the stream from the digitalAsset-object and dumps it.

Throws:
java.lang.Exception

getNewVO

public BaseEntityVO getNewVO()
This is a method that gives the user back an newly initialized ValueObject for this entity that the controller is handling.

Specified by:
getNewVO in class BaseController

archiveDigitalAssets

public java.lang.String archiveDigitalAssets(java.lang.String[] digitalAssetIdStrings,
                                             java.lang.StringBuffer archiveFileSize)
                                      throws SystemException
This method archives selected assets and puts them into a zip-file which is returned as a url.

Parameters:
digitalAssetIdStrings -
Returns:
Throws:
SystemException

restoreAssetArchive

public void restoreAssetArchive(java.io.File archiveFile)
                         throws SystemException
This method restores digital assets from a zip into the database again.

Parameters:
archiveFile -
Throws:
SystemException

unzipFile

protected void unzipFile(java.io.File file,
                         java.lang.String targetFolder)
                  throws java.lang.Exception
This method unzips the cms war-file.

Throws:
java.lang.Exception

copyInputStream

protected void copyInputStream(java.io.InputStream in,
                               java.io.OutputStream out)
                        throws java.io.IOException
Just copies the files...

Throws:
java.io.IOException


Copyright © 2005 InfoGlue.org All Rights Reserved.