Class DefaultPage<F extends DefaultPageFactory>
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject<F>
org.ametys.web.repository.page.jcr.AbstractSitemapElement<F>
org.ametys.web.repository.page.jcr.DefaultPage<F>
- Type Parameters:
F- the actual type of factory.
- All Implemented Interfaces:
ACLAmetysObject,AmetysObject,CopiableAmetysObject,DataAwareAmetysObject,ModelLessDataAwareAmetysObject,ModifiableModelLessDataAwareAmetysObject,DataHolder,ModelLessDataHolder,ModifiableDataHolder,ModifiableModelLessDataHolder,JCRAmetysObject,JCRTraversableAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,ModifiableTraversableAmetysObject,MovableAmetysObject,RemovableAmetysObject,TagAwareAmetysObject,TaggableAmetysObject,TrashableAmetysObject,TraversableAmetysObject,LockablePage,MetadataAwareSitemapElement,ModifiablePage,ModifiableSitemapElement,MoveablePage,Page,SitemapElement,SiteAwareAmetysObject
public class DefaultPage<F extends DefaultPageFactory>
extends AbstractSitemapElement<F>
implements LockablePage, CopiableAmetysObject, MoveablePage, TrashableAmetysObject
Page implementation stored into a JCR node using
ametys:defaultPage node type.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.web.repository.page.Page
Page.LinkType, Page.PageType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant for the attachment node name.static final StringConstant for the initial title metadata.static final StringConstant for the locked attribute.static final StringConstant for long title metadata.static final StringConstant for publication end date metadata.static final StringConstant for publication start date metadata.static final StringConstant for referers metadata.static final StringConstant for robots metadata.static final StringConstants for sitemap Metadata*static final StringConstant for template metadata.static final StringConstant for title metadata.static final StringConstant for title metadata.static final StringConstant for title metadata.static final StringConstant for title metadata.static final StringConstant for the visible attribute.Fields inherited from class org.ametys.web.repository.page.jcr.AbstractSitemapElement
ZONE_NODE_TYPE, ZONES_NODE_NAME, ZONES_NODE_TYPEFields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPage(javax.jcr.Node node, String parentPath, F factory) Creates aDefaultPage. -
Method Summary
Modifier and TypeMethodDescriptionGet the set of data name to exclude from the copyvoidaddReferer(String ametysObjectId) Add a newAmetysObjectreferencing this page.booleancanMoveTo(AmetysObject newParent) Test if a move can be a success or if it is impossible (e.g.voidcopyTo(ModifiableDataHolder dataHolder) Copies the currentDataHolderto the givenModifiableModelAwareDataHolder.copyTo(ModifiableTraversableAmetysObject parent, String name) Copy the currentAmetysObjectto the given object.copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) Copy the currentAmetysObjectto the given object if it is not in the restriction list.dataToJSON(String dataPath, DataContext context) Convert the data at the given path into a JSON objectdataToJSON(DataContext context) Convert the data contained in thisDataHolderintgetDepth()Get the page depthGet the title that was set by the user (and not set by a copy adding a number after)Retrieves the long title.Computes the path relative to the current sitemap.Retrieves allAmetysObjectids referencing this page.Retrieves the attachments root nodegetSite()Returns this object's site.Retrieves the sitemap containing the current sitemap.Returns this page's sitemap nameReturns this object's site name.getTags()Retrieves current tags.Retrieves the template name.getTitle()Retrieves the title.getType()Retrieves the type.getURL()Retrieves the linked URL.Retrieves the linked URL type.booleanisLocked()Returns true if thisPageis lockedbooleanDetermine if the page is visible into navigation elementsvoidlock()Locks thisPagevoidmoveTo(AmetysObject newParent, boolean renameIfExist) Move the current object as a new child of the given object.Move thisAmetysObjectto the trash.voidorderBefore(AmetysObject siblingNode) Order a node before another sibling node (or as the last node)voidremoveReferer(String ametysObjectId) Removes anAmetysObjectreferencing this page.Restore thisAmetysObjectfrom the trash.voidsetInitialTitle(String initialTitle) Set the title that was set by the user (and not set by a copy adding a number after)voidsetLongTitle(String title) Set the long title.voidsetSitemapName(String sitemapName) Set the sitemap name.voidsetSiteName(String siteName) Set the site name.voidsetTemplate(String template) Set the template name.voidSet the title.voidsetType(Page.PageType type) Set the type.voidsetURL(Page.LinkType type, String url) Set the linked URL.voidsetVisible(boolean isVisible) Set the visibility of the pagevoidTags.voidunlock()Unlocks thisPagevoidUntags.Methods inherited from class org.ametys.web.repository.page.jcr.AbstractSitemapElement
createZone, dataToSAX, dataToSAX, getChildPageAt, getChildrenPages, getChildrenPages, getDataHolder, getMetadataHolder, getTemplateParametersHolder, getZone, getZones, hasZoneMethods inherited from class org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, disallowInheritance, getChild, getChildren, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, hasChild, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsersMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChangesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToJSON, dataToSAX, dataToSAX, getDataNames, getRepositoryDataMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToSAX, getComposite, getModelItemTypeExtensionPoint, getParentDataHolder, getRootDataHolder, getType, getValue, getValue, getValueOfType, getValueOfType, hasDifferences, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultipleMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getDataHolder, getParentDataHolder, getRepositoryData, getRootDataHolder, removeValue, setValue, setValue, synchronizeValuesMethods inherited from interface org.ametys.web.repository.page.ModifiableSitemapElement
createZone, getTemplateParametersHolder, getZone, getZonesMethods inherited from interface org.ametys.plugins.repository.ModifiableTraversableAmetysObject
createChildMethods inherited from interface org.ametys.web.repository.page.Page
isIndexableMethods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
removeMethods inherited from interface org.ametys.web.repository.page.SitemapElement
getChildPageAt, getChildrenPages, getChildrenPages, hasZoneMethods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChild, getChildAt, getChildPosition, getChildren, hasChild
-
Field Details
-
METADATA_TEMPLATE
Constant for template metadata.- See Also:
-
METADATA_TITLE
Constant for title metadata.- See Also:
-
METADATA_INITIAL_TITLE
Constant for the initial title metadata.- See Also:
-
METADATA_LONG_TITLE
Constant for long title metadata.- See Also:
-
METADATA_TYPE
Constant for title metadata.- See Also:
-
METADATA_URL
Constant for title metadata.- See Also:
-
METADATA_URLTYPE
Constant for title metadata.- See Also:
-
METADATA_REFERERS
Constant for referers metadata.- See Also:
-
METADATA_VISIBLE
Constant for the visible attribute.- See Also:
-
METADATA_LOCKED
Constant for the locked attribute.- See Also:
-
METADATA_ROBOTS_DISALLOW
Constant for robots metadata.- See Also:
-
ATTACHMENTS_NODE_NAME
Constant for the attachment node name.- See Also:
-
METADATA_SITEMAP
Constants for sitemap Metadata*- See Also:
-
METADATA_PUBLICATION_START_DATE
Constant for publication start date metadata.- See Also:
-
METADATA_PUBLICATION_END_DATE
Constant for publication end date metadata.- See Also:
-
-
Constructor Details
-
DefaultPage
Creates aDefaultPage.- Parameters:
node- the node backing thisAmetysObject.parentPath- the parent path in the Ametys hierarchy.factory- theDefaultPageFactorywhich creates the AmetysObject.
-
-
Method Details
-
getTemplate
Description copied from interface:SitemapElementRetrieves the template name.- Specified by:
getTemplatein interfaceSitemapElement- Returns:
- the template name or
nullif none has been set or if the type is not container. - Throws:
AmetysRepositoryException- if an error occurs.
-
setTemplate
Description copied from interface:ModifiablePageSet the template name.- Specified by:
setTemplatein interfaceModifiablePage- Parameters:
template- the template name.- Throws:
AmetysRepositoryException- if an error occurs.
-
getTags
Description copied from interface:TagAwareAmetysObjectRetrieves current tags.- Specified by:
getTagsin interfaceTagAwareAmetysObject- Returns:
- the current tags.
- Throws:
AmetysRepositoryException- if an error occurs.
-
tag
Description copied from interface:TaggableAmetysObjectTags.- Specified by:
tagin interfaceTaggableAmetysObject- Parameters:
tag- the tag to add.- Throws:
AmetysRepositoryException- if an error occurs.
-
untag
Description copied from interface:TaggableAmetysObjectUntags.- Specified by:
untagin interfaceTaggableAmetysObject- Parameters:
tag- the tag to remove.- Throws:
AmetysRepositoryException- if an error occurs.
-
getTitle
Description copied from interface:SitemapElementRetrieves the title.- Specified by:
getTitlein interfaceSitemapElement- Returns:
- the title.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setTitle
Description copied from interface:ModifiablePageSet the title.- Specified by:
setTitlein interfaceModifiablePage- Parameters:
title- the title.- Throws:
AmetysRepositoryException- if an error occurs.
-
getInitialTitle
Get the title that was set by the user (and not set by a copy adding a number after)- Returns:
- The initial title
- Throws:
AmetysRepositoryException- if an error occurs
-
setInitialTitle
Set the title that was set by the user (and not set by a copy adding a number after)- Parameters:
initialTitle- The initial title to set- Throws:
AmetysRepositoryException- if an error occurs
-
getLongTitle
Description copied from interface:PageRetrieves the long title.- Specified by:
getLongTitlein interfacePage- Returns:
- the title.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setLongTitle
Description copied from interface:ModifiablePageSet the long title.- Specified by:
setLongTitlein interfaceModifiablePage- Parameters:
title- the title.- Throws:
AmetysRepositoryException- if an error occurs.
-
getSitemap
Description copied from interface:SitemapElementRetrieves the sitemap containing the current sitemap.- Specified by:
getSitemapin interfaceSitemapElement- Returns:
- the sitemap containing the current sitemap.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getDepth
Description copied from interface:PageGet the page depth- Specified by:
getDepthin interfacePage- Returns:
- the page depth
- Throws:
AmetysRepositoryException- if an error occurs.
-
getSite
Description copied from interface:SiteAwareAmetysObjectReturns this object's site.- Specified by:
getSitein interfaceSiteAwareAmetysObject- Returns:
- this object's site
- Throws:
AmetysRepositoryException- if an error occurs.
-
getSiteName
Description copied from interface:SiteAwareAmetysObjectReturns this object's site name.- Specified by:
getSiteNamein interfaceSiteAwareAmetysObject- Returns:
- this object's site name.
-
setSiteName
Description copied from interface:ModifiablePageSet the site name.- Specified by:
setSiteNamein interfaceModifiablePage- Parameters:
siteName- the site name.
-
getSitemapName
Description copied from interface:SitemapElementReturns this page's sitemap name- Specified by:
getSitemapNamein interfaceSitemapElement- Returns:
- this page's sitemap name
- Throws:
AmetysRepositoryException- if an error occurs.
-
setSitemapName
Description copied from interface:ModifiablePageSet the sitemap name.- Specified by:
setSitemapNamein interfaceModifiablePage- Parameters:
sitemapName- the sitemap name.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPathInSitemap
Description copied from interface:SitemapElementComputes the path relative to the current sitemap.- Specified by:
getPathInSitemapin interfaceSitemapElement- Returns:
- the path relative to the current sitemap.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getType
Description copied from interface:PageRetrieves the type.- Specified by:
getTypein interfacePage- Returns:
- the type.
- Throws:
AmetysRepositoryException- if an error occurs.- See Also:
-
setType
Description copied from interface:ModifiablePageSet the type.- Specified by:
setTypein interfaceModifiablePage- Parameters:
type- the type.- Throws:
AmetysRepositoryException- if an error occurs.- See Also:
-
getURL
Description copied from interface:PageRetrieves the linked URL.- Specified by:
getURLin interfacePage- Returns:
- the linked URL.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getURLType
Description copied from interface:PageRetrieves the linked URL type.- Specified by:
getURLTypein interfacePage- Returns:
- the linked URL type.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setURL
Description copied from interface:ModifiablePageSet the linked URL.- Specified by:
setURLin interfaceModifiablePage- Parameters:
type- the type of linkurl- the linked URL (depending on the type)- Throws:
AmetysRepositoryException- if an error occurs.
-
getRootAttachments
Description copied from interface:PageRetrieves the attachments root node- Specified by:
getRootAttachmentsin interfacePage- Returns:
- The the attachments root node. Can be null if the page does not supports attachments
- Throws:
AmetysRepositoryException- if an error occurs.
-
getReferers
Description copied from interface:PageRetrieves allAmetysObjectids referencing this page.- Specified by:
getReferersin interfacePage- Returns:
- the
AmetysObjectids referencing this page. - Throws:
AmetysRepositoryException- if an error occurs.
-
addReferer
Description copied from interface:ModifiablePageAdd a newAmetysObjectreferencing this page.- Specified by:
addRefererin interfaceModifiablePage- Parameters:
ametysObjectId- theAmetysObjectids referencing this page.- Throws:
AmetysRepositoryException- if an error occurs.
-
removeReferer
Description copied from interface:ModifiablePageRemoves anAmetysObjectreferencing this page.- Specified by:
removeRefererin interfaceModifiablePage- Parameters:
ametysObjectId- theAmetysObjectids referencing this page.- Throws:
AmetysRepositoryException- if an error occurs.
-
copyTo
public DefaultPage copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException Description copied from interface:CopiableAmetysObjectCopy the currentAmetysObjectto the given object if it is not in the restriction list. Be careful, this method save changes.- Specified by:
copyToin interfaceCopiableAmetysObject- Parameters:
parent- The parent of the new object. Can not be null.name- Name of the new object. Can be null. If null, the new name will be get from the copied objectrestrictTo- A restrict list ofCopiableAmetysObjectauthorized to be copied- Returns:
- the created object
- Throws:
AmetysRepositoryException- if an error occurs.
-
copyTo
public DefaultPage copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException Description copied from interface:CopiableAmetysObjectCopy the currentAmetysObjectto the given object. Be careful, this method save changes.- Specified by:
copyToin interfaceCopiableAmetysObject- Parameters:
parent- The parent of the new object. Can not be null.name- Name of the new object. Can be null. If null, the new name will be get from the copied object- Returns:
- the created object
- Throws:
AmetysRepositoryException- if an error occurs.
-
copyTo
public void copyTo(ModifiableDataHolder dataHolder) throws UndefinedItemPathException, BadItemTypeException, UnknownTypeException, NotUniqueTypeException Description copied from interface:DataHolderCopies the currentDataHolderto the givenModifiableModelAwareDataHolder.- Specified by:
copyToin interfaceDataAwareAmetysObject- Specified by:
copyToin interfaceDataHolder- Parameters:
dataHolder- The destination dataHolder. Can not be null.- Throws:
UndefinedItemPathException- if one of the copied data is not defined by the model of the destinationModifiableModelAwareDataHolderBadItemTypeException- if the type defined by the model of the destinationModifiableModelAwareDataHolderdoesn't match the copied valueUnknownTypeException- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableModelLessDataHolderNotUniqueTypeException- if there is more than one available types compatibles with the copied value for the type extension point of the destinationModifiableModelLessDataHolder
-
_getExcludedDataFromCopy
Get the set of data name to exclude from the copy- Returns:
- the set of data name to exclude from the copy
-
moveTo
public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException Description copied from interface:MovableAmetysObjectMove the current object as a new child of the given object. This node will be the last child. You should call canMoveTo to know if this is a supported operation.- Specified by:
moveToin interfaceMovableAmetysObject- Parameters:
newParent- The new parent for the current object. Can not be null. Can not be a child of the current node. Must be a TraversableAmetyObject.renameIfExist- true to rename moved page if a page with same name already exist- Throws:
AmetysRepositoryException- if an error occurs.RepositoryIntegrityViolationException- if a page with the same name already exists.
-
canMoveTo
Description copied from interface:MovableAmetysObjectTest if a move can be a success or if it is impossible (e.g. due to the implementation of the target)- Specified by:
canMoveToin interfaceMovableAmetysObject- Parameters:
newParent- See moveTo.- Returns:
- true if the move operation may succeed. If false is returned and you call moveTo anyway, you may encontered a RuntimeException (such as UnsupportedOperationException)
- Throws:
AmetysRepositoryException- if an error occurs.
-
orderBefore
Description copied from interface:MovableAmetysObjectOrder a node before another sibling node (or as the last node)- Specified by:
orderBeforein interfaceMovableAmetysObject- Parameters:
siblingNode- The node that will be the next sibling node of the current node. Must have the same parent as the current node. Can be null to set the current node as the last node.- Throws:
AmetysRepositoryException- if an error occurs.
-
isVisible
Description copied from interface:PageDetermine if the page is visible into navigation elements- Specified by:
isVisiblein interfacePage- Returns:
trueif the page is visible.- Throws:
AmetysRepositoryException- if an error occurs.
-
setVisible
Description copied from interface:ModifiablePageSet the visibility of the page- Specified by:
setVisiblein interfaceModifiablePage- Parameters:
isVisible- the page visibility.- Throws:
AmetysRepositoryException- if an error occurs.
-
dataToJSON
public Map<String,Object> dataToJSON(DataContext context) throws UnknownTypeException, NotUniqueTypeException Description copied from interface:ModelLessDataHolderConvert the data contained in thisDataHolder- Specified by:
dataToJSONin interfaceModelLessDataAwareAmetysObject- Specified by:
dataToJSONin interfaceModelLessDataHolder- Parameters:
context- The context of the data to convert- Returns:
- The data of the current
DataHolderas JSON - Throws:
UnknownTypeException- if there is no compatible type with the value to convertNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one) with the value to convert
-
dataToJSON
Description copied from interface:DataHolderConvert the data at the given path into a JSON object- Specified by:
dataToJSONin interfaceDataAwareAmetysObject- Specified by:
dataToJSONin interfaceDataHolder- Parameters:
dataPath- the path of the data to convertcontext- The context of the data to convert- Returns:
- The value as JSON
-
isLocked
Description copied from interface:LockablePageReturns true if thisPageis locked- Specified by:
isLockedin interfaceLockablePage- Returns:
- true if this
Pageis locked - Throws:
AmetysRepositoryException- if a problem occurs
-
lock
Description copied from interface:LockablePageLocks thisPage- Specified by:
lockin interfaceLockablePage- Throws:
AmetysRepositoryException- if a problem occurs
-
unlock
Description copied from interface:LockablePageUnlocks thisPage- Specified by:
unlockin interfaceLockablePage- Throws:
AmetysRepositoryException- if a problem occurs
-
moveToTrash
Description copied from interface:TrashableAmetysObjectMove thisAmetysObjectto the trash.- Specified by:
moveToTrashin interfaceTrashableAmetysObject- Returns:
- the created trash element that represents the object in the trash
-
restoreFromTrash
Description copied from interface:TrashableAmetysObjectRestore thisAmetysObjectfrom the trash.- Specified by:
restoreFromTrashin interfaceTrashableAmetysObject- Returns:
- the restored ametys object
- Throws:
UnknownParentException- if it's not possible to determine a location to restore the object
-