|
|||||||||||
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.Folder
This class represents folders for which to organize items in a tree
hierarchy.
Folders will only ever exist as draft or live versions. There
should never be any folders that are pending. The pending versions
of ordinary content items are stored in the live version of
folders.
Folders cannot have their own lifecycles. The methods to get or set
lifecycles are no-ops.
You should never call publish(com.arsdigita.cms.lifecycle.LifecycleDefinition, java.util.Date)
or unpublish()
on a
folder; at present, these methods only log a warning when they are
called. In the future, these warnings may be turned into actual
errors.
Nested Class Summary | |
static class |
Folder.ItemCollection
A collection of items that can be filtered to return only folders or only nonfolders. |
Field Summary | |
static String |
BASE_DATA_OBJECT_TYPE
|
static String |
HOME_FOLDER
|
static String |
HOME_SECTION
|
static String |
INDEX
|
protected static String |
ITEMS
|
static String |
versionId
|
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 | |
Folder()
Default constructor. |
|
Folder(BigDecimal id)
Constructor. |
|
Folder(com.arsdigita.persistence.DataObject obj)
|
|
Folder(com.arsdigita.persistence.OID oid)
Constructor. |
|
Folder(String type)
|
Method Summary | |
void |
addItem(ContentBundle item)
|
protected void |
addPendingVersion(ContentItem version)
Adds a pending version to the item. |
protected void |
afterSave()
|
boolean |
autoPublishIfAssociated()
Called by VersionCopier to determine whether to
publish associated items when an item goes live. |
protected void |
beforeDelete()
Remove any Links pointing to this item before deletion. |
protected void |
beforeSave()
For new content items, sets the associated content type if it has not been already set. |
protected boolean |
canPublishToFS()
Folders aren't explicitly p2fs'd |
boolean |
containsFolders()
Returns true if the folder contains at least one
folder, false if the folder does not contain any
folders, but is either empty or contains only ordinary items. |
void |
copyItemsToFolder(Iterator items)
|
boolean |
copyProperty(CustomCopy srcItem,
com.arsdigita.persistence.metadata.Property property,
ItemCopier copier)
Copy the specified property (attribute or association) from the specified source folder. |
void |
delete()
Deletes the folder. |
String |
getBaseDataObjectType()
|
String |
getDisplayName()
Fetch the display name of the content item. |
ContentBundle |
getIndexItem()
Get the (special) index item for the folder. |
ContentItem |
getItem(String name,
boolean isFolder)
Returns a child content item in this folder (which could itself be a folder) with the specified name. |
Folder.ItemCollection |
getItems()
Fetches the child items of this folder. |
Folder.ItemCollection |
getItems(boolean bSort)
Fetches the child items of this folder. |
String |
getLabel()
Fetches the label of the folder. |
Lifecycle |
getLifecycle()
Always returns null , as folders do not have lifecycles. |
Folder.ItemCollection |
getPrimaryInstances()
Returns collection of primary language instances for bundles in this folder. |
static Folder |
getUserHomeFolder(com.arsdigita.kernel.User user,
ContentSection section)
|
boolean |
isEmpty()
Returns true if the folder is empty. |
protected ContentItem |
makeCopy()
Performs the actual mechanics of copying a content item. |
ContentItem |
publish(LifecycleDefinition cycleDef,
Date startDate)
Schedules an item for publication. |
void |
removeIndexItem()
Removes the index item. |
void |
removeLifecycle()
Does not do anything, as folders do not have lifecycles. |
void |
removePendingVersion(ContentItem version)
Removes a pending version from the item. |
void |
setIndexItem(ContentBundle item)
Sets the index item. |
void |
setLabel(String value)
Set the label of this folder. |
void |
setLifecycle(Lifecycle cycle)
Does not do anything, as folders do not have lifecycles. |
static void |
setUserHomeFolder(com.arsdigita.kernel.User user,
Folder folder)
|
protected void |
setVersion(String version)
Set the version of the folder. |
void |
unpublish()
Unpublishes an 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, 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 INDEX
public static final String HOME_FOLDER
public static final String HOME_SECTION
protected static final String ITEMS
Constructor Detail |
public Folder()
public Folder(com.arsdigita.persistence.OID oid) throws com.arsdigita.domain.DataObjectNotFoundException
DataObject
is retrieved
from the persistent storage mechanism with an OID
specified by
oid
- The OID
for the retrieved
DataObject
.public Folder(BigDecimal id) throws com.arsdigita.domain.DataObjectNotFoundException
DataObject
is retrieved
from the persistent storage mechanism with an OID
specified by id
and
Folder.BASE_DATA_OBJECT_TYPE
.
id
- The id
for the retrieved
DataObject
public Folder(com.arsdigita.persistence.DataObject obj)
public Folder(String type)
Method Detail |
protected ContentItem makeCopy()
ContentItem
makeCopy
in class ContentItem
public void copyItemsToFolder(Iterator items)
public String getBaseDataObjectType()
getBaseDataObjectType
in class ContentItem
public void delete() throws IllegalStateException
IllegalStateException
- if the folder is not empty.protected void beforeDelete()
ContentItem
beforeDelete
in class ContentItem
protected void beforeSave()
ContentItem
beforeSave
in class ContentItem
protected void afterSave()
afterSave
in class ContentItem
public Folder.ItemCollection getItems(boolean bSort)
bSort
- whether to sort the collection by isFolder and ID
public Folder.ItemCollection getItems()
public Folder.ItemCollection getPrimaryInstances()
public ContentItem getItem(String name, boolean isFolder)
name
- The name of the itemisFolder
- If true, only return a subfolder. Otherwise,
return any subitem
public void addItem(ContentBundle item)
public String getDisplayName()
ContentItem
ContentItem
is the name property.
getDisplayName
in class ContentItem
public final String getLabel()
public final void setLabel(String value)
protected void setVersion(String version)
setVersion
in class ContentItem
version
- A version tag, ContentItem.LIVE
or ContentItem.DRAFT
or ContentItem.PENDING
public void unpublish()
ContentItem
setLive(null)
.
unpublish
in class ContentItem
public ContentItem publish(LifecycleDefinition cycleDef, Date startDate)
ContentItem
publish
in class ContentItem
cycleDef
- The lifecycle definitionstartDate
- The time to schedule the start of the
lifecycle. If null, use the current time as the start date.
public Lifecycle getLifecycle()
null
, as folders do not have lifecycles.
getLifecycle
in class ContentItem
Lifecycle
valuepublic void setLifecycle(Lifecycle cycle)
setLifecycle
in class ContentItem
cycle
- The lifecyclepublic void removeLifecycle()
protected void addPendingVersion(ContentItem version)
ContentItem
addPendingVersion
in class ContentItem
public void removePendingVersion(ContentItem version)
ContentItem
removePendingVersion
in class ContentItem
version
- the version to removepublic ContentBundle getIndexItem()
getItems()
,
you cannot delete a folder if it still has an index item etc.
public final void setIndexItem(ContentBundle item)
item
- The index item with the folder's user-editable
attributespublic final void removeIndexItem()
public boolean isEmpty()
true
if the folder is empty.
true
if the folder is emptypublic boolean containsFolders()
true
if the folder contains at least one
folder, false
if the folder does not contain any
folders, but is either empty or contains only ordinary items.
true
if the folder contains other folders.public boolean copyProperty(CustomCopy srcItem, com.arsdigita.persistence.metadata.Property property, ItemCopier copier)
ObjectCopier
. If the property in
question is an association to ContentItem
(s), this method
should only call FooContentItem newChild =
copier.copyItem(originalChild)
. An attempt to call any other
method in order to copy the child will most likely have disastrous
consequences.
If a child class overrides this method, it should return
super.copyProperty
in order to indicate that it is
not interested in handling the property in any special way.
copyProperty
in interface CustomCopy
copyProperty
in class ContentItem
srcItem
- the source itemproperty
- the property to copycopier
- the ItemCopier
protected boolean canPublishToFS()
canPublishToFS
in class ContentItem
public boolean autoPublishIfAssociated()
VersionCopier
to determine whether to
publish associated items when an item goes live. This will only
have an effect for non-component associations where the item is
not yet published. Override default for Folder
s
since they don't have their own lifecycles and a folder must be
published when an item in it goes live.
public static void setUserHomeFolder(com.arsdigita.kernel.User user, Folder folder)
public static Folder getUserHomeFolder(com.arsdigita.kernel.User user, ContentSection section)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |