com.arsdigita.cms
Class TextAsset

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.versioning.VersionedACSObject
                  extended bycom.arsdigita.cms.ContentItem
                      extended bycom.arsdigita.cms.Asset
                          extended bycom.arsdigita.cms.TextAsset
All Implemented Interfaces:
com.arsdigita.auditing.Audited, CustomCopy
Direct Known Subclasses:
Template

public class TextAsset
extends Asset

A Text object.

Version:
$Revision: #13 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Jack Chung (flattop@arsdigita.com)

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static String CONTENT
           
static String versionId
           
 
Fields inherited from class com.arsdigita.cms.Asset
DESCRIPTION, MIME_TYPE, NAME
 
Fields inherited from class com.arsdigita.cms.ContentItem
ANCESTORS, AUDITING, CHILDREN, CONTENT_SECTION, CONTENT_TYPE, DRAFT, DRAFT_VERSION, LANGUAGE, LIVE, PARENT, PENDING, VERSION, VERSIONS
 
Fields inherited from class com.arsdigita.versioning.VersionedACSObject
IS_DELETED, MASTER
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
TextAsset()
          Default constructor.
TextAsset(BigDecimal id)
          Constructor.
TextAsset(com.arsdigita.persistence.DataObject obj)
           
TextAsset(com.arsdigita.persistence.OID oid)
          Constructor.
TextAsset(String type)
           
 
Method Summary
 String getBaseDataObjectType()
           
 String getText()
          Get the text content
 long readText(Reader reader)
          Reads a stream of character data into the content object.
 boolean recordChanges()
          Overrides default behavior in VersionedACSObject so that changes are recorded even if the object is new
 void setText(String text)
          Set the text content
 long writeText(Writer writer)
          Writes character data from the content object to the specified character output stream.
 void writeToFile(File file)
          Write the image asset content to a file.
 
Methods inherited from class com.arsdigita.cms.Asset
getDescription, getMimeType, setDescription, setMimeType
 
Methods inherited from class com.arsdigita.cms.ContentItem
addCategory, addPendingVersion, afterSave, assertDraft, assertLive, assertMaster, assertPending, beforeDelete, beforeSave, canPublishToFS, copy, copy, copyProperty, copyProperty, copyServices, copyServicesFrom, createLiveVersion, createPendingVersion, get, getCategories, getCategoryCollection, getChildren, getContentSection, getContentType, getCreationDate, getCreationIP, getCreationUser, getDisplayName, getDraftVersion, getLanguage, getLastModifiedDate, getLastModifiedIP, getLastModifiedUser, getLifecycle, getLiveVersion, getLocale, getName, getParent, getPath, getPathInfo, getPathInfo, getPathNoJsp, getPendingVersions, getPublicVersion, getVersion, getWorkingVersion, initialize, isDraftVersion, isLive, isLiveVersion, isPendingVersion, isPublished, makeCopy, promotePendingVersion, publish, publishToFS, removeCategory, removeLifecycle, removePendingVersion, set, setContentSection, setContentType, setDefaultCategory, setLanguage, setLifecycle, setLive, setLiveVersion, setName, setParent, setVersion, setVersionRecursively, unpublish, unpublishFromFS
 
Methods inherited from class com.arsdigita.versioning.VersionedACSObject
applyTag, applyUniqueTag, autoPropagateMaster, getMaster, getRolledBackTo, getTransactions, getTransactions, isMaster, isRolledBack, isSubtype, permanentlyDelete, propagateMaster, recordAttributeChange, rollBackTo, rollBackTo, rollForward, save, setMaster, trackChanges
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, checkPrivilege, doCreateCheck, doWriteCheck, getContainer, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, isContainerModified, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, clear, delete, disconnect, equals, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
See Also:
Constant Field Values

CONTENT

public static final String CONTENT
See Also:
Constant Field Values
Constructor Detail

TextAsset

public TextAsset()
Default constructor. This creates a new text asset.


TextAsset

public TextAsset(com.arsdigita.persistence.OID oid)
          throws com.arsdigita.domain.DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by oid.

Parameters:
oid - The OID for the retrieved DataObject.

TextAsset

public TextAsset(BigDecimal id)
          throws com.arsdigita.domain.DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by id and TextAsset.BASE_DATA_OBJECT_TYPE.

Parameters:
id - The id for the retrieved DataObject.

TextAsset

public TextAsset(com.arsdigita.persistence.DataObject obj)

TextAsset

public TextAsset(String type)
Method Detail

getBaseDataObjectType

public String getBaseDataObjectType()
Overrides:
getBaseDataObjectType in class Asset
Returns:
the base PDL object type for this item. Child classes should override this method to return the correct value

readText

public long readText(Reader reader)
              throws IOException
Reads a stream of character data into the content object. Character data is always written to the object as UTF-8.

Parameters:
reader - A character input stream
Returns:
the number of bytes read
Throws:
IOException

writeText

public long writeText(Writer writer)
               throws IOException
Writes character data from the content object to the specified character output stream.

Parameters:
writer - The character output stream
Returns:
the number of bytes written
Throws:
IOException

writeToFile

public void writeToFile(File file)
                 throws IOException
Write the image asset content to a file.

Specified by:
writeToFile in class Asset
Parameters:
file - The file on the server to write to.
Throws:
IOException

getText

public String getText()
Get the text content


setText

public void setText(String text)
Set the text content

Parameters:
text - String to write in CLOB

recordChanges

public boolean recordChanges()
Overrides default behavior in VersionedACSObject so that changes are recorded even if the object is new

Returns:
true if the modifications to the current object should be recorded; false otherwise


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