com.arsdigita.cms.installer.xml
Class ContentItemHelper

java.lang.Object
  extended bycom.arsdigita.cms.installer.xml.ContentItemHelper
Direct Known Subclasses:
ContentBundleHelper

public class ContentItemHelper
extends Object

Helper class for processing XML input. Used to create, retrieve, and clone ContentItems based on xml input.

Author:
Nobuko Asakai (nasakai@redhat.com)
See Also:
XMLContentItemHandler, ContentItemLoader

Field Summary
protected  ContentItem m_item
           
protected  String m_language
           
 
Constructor Summary
ContentItemHelper(ContentSection section)
           
 
Method Summary
 ContentItem cloneItem(int count, Folder parent)
           
protected  ContentItem cloneItem(int count, Folder parent, boolean save)
           
protected  ContentItem cloneItem(String name, Folder parent, boolean save)
           
 String cloneName(int count)
          Returns a name suitable to be used by a clone.
 ContentItem create()
           Convenience method that creates (or retrieves) the ContentItem without saving it
 ContentItem create(boolean save)
           Convenience method that creates (or retrives) the ContentItem and optionally saves it according to the value of save
 ContentItem createContentItem()
           Convenience method that creates (or retrives) the ContentItem without saving it
protected  ContentItem createContentItem(boolean save)
          Creates (or retrieves) a ContentItem of given type that can be upcasted.
protected  ContentItem createNewContentItem()
           This method is used to create a new ContentItem.
 int getCloneCount()
           
 ContentItem getContentItem()
           
protected  ContentItem getContentItemByName(String name, Folder parent)
          Look for ContentItems with the same name
 ContentSection getContentSection()
           
 String getContentType()
           
 String getName()
           
 Folder getParent()
           
protected  ContentItem newCloneItem(String name, Folder parent)
          Creates and returns a new Clone for the name and parent specified.
 void save()
           Saves the ContentItem.
 void set(String methodName, String argClass, String value)
           
 void setBodyText(String body)
           Convenience method to set the item's body text.
 void setCloneCount(int cloneCount)
          Number of times this item should be cloned
 void setContentItem(ContentItem item)
           
 void setContentSection(ContentSection section)
           
 void setContentType(String type)
           
 void setLanguage(String lang)
           
 void setName(String name)
           
 void setParent(Folder parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_item

protected ContentItem m_item

m_language

protected String m_language
Constructor Detail

ContentItemHelper

public ContentItemHelper(ContentSection section)
Method Detail

setContentSection

public void setContentSection(ContentSection section)

getContentSection

public ContentSection getContentSection()

setName

public void setName(String name)

getName

public String getName()

setContentType

public void setContentType(String type)

getContentType

public String getContentType()

setParent

public void setParent(Folder parent)

getParent

public Folder getParent()

setCloneCount

public void setCloneCount(int cloneCount)
Number of times this item should be cloned


getCloneCount

public int getCloneCount()

getContentItem

public ContentItem getContentItem()

setContentItem

public void setContentItem(ContentItem item)

setLanguage

public void setLanguage(String lang)

setBodyText

public void setBodyText(String body)

Convenience method to set the item's body text. This is a no-op, subclasses should override it.


create

public ContentItem create()

Convenience method that creates (or retrieves) the ContentItem without saving it

See Also:
createContentItem(boolean)

create

public ContentItem create(boolean save)

Convenience method that creates (or retrives) the ContentItem and optionally saves it according to the value of save

See Also:
createContentItem(boolean)

createContentItem

public ContentItem createContentItem()

Convenience method that creates (or retrives) the ContentItem without saving it

See Also:
createContentItem(boolean)

save

public void save()

Saves the ContentItem. The parent is also set at this point, as setting the parent implicitly saves the item


createContentItem

protected ContentItem createContentItem(boolean save)

Creates (or retrieves) a ContentItem of given type that can be upcasted. The new item is optionally saved if the save parameter is true.

See Also:
createNewContentItem()

createNewContentItem

protected ContentItem createNewContentItem()

This method is used to create a new ContentItem. It does not check to see if this item already exists. The new ContentItem is not saved.

See Also:
createContentItem(boolean)

set

public void set(String methodName,
                String argClass,
                String value)

getContentItemByName

protected ContentItem getContentItemByName(String name,
                                           Folder parent)
Look for ContentItems with the same name


cloneItem

public ContentItem cloneItem(int count,
                             Folder parent)

cloneItem

protected ContentItem cloneItem(int count,
                                Folder parent,
                                boolean save)

cloneItem

protected ContentItem cloneItem(String name,
                                Folder parent,
                                boolean save)

newCloneItem

protected ContentItem newCloneItem(String name,
                                   Folder parent)

Creates and returns a new Clone for the name and parent specified. It does not check to see if the Item already exits, but creates it. Subclasses should override this method if the ContentItem requires special cloning procedures


cloneName

public String cloneName(int count)

Returns a name suitable to be used by a clone. Based of the name of the ContentItem and the parameter count



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