com.arsdigita.cms.publishToFile
Class Utilities

java.lang.Object
  extended bycom.arsdigita.cms.publishToFile.Utilities

public class Utilities
extends Object

Experimental Static utility methods used in writing content and templates to the file system.

Version:
$Revision: #20 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Jeff Teeters (teeters@arsdigita.com)

Constructor Summary
Utilities()
           
 
Method Summary
static void executeCommand(String cmd)
          Excecutes System Command
static String getAssetPath(Asset asset)
          This function returns the globally unique path for the asset.
static String getAssetPath(Asset asset, Folder folder)
          Returns asset's path located in folder 'folder'.
static ContentItem getContentItem(BigDecimal itemID)
          Retrieve the content_item associated with the itemID.
static ContentItem getContentItemOrNull(BigDecimal itemID)
          Retrieve the content_item associated with the itemID.
static String getItemFullPath(ContentItem item)
          Returns full path of an item on FS
static String getItemLocation(ContentItem item)
          Get item location in the filesystem.
static Folder getLiveTarget(Folder target)
          get live version of a folder, creating one if necessary.
static boolean moveItem(Folder dstFolder, Folder srcFolder, ContentItem item)
          Moves files in File System
static void removeItems(Folder item)
          Removes item(s) from File System if 'item' is a Folder object, whole folder is removed if 'item' is a ContentBundle object, all langusge instances related with ContentBundle if 'item' is a language instance, particular file is removed
static String stripJSP(String s)
          Strip any ".jsp" extension from a string.
static void updateContentSection(ContentItem item, ContentSection newSection)
          Applies Content Section to an ContentPage, ContentBundle and Folder, if their ContentSections are different.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Method Detail

getItemLocation

public static String getItemLocation(ContentItem item)
Get item location in the filesystem.

Parameters:
item - Content item
Returns:
location on file system for item, including the path to the item, and the item name, but not any source base prefix. This assumes the location matches url generated by item resolver.

moveItem

public static boolean moveItem(Folder dstFolder,
                               Folder srcFolder,
                               ContentItem item)
Moves files in File System

Parameters:
dstFolder - The destination Folder for Item to be copied, must not be null
Returns:
true if item was successfuly moved

removeItems

public static void removeItems(Folder item)
Removes item(s) from File System if 'item' is a Folder object, whole folder is removed if 'item' is a ContentBundle object, all langusge instances related with ContentBundle if 'item' is a language instance, particular file is removed

Parameters:
item - The ContentItem, which must be removed from File System
Returns:
true is opeation finished successfuly

getItemFullPath

public static String getItemFullPath(ContentItem item)
Returns full path of an item on FS

Returns:
Full path of an items on FS

executeCommand

public static void executeCommand(String cmd)
                           throws PublishToFileException
Excecutes System Command

Throws:
PublishToFileException

getContentItem

public static ContentItem getContentItem(BigDecimal itemID)
Retrieve the content_item associated with the itemID. Throw an error if not found.

Parameters:
itemID - ID of content item.
Returns:
The corresponding content item.

getContentItemOrNull

public static ContentItem getContentItemOrNull(BigDecimal itemID)
Retrieve the content_item associated with the itemID. Return null if not found.

Parameters:
itemID - ID of content item.
Returns:
The corresponding content item.

getAssetPath

public static String getAssetPath(Asset asset)
This function returns the globally unique path for the asset.


getAssetPath

public static String getAssetPath(Asset asset,
                                  Folder folder)
Returns asset's path located in folder 'folder'.


stripJSP

public static String stripJSP(String s)
Strip any ".jsp" extension from a string.

Parameters:
s - input string.
Returns:
the string with any '.jsp' extension removed.

getLiveTarget

public static Folder getLiveTarget(Folder target)
get live version of a folder, creating one if necessary.

Parameters:
target - folder to get live version for.
Returns:
live version of target folder.

updateContentSection

public static void updateContentSection(ContentItem item,
                                        ContentSection newSection)
Applies Content Section to an ContentPage, ContentBundle and Folder, if their ContentSections are different. The process will continue till new ContentSection will not be met.

Parameters:
item - - ContentItem
newSection - - new ContentSection


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC