|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.domain.DomainObject
com.arsdigita.domain.ObservableDomainObject
com.arsdigita.kernel.ACSObject
com.arsdigita.versioning.VersionedACSObject
com.arsdigita.cms.ContentItem
com.arsdigita.cms.ContentBundle
A bundle of content items of different languages. A bundle ties the various language instances of an item together and provides methods to access them.
Field Summary | |
static String |
BASE_DATA_OBJECT_TYPE
The base data object type of a bundle |
static String |
DEFAULT_LANGUAGE
The default language property |
static String |
INSTANCES
The primary instances association |
static String |
versionId
|
Fields inherited from class com.arsdigita.cms.ContentItem |
ANCESTORS, AUDITING, CHILDREN, CONTENT_SECTION, CONTENT_TYPE, DRAFT, DRAFT_VERSION, LANGUAGE, LIVE, NAME, 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 | |
ContentBundle(BigDecimal id)
Retrieves a bundle. |
|
ContentBundle(ContentItem primary)
Creates a new bundle. |
|
ContentBundle(com.arsdigita.persistence.DataObject object)
Retrieves or creates a bundle using the DataObject
argument. |
|
ContentBundle(com.arsdigita.persistence.OID oid)
Retrieves a bundle. |
|
ContentBundle(String type)
Creates a bundle. |
Method Summary | |
void |
addInstance(ContentItem instance)
Adds a language instance to this bundle. |
protected void |
afterSave()
|
protected void |
beforeSave()
For new content items, sets the associated content type if it has not been already set. |
protected boolean |
canPublishToFS()
Method to determine whether this ContentItem should be automatically published to the file system. |
boolean |
copyProperty(CustomCopy source,
com.arsdigita.persistence.metadata.Property property,
ItemCopier copier)
Ignore the INSTANCES property for
ItemCopier.VERSION_COPY . |
boolean |
copyServices(ContentItem source)
Copy services from the source item. |
String |
getBaseDataObjectType()
Returns the data object type for this bundle. |
String |
getDefaultLanguage()
Gets the default language of the bundle. |
ContentItem |
getInstance(String language)
Returns a language instance for language or
null if no such instance exists. |
ItemCollection |
getInstances()
Produces a collection containing all language instances in this bundle. |
Collection |
getLanguages()
List all languages in which this item is available, i.e. |
Lifecycle |
getLifecycle()
Fetches the publication lifecycle. |
ContentItem |
getPrimaryInstance()
Gets the primary instance of this bundle. |
boolean |
hasInstance(ContentItem instance)
Tells whether instance is present in the bundle. |
boolean |
hasInstance(String language)
Utility method to check if this bundle already contains an instance for the given language . |
protected void |
initialize()
Called from the base class ( DomainObject )
constructors. |
protected ContentItem |
makeCopy()
Performs the actual mechanics of copying a content item. |
ContentItem |
negotiate(Enumeration locales)
Negotiate the right language instance for this bundle and return it. |
ContentItem |
negotiate(Locale[] locales)
Negotiate the right language instance for this bundle and return it. |
ContentItem |
publish(LifecycleDefinition definition,
Date start)
Schedules an item for publication. |
protected void |
publishToFS()
Publish this item to the filesystem; can only be called on a live version. |
void |
removeInstance(ContentItem instance)
Removes a language instance from the bundle. |
void |
setDefaultLanguage(String language)
Sets the default language of the bundle. |
void |
setLifecycle(Lifecycle lifecycle)
Apply a lifecycle to this content item. |
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 |
public static final String versionId
public static final String BASE_DATA_OBJECT_TYPE
public static final String INSTANCES
public static final String DEFAULT_LANGUAGE
Constructor Detail |
public ContentBundle(ContentItem primary)
primary
- The primary language instance of this bundlepublic ContentBundle(com.arsdigita.persistence.OID oid) throws com.arsdigita.domain.DataObjectNotFoundException
oid
- the OID
of the bundle to retrievepublic ContentBundle(BigDecimal id) throws com.arsdigita.domain.DataObjectNotFoundException
id
- the BigDecimal
id of the bundle to
retrievepublic ContentBundle(com.arsdigita.persistence.DataObject object)
DataObject
argument.
object
- the DataObject
to use in creating or
retrieving the bundlepublic ContentBundle(String type)
type
- the String
data object type with which
to create a new bundleMethod Detail |
public String getBaseDataObjectType()
getBaseDataObjectType
in class ContentItem
protected ContentItem makeCopy()
ContentItem
makeCopy
in class ContentItem
public final String getDefaultLanguage()
public final void setDefaultLanguage(String language)
public void addInstance(ContentItem instance)
setDefaultLanguage(String)
as well.
instance
- the new language instancesetDefaultLanguage(String)
public void removeInstance(ContentItem instance)
instance
is the primary instance.
Note that the language instance is not deleted by this
operation; it is just removed from the Bundle. Users of this
method have to take care to properly dispose of this instance!
instance
- The language instance to removepublic final ContentItem getPrimaryInstance()
addInstance(ContentItem)
public final ItemCollection getInstances()
public final ContentItem getInstance(String language)
language
or
null
if no such instance exists.
This method does not do language negotiation,
it only returns an exact match for the given Locale or
null
if no such match is found.
language
- the language for which to get an instance
l
negotiate(java.util.Locale[])
public final boolean hasInstance(ContentItem instance)
instance
is present in the bundle.
instance
- the language instance to look for
true
if the instance is in the bundlepublic final boolean hasInstance(String language)
language
.
language
- an ISO639 2-letter language code
true
if this ContentBundle
contains an instance for the language given as an argumentContentItem.getLanguage()
public final Collection getLanguages()
Collection
of language 2-letter codes in
which this item is availablepublic ContentItem negotiate(Locale[] locales)
locales
- the acceptable locales for the language
instance, in decreasing importance
null
if there is no language instance for any of the locales in
locales
public ContentItem negotiate(Enumeration locales)
locales
- the acceptable locales for the language instance, in
decreasing importance. This parameter has to be an
Enumeration
of Locale
objects.
null
if there
is no language instance for any of the locales in locales
.protected void beforeSave()
ContentItem
beforeSave
in class ContentItem
protected boolean canPublishToFS()
ContentItem
canPublishToFS
in class ContentItem
protected void publishToFS()
ContentItem
publishToFS
in class ContentItem
public ContentItem publish(LifecycleDefinition definition, Date start)
ContentItem
publish
in class ContentItem
definition
- The lifecycle definitionstart
- The time to schedule the start of the
lifecycle. If null, use the current time as the start date.
public Lifecycle getLifecycle()
ContentItem
getLifecycle
in class ContentItem
public void setLifecycle(Lifecycle lifecycle)
ContentItem
setLifecycle
in class ContentItem
lifecycle
- The lifecyclepublic boolean copyProperty(CustomCopy source, com.arsdigita.persistence.metadata.Property property, ItemCopier copier)
INSTANCES
property for
ItemCopier.VERSION_COPY
.
copyProperty
in interface CustomCopy
copyProperty
in class ContentItem
source
- the source CustomCopy itemproperty
- the property to copycopier
- a temporary class that is able to copy a child item
correctly.
public boolean copyServices(ContentItem source)
ContentItem
ContentItem.copyProperty(com.arsdigita.cms.ContentItem, java.lang.String, com.arsdigita.cms.ItemCopier)
method above. The object copier will
call this method whenever an item has been successfully published,
in order to transfer services such as categorization or permissions
to the live version.
This method is requied to return false to signal the object copier to transfer default services from the source item; or true in order to abort further processing of services.
copyServices
in class ContentItem
protected void initialize()
ContentItem
DomainObject
)
constructors.
initialize
in class ContentItem
protected void afterSave()
afterSave
in class ContentItem
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |