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
,TraversableAmetysObject
,MetadataAwareSitemapElement
,ModifiablePage
,ModifiableSitemapElement
,MoveablePage
,Page
,SitemapElement
,SiteAwareAmetysObject
public class DefaultPage<F extends DefaultPageFactory>
extends AbstractSitemapElement<F>
implements ModifiablePage, CopiableAmetysObject, MoveablePage
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
Modifier and TypeFieldDescriptionstatic final String
Constant for the attachment node name.static final String
Constant for long title metadata.static final String
Constant for publication end date metadata.static final String
Constant for publication start date metadata.static final String
Constant for referers metadata.static final String
Constant for robots metadata.static final String
Constants for sitemap Metadata*static final String
Constant for template metadata.static final String
Constant for title metadata.static final String
Constant for title metadata.static final String
Constant for title metadata.static final String
Constant for title metadata.static final String
Constant for the visible attribute.Fields inherited from class org.ametys.web.repository.page.jcr.AbstractSitemapElement
ZONE_NODE_TYPE, ZONES_NODE_NAME, ZONES_NODE_TYPE
Fields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE
-
Constructor Summary
ConstructorDescriptionDefaultPage
(javax.jcr.Node node, String parentPath, F factory) Creates aDefaultPage
. -
Method Summary
Modifier and TypeMethodDescriptionGet the set of data name to exclude from the copyvoid
addReferer
(String ametysObjectId) Add a newAmetysObject
referencing this page.boolean
canMoveTo
(AmetysObject newParent) Test if a move can be a success or if it is impossible (e.g.void
copyTo
(ModifiableDataHolder dataHolder) Copies the currentDataHolder
to the givenModifiableModelAwareDataHolder
.copyTo
(ModifiableTraversableAmetysObject parent, String name) Copy the currentAmetysObject
to the given object.copyTo
(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) Copy the currentAmetysObject
to 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 thisDataHolder
int
getDepth()
Get the page depthRetrieves the long title.Computes the path relative to the current sitemap.Retrieves allAmetysObject
ids 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.boolean
Determine if the page is visible into navigation elementsvoid
moveTo
(AmetysObject newParent, boolean renameIfExist) Move the current object as a new child of the given object.void
orderBefore
(AmetysObject siblingNode) Order a node before another sibling node (or as the last node)void
removeReferer
(String ametysObjectId) Removes anAmetysObject
referencing this page.void
setLongTitle
(String title) Set the long title.void
setSitemapName
(String sitemapName) Set the sitemap name.void
setSiteName
(String siteName) Set the site name.void
setTemplate
(String template) Set the template name.void
Set the title.void
setType
(Page.PageType type) Set the type.void
setURL
(Page.LinkType type, String url) Set the linked URL.void
setVisible
(boolean isVisible) Set the visibility of the pagevoid
Tags.void
Untags.Methods inherited from class org.ametys.web.repository.page.jcr.AbstractSitemapElement
createZone, dataToSAX, dataToSAX, getChildPageAt, getChildrenPages, getChildrenPages, getDataHolder, getMetadataHolder, getTemplateParametersHolder, getZone, getZones, hasZone
Methods 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, removeDeniedUsers
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCode
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
dataToJSON, dataToSAX, dataToSAX, getDataNames, getRepositoryData
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToSAX, getComposite, getModelItemTypeExtensionPoint, getParentDataHolder, getRootDataHolder, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultiple
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX, hasValue, hasValueOrEmpty
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getDataHolder, getParentDataHolder, getRepositoryData, getRootDataHolder, removeValue, setValue, setValue, synchronizeValues
Methods inherited from interface org.ametys.web.repository.page.ModifiableSitemapElement
createZone, getTemplateParametersHolder, getZone, getZones
Methods inherited from interface org.ametys.plugins.repository.ModifiableTraversableAmetysObject
createChild
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
Methods inherited from interface org.ametys.web.repository.page.SitemapElement
getChildPageAt, getChildrenPages, getChildrenPages, hasZone
Methods 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_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_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
- theDefaultPageFactory
which creates the AmetysObject.
-
-
Method Details
-
getTemplate
Description copied from interface:SitemapElement
Retrieves the template name.- Specified by:
getTemplate
in interfaceSitemapElement
- Returns:
- the template name or
null
if none has been set or if the type is not container. - Throws:
AmetysRepositoryException
- if an error occurs.
-
setTemplate
Description copied from interface:ModifiablePage
Set the template name.- Specified by:
setTemplate
in interfaceModifiablePage
- Parameters:
template
- the template name.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTags
Description copied from interface:TagAwareAmetysObject
Retrieves current tags.- Specified by:
getTags
in interfaceTagAwareAmetysObject
- Returns:
- the current tags.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
tag
Description copied from interface:TaggableAmetysObject
Tags.- Specified by:
tag
in interfaceTaggableAmetysObject
- Parameters:
tag
- the tag to add.- Throws:
AmetysRepositoryException
- if an error occurs.
-
untag
Description copied from interface:TaggableAmetysObject
Untags.- Specified by:
untag
in interfaceTaggableAmetysObject
- Parameters:
tag
- the tag to remove.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTitle
Description copied from interface:SitemapElement
Retrieves the title.- Specified by:
getTitle
in interfaceSitemapElement
- Returns:
- the title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTitle
Description copied from interface:ModifiablePage
Set the title.- Specified by:
setTitle
in interfaceModifiablePage
- Parameters:
title
- the title.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getLongTitle
Description copied from interface:Page
Retrieves the long title.- Specified by:
getLongTitle
in interfacePage
- Returns:
- the title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLongTitle
Description copied from interface:ModifiablePage
Set the long title.- Specified by:
setLongTitle
in interfaceModifiablePage
- Parameters:
title
- the title.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSitemap
Description copied from interface:SitemapElement
Retrieves the sitemap containing the current sitemap.- Specified by:
getSitemap
in interfaceSitemapElement
- Returns:
- the sitemap containing the current sitemap.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDepth
Description copied from interface:Page
Get the page depth- Specified by:
getDepth
in interfacePage
- Returns:
- the page depth
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSite
Description copied from interface:SiteAwareAmetysObject
Returns this object's site.- Specified by:
getSite
in interfaceSiteAwareAmetysObject
- Returns:
- this object's site
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSiteName
Description copied from interface:SiteAwareAmetysObject
Returns this object's site name.- Specified by:
getSiteName
in interfaceSiteAwareAmetysObject
- Returns:
- this object's site name.
-
setSiteName
Description copied from interface:ModifiablePage
Set the site name.- Specified by:
setSiteName
in interfaceModifiablePage
- Parameters:
siteName
- the site name.
-
getSitemapName
Description copied from interface:SitemapElement
Returns this page's sitemap name- Specified by:
getSitemapName
in interfaceSitemapElement
- Returns:
- this page's sitemap name
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setSitemapName
Description copied from interface:ModifiablePage
Set the sitemap name.- Specified by:
setSitemapName
in interfaceModifiablePage
- Parameters:
sitemapName
- the sitemap name.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getPathInSitemap
Description copied from interface:SitemapElement
Computes the path relative to the current sitemap.- Specified by:
getPathInSitemap
in interfaceSitemapElement
- Returns:
- the path relative to the current sitemap.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getType
Description copied from interface:Page
Retrieves the type.- Specified by:
getType
in interfacePage
- Returns:
- the type.
- Throws:
AmetysRepositoryException
- if an error occurs.- See Also:
-
setType
Description copied from interface:ModifiablePage
Set the type.- Specified by:
setType
in interfaceModifiablePage
- Parameters:
type
- the type.- Throws:
AmetysRepositoryException
- if an error occurs.- See Also:
-
getURL
Description copied from interface:Page
Retrieves the linked URL.- Specified by:
getURL
in interfacePage
- Returns:
- the linked URL.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getURLType
Description copied from interface:Page
Retrieves the linked URL type.- Specified by:
getURLType
in interfacePage
- Returns:
- the linked URL type.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setURL
Description copied from interface:ModifiablePage
Set the linked URL.- Specified by:
setURL
in 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:Page
Retrieves the attachments root node- Specified by:
getRootAttachments
in interfacePage
- Returns:
- The the attachments root node
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getReferers
Description copied from interface:Page
Retrieves allAmetysObject
ids referencing this page.- Specified by:
getReferers
in interfacePage
- Returns:
- the
AmetysObject
ids referencing this page. - Throws:
AmetysRepositoryException
- if an error occurs.
-
addReferer
Description copied from interface:ModifiablePage
Add a newAmetysObject
referencing this page.- Specified by:
addReferer
in interfaceModifiablePage
- Parameters:
ametysObjectId
- theAmetysObject
ids referencing this page.- Throws:
AmetysRepositoryException
- if an error occurs.
-
removeReferer
Description copied from interface:ModifiablePage
Removes anAmetysObject
referencing this page.- Specified by:
removeReferer
in interfaceModifiablePage
- Parameters:
ametysObjectId
- theAmetysObject
ids 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:CopiableAmetysObject
Copy the currentAmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.- Specified by:
copyTo
in 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 ofCopiableAmetysObject
authorized 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:CopiableAmetysObject
Copy the currentAmetysObject
to the given object. Be careful, this method save changes.- Specified by:
copyTo
in 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:DataHolder
Copies the currentDataHolder
to the givenModifiableModelAwareDataHolder
.- Specified by:
copyTo
in interfaceDataAwareAmetysObject
- Specified by:
copyTo
in 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 destinationModifiableModelAwareDataHolder
BadItemTypeException
- if the type defined by the model of the destinationModifiableModelAwareDataHolder
doesn't match the copied valueUnknownTypeException
- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableModelLessDataHolder
NotUniqueTypeException
- 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:MovableAmetysObject
Move 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:
moveTo
in 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:MovableAmetysObject
Test if a move can be a success or if it is impossible (e.g. due to the implementation of the target)- Specified by:
canMoveTo
in 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:MovableAmetysObject
Order a node before another sibling node (or as the last node)- Specified by:
orderBefore
in 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:Page
Determine if the page is visible into navigation elements- Specified by:
isVisible
in interfacePage
- Returns:
- true if the page is visible.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setVisible
Description copied from interface:ModifiablePage
Set the visibility of the page- Specified by:
setVisible
in 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:ModelLessDataHolder
Convert the data contained in thisDataHolder
- Specified by:
dataToJSON
in interfaceModelLessDataAwareAmetysObject
- Specified by:
dataToJSON
in interfaceModelLessDataHolder
- Parameters:
context
- The context of the data to convert- Returns:
- The data of the current
DataHolder
as 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:DataHolder
Convert the data at the given path into a JSON object- Specified by:
dataToJSON
in interfaceDataAwareAmetysObject
- Specified by:
dataToJSON
in interfaceDataHolder
- Parameters:
dataPath
- the path of the data to convertcontext
- The context of the data to convert- Returns:
- The value as JSON
-