F
- the actual type of factory.public class DefaultPage<F extends DefaultPageFactory> extends DefaultTraversableAmetysObject<F> implements ModifiablePage, CopiableAmetysObject, MoveablePage
Page
implementation stored into a JCR node using
ametys:defaultPage
node type.Page.LinkType, Page.PageType
Modifier and Type | Field and Description |
---|---|
private static Logger |
__LOGGER |
static String |
ATTACHMENTS_NODE_NAME
Constant for the attachment node name.
|
static String |
METADATA_LONG_TITLE
Constant for long title metadata.
|
static String |
METADATA_PUBLICATION_END_DATE
Constant for publication end date metadata.
|
static String |
METADATA_PUBLICATION_START_DATE
Constant for publication start date metadata.
|
static String |
METADATA_REFERERS
Constant for referers metadata.
|
static String |
METADATA_ROBOTS_DISALLOW
Constant for robots metadata.
|
static String |
METADATA_SITE
Constants for site Metadata*
|
static String |
METADATA_SITEMAP
Constants for sitemap Metadata*
|
static String |
METADATA_TEMPLATE
Constant for template metadata.
|
static String |
METADATA_TITLE
Constant for title metadata.
|
static String |
METADATA_TYPE
Constant for title metadata.
|
static String |
METADATA_URL
Constant for title metadata.
|
static String |
METADATA_URLTYPE
Constant for title metadata.
|
static String |
METADATA_VISIBLE
Constant for the visible attribute.
|
static String |
ZONE_NODE_TYPE
Constant for the zone node type.
|
static String |
ZONES_NODE_NAME
Constant for the zones node name.
|
static String |
ZONES_NODE_TYPE
Constant for the zones node type.
|
Constructor and Description |
---|
DefaultPage(Node node,
String parentPath,
F factory)
Creates a
DefaultPage . |
Modifier and Type | Method and Description |
---|---|
void |
addReferer(String ametysObjectId)
Add a new
AmetysObject referencing this page. |
boolean |
canMoveTo(AmetysObject newParent)
Test if a move can be a success or if it is impossible (e.g.
|
DefaultPage |
copyTo(ModifiableTraversableAmetysObject parent,
String name)
Copy the current
AmetysObject to the given object. |
DefaultPage |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
List<String> restrictTo)
Copy the current
AmetysObject to the given object if it is not in the restriction list. |
ModifiableZone |
createZone(String name)
Creates a given zone.
|
Page |
getChildPageAt(int index)
Gets the child
Page at the given position |
AmetysObjectIterable<? extends Page> |
getChildrenPages()
Retrieves child pages.
|
AmetysObjectIterable<? extends Page> |
getChildrenPages(boolean includeInvisiblePage)
Retrieves child pages.
|
ModifiableModelLessDataHolder |
getDataHolder()
Returns the
DataHolder of this AmetysObject . |
int |
getDepth()
Get the page depth
|
String |
getLongTitle()
Retrieves the long title.
|
ModifiableCompositeMetadata |
getMetadataHolder()
Returns the root
CompositeMetadata of this AmetysObject . |
String |
getPathInSitemap()
Computes the path relative to the current sitemap.
|
Set<String> |
getReferers()
Retrieves all
AmetysObject ids referencing this page. |
ResourceCollection |
getRootAttachments()
Retrieves the attachments root node
|
Site |
getSite()
Returns this object's site.
|
Sitemap |
getSitemap()
Retrieves the sitemap containing the current sitemap.
|
String |
getSitemapName()
Returns this page's sitemap name
|
String |
getSiteName()
Returns this object's site name.
|
Set<String> |
getTags()
Retrieves current tags.
|
String |
getTemplate()
Retrieves the template name.
|
String |
getTitle()
Retrieves the title.
|
Page.PageType |
getType()
Retrieves the type.
|
String |
getURL()
Retrieves the linked URL.
|
Page.LinkType |
getURLType()
Retrieves the linked URL type.
|
ModifiableZone |
getZone(String name)
Retrieves a given zone.
|
AmetysObjectIterable<ModifiableZone> |
getZones()
Retrieves the zones.
|
boolean |
hasZone(String name)
Determine if a zone exists
|
boolean |
isVisible()
Determine if the page is visible into navigation elements
|
void |
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 an
AmetysObject 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 |
setTitle(String title)
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 page
|
void |
tag(String tag)
Tags.
|
void |
untag(String tag)
Untags.
|
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getChild, getChildren, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, hasChild, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
_getFactory, _invalidateName, _invalidateParentPath, getId, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChild, getChildAt, getChildPosition, getChildren, hasChild
getComposite, getRepeater, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, isMultiple
copyTo, getDataNames
equals, getId, getName, getParent, getParentPath, getPath, hashCode
toSAX, toSAX
dataToSAX, dataToSAX, dataToSAX, dataToSAX
getComposite, getComposite, getRepeater, getRepeater, removeValue, setValue, setValue
createChild
needsSave, rename, revertChanges, saveChanges
remove
getNode
public static final String METADATA_TITLE
public static final String METADATA_LONG_TITLE
public static final String METADATA_TYPE
public static final String METADATA_URL
public static final String METADATA_URLTYPE
public static final String METADATA_TEMPLATE
public static final String METADATA_REFERERS
public static final String METADATA_VISIBLE
public static final String METADATA_ROBOTS_DISALLOW
public static final String ZONES_NODE_NAME
public static final String ZONES_NODE_TYPE
public static final String ZONE_NODE_TYPE
public static final String ATTACHMENTS_NODE_NAME
public static final String METADATA_SITE
public static final String METADATA_SITEMAP
public static final String METADATA_PUBLICATION_START_DATE
public static final String METADATA_PUBLICATION_END_DATE
public DefaultPage(Node node, String parentPath, F factory)
DefaultPage
.node
- the node backing this AmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- the DefaultPageFactory
which creates the
AmetysObject.public Set<String> getTags() throws AmetysRepositoryException
TagAwareAmetysObject
getTags
in interface TagAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void tag(String tag) throws AmetysRepositoryException
TaggableAmetysObject
tag
in interface TaggableAmetysObject
tag
- the tag to add.AmetysRepositoryException
- if an error occurs.public void untag(String tag) throws AmetysRepositoryException
TaggableAmetysObject
untag
in interface TaggableAmetysObject
tag
- the tag to remove.AmetysRepositoryException
- if an error occurs.public String getTitle() throws AmetysRepositoryException
Page
getTitle
in interface Page
AmetysRepositoryException
- if an error occurs.public void setTitle(String title) throws AmetysRepositoryException
ModifiablePage
setTitle
in interface ModifiablePage
title
- the title.AmetysRepositoryException
- if an error occurs.public String getLongTitle() throws AmetysRepositoryException
Page
getLongTitle
in interface Page
AmetysRepositoryException
- if an error occurs.public void setLongTitle(String title) throws AmetysRepositoryException
ModifiablePage
setLongTitle
in interface ModifiablePage
title
- the title.AmetysRepositoryException
- if an error occurs.public Sitemap getSitemap() throws AmetysRepositoryException
PagesContainer
getSitemap
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public int getDepth() throws AmetysRepositoryException
Page
getDepth
in interface Page
AmetysRepositoryException
- if an error occurs.public Site getSite() throws AmetysRepositoryException
SiteAwareAmetysObject
getSite
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getSiteName()
SiteAwareAmetysObject
getSiteName
in interface SiteAwareAmetysObject
public void setSiteName(String siteName)
ModifiablePage
setSiteName
in interface ModifiablePage
siteName
- the site name.public String getSitemapName() throws AmetysRepositoryException
PagesContainer
getSitemapName
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public void setSitemapName(String sitemapName) throws AmetysRepositoryException
ModifiablePage
setSitemapName
in interface ModifiablePage
sitemapName
- the sitemap name.AmetysRepositoryException
- if an error occurs.public String getPathInSitemap() throws AmetysRepositoryException
PagesContainer
getPathInSitemap
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public Page.PageType getType() throws AmetysRepositoryException
Page
getType
in interface Page
AmetysRepositoryException
- if an error occurs.Page.PageType
public void setType(Page.PageType type) throws AmetysRepositoryException
ModifiablePage
setType
in interface ModifiablePage
type
- the type.AmetysRepositoryException
- if an error occurs.Page.PageType
public String getURL() throws AmetysRepositoryException
Page
getURL
in interface Page
AmetysRepositoryException
- if an error occurs.public Page.LinkType getURLType() throws AmetysRepositoryException
Page
getURLType
in interface Page
AmetysRepositoryException
- if an error occurs.public void setURL(Page.LinkType type, String url) throws AmetysRepositoryException
ModifiablePage
setURL
in interface ModifiablePage
type
- the type of linkurl
- the linked URL (depending on the type)AmetysRepositoryException
- if an error occurs.public String getTemplate() throws AmetysRepositoryException
Page
getTemplate
in interface Page
null
if none has
been set.AmetysRepositoryException
- if an error occurs.public void setTemplate(String template) throws AmetysRepositoryException
ModifiablePage
setTemplate
in interface ModifiablePage
template
- the template name.AmetysRepositoryException
- if an error occurs.public AmetysObjectIterable<ModifiableZone> getZones() throws AmetysRepositoryException
ModifiablePage
getZones
in interface ModifiablePage
getZones
in interface Page
AmetysRepositoryException
- if an error occurs.public boolean hasZone(String name) throws AmetysRepositoryException
Page
hasZone
in interface Page
name
- The name of the zoneAmetysRepositoryException
- If an error occuredpublic ModifiableZone getZone(String name) throws UnknownZoneException, AmetysRepositoryException
ModifiablePage
getZone
in interface ModifiablePage
getZone
in interface Page
name
- the name of the zone.UnknownZoneException
- if there is no zone for the given name.AmetysRepositoryException
- if an error occurs.public ModifiableZone createZone(String name) throws AmetysRepositoryException
ModifiablePage
createZone
in interface ModifiablePage
name
- the name of the zone.AmetysRepositoryException
- if an error occurs.public ResourceCollection getRootAttachments() throws AmetysRepositoryException
Page
getRootAttachments
in interface Page
AmetysRepositoryException
- if an error occurs.public Set<String> getReferers() throws AmetysRepositoryException
Page
AmetysObject
ids referencing this page.getReferers
in interface Page
AmetysObject
ids referencing this page.AmetysRepositoryException
- if an error occurs.public void addReferer(String ametysObjectId) throws AmetysRepositoryException
ModifiablePage
AmetysObject
referencing this page.addReferer
in interface ModifiablePage
ametysObjectId
- the AmetysObject
ids referencing this page.AmetysRepositoryException
- if an error occurs.public void removeReferer(String ametysObjectId) throws AmetysRepositoryException
ModifiablePage
AmetysObject
referencing this page.removeReferer
in interface ModifiablePage
ametysObjectId
- the AmetysObject
ids referencing this page.AmetysRepositoryException
- if an error occurs.public AmetysObjectIterable<? extends Page> getChildrenPages() throws AmetysRepositoryException
PagesContainer
getChildrenPages
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public AmetysObjectIterable<? extends Page> getChildrenPages(boolean includeInvisiblePage) throws AmetysRepositoryException
PagesContainer
getChildrenPages
in interface PagesContainer
includeInvisiblePage
- true to include invisible pagesAmetysRepositoryException
- if an error occurs.public Page getChildPageAt(int index) throws UnknownAmetysObjectException, AmetysRepositoryException
PagesContainer
Page
at the given positiongetChildPageAt
in interface PagesContainer
index
- the position of the Page
within the ordered set of its sibling objects.Page
if foundUnknownAmetysObjectException
- if no child page was found at this positionAmetysRepositoryException
- if an error occurspublic DefaultPage copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
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 of CopiableAmetysObject
authorized to be copiedAmetysRepositoryException
- if an error occurs.public DefaultPage copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
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 objectAmetysRepositoryException
- if an error occurs.public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException
MovableAmetysObject
moveTo
in interface MovableAmetysObject
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 existAmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if a page with the same name already exists.public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
MovableAmetysObject
canMoveTo
in interface MovableAmetysObject
newParent
- See moveTo.AmetysRepositoryException
- if an error occurs.public void orderBefore(AmetysObject siblingNode) throws AmetysRepositoryException
MovableAmetysObject
orderBefore
in interface MovableAmetysObject
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.AmetysRepositoryException
- if an error occurs.public boolean isVisible() throws AmetysRepositoryException
Page
isVisible
in interface Page
AmetysRepositoryException
- if an error occurs.public void setVisible(boolean isVisible) throws AmetysRepositoryException
ModifiablePage
setVisible
in interface ModifiablePage
isVisible
- the page visibility.AmetysRepositoryException
- if an error occurs.public ModifiableModelLessDataHolder getDataHolder()
DataAwareAmetysObject
DataHolder
of this AmetysObject
.getDataHolder
in interface DataAwareAmetysObject
getDataHolder
in interface ModelLessDataAwareAmetysObject
getDataHolder
in interface ModifiableModelLessDataAwareAmetysObject
DataHolder
of this AmetysObject
public ModifiableCompositeMetadata getMetadataHolder()
SimpleAmetysObject
CompositeMetadata
of this AmetysObject
.getMetadataHolder
in interface MetadataAwareAmetysObject
getMetadataHolder
in interface ModifiableMetadataAwareAmetysObject
getMetadataHolder
in class SimpleAmetysObject<F extends DefaultPageFactory>
CompositeMetadata
of this AmetysObject