Package org.ametys.web.repository.site
Class Site
- All Implemented Interfaces:
ModelAwareDataAwareAmetysObject
,ModifiableModelAwareDataAwareAmetysObject
,IndexableDataHolder
,ModifiableIndexableDataHolder
,ACLAmetysObject
,ActivityHolder
,ActivityHolderAmetysObject
,AmetysObject
,CopiableAmetysObject
,DataAwareAmetysObject
,ModelAwareDataAwareAmetysObject
,ModifiableModelAwareDataAwareAmetysObject
,DataHolder
,ModelAwareDataHolder
,ModifiableDataHolder
,ModifiableModelAwareDataHolder
,JCRAmetysObject
,JCRTraversableAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,MovableAmetysObject
,RemovableAmetysObject
,TraversableAmetysObject
public final class Site
extends DefaultTraversableAmetysObject<SiteFactory>
implements MovableAmetysObject, CopiableAmetysObject, ModifiableModelAwareDataAwareAmetysObject, ActivityHolderAmetysObject
AmetysObject
for storing site informations.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Parameter name for project's site illustrationstatic final String
Site node type name.Fields inherited from interface org.ametys.plugins.repository.activities.ActivityHolder
ACTIVITIES_ROOT_NODE_NAME, ACTIVITY_NAME_PREFIX, JCR_UTC_FORMAT
Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIX
-
Constructor Summary
ConstructorDescriptionSite
(javax.jcr.Node node, String parentPath, SiteFactory factory) Creates aSite
. -
Method Summary
Modifier and TypeMethodDescriptionaddSitemap
(String lang) Add a sitemap language to the siteboolean
canMoveTo
(AmetysObject newParent) Test if a move can be a success or if it is impossible (e.g.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.Returns the activity holder holding the activitiesReturns the sites names.Returns all children sites, or empty if none.getColor()
Retrieves the colorRetrieves contents.Returns theDataHolder
of thisAmetysObject
.Retrieves the description.Returns the illustration of the siteReturns the parent site, if any.Retrieves resources.Returns theRestrictedPagePolicy
associated with this Site.Retrieves root contents.Get the root for pluginsRetrieves root resources.Returns the namedSite
.getSitemap
(String sitemapName) Retrieves a sitemap.Retrieves sitemaps.Returns the site pathReturns the skin id for this site.getTitle()
Retrieves the title.getType()
Retrieves the type.getUrl()
Retrieves the main url.String[]
Retrieves the url aliases.boolean
hasAncestor
(String siteName) Return true if the given site if an ancestorboolean
hasChildrenSite
(String siteName) Returns true if the given site exists.boolean
hasDescendant
(String siteName) Return true if the given site if a descendantboolean
hasSitemap
(String lang) Determines the existence of a sitemapvoid
illustrationToSAX
(ContentHandler contentHandler) Generates SAX events for the site's illustrationvoid
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
remove()
Removes thisAmetysObject
from the Ametys tree.void
setDescription
(String description) Set the description.void
setIllustration
(InputStream is, String mimeType, String filename, ZonedDateTime lastModificationDate) Set the illustration of the sitevoid
Set the skin id for this site.void
Set the title.void
Set the type.void
Set the url.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, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, 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.activities.ActivityHolder
addActivity
Methods inherited from interface org.ametys.plugins.repository.activities.ActivityHolderAmetysObject
addActivity, addActivity, getActivities
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
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
Methods inherited from interface org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject
getSystemPropertyExtensionPoint, indexData, indexData
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAXForEdition, getComments, getDataNames, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModel, getStatus, getValue, getValue, hasComments, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmpty
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
commentsToSAX, dataToJSON, dataToJSON, dataToJSON, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, getDataNames, getType, getValue, hasValue, hasValueOrEmpty, isMultiple
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryData
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
Methods inherited from interface org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolder
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getRepositoryData, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setComments, setExternalValue, setLocalValue, setStatus, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValues
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
Field Details
-
NODE_TYPE
Site node type name.- See Also:
-
ILLUSTRATION_PARAMETER
Parameter name for project's site illustration- See Also:
-
-
Constructor Details
-
Site
Creates aSite
.- Parameters:
node
- the node backing thisAmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- theSiteFactory
which creates the AmetysObject.
-
-
Method Details
-
getTitle
Retrieves the title.- Returns:
- the title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getType
Retrieves the type.- Returns:
- the type.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setType
Set the type.- Parameters:
type
- the type.- Throws:
AmetysRepositoryException
- if another error occurs.
-
setTitle
Set the title.- Parameters:
title
- the title.- Throws:
AmetysRepositoryException
- if another error occurs.
-
getDescription
Retrieves the description.- Returns:
- the description.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setDescription
Set the description.- Parameters:
description
- the description.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getUrl
Retrieves the main url.- Returns:
- the main url.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getUrlAliases
Retrieves the url aliases.- Returns:
- the url.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setUrl
Set the url.- Parameters:
url
- the url.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getColor
Retrieves the color- Returns:
- The color.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSitemap
public Sitemap getSitemap(String sitemapName) throws AmetysRepositoryException, UnknownAmetysObjectException Retrieves a sitemap.- Parameters:
sitemapName
- the sitemap name.- Returns:
- the sitemap found.
- Throws:
AmetysRepositoryException
- if an error occurs.UnknownAmetysObjectException
- if the object does not exist.
-
hasSitemap
Determines the existence of a sitemap- Parameters:
lang
- The sitemap language- Returns:
- true if the sitemap exists
- Throws:
AmetysRepositoryException
- if an error occurred
-
addSitemap
Add a sitemap language to the site- Parameters:
lang
- The sitemap language- Returns:
- The created sitemap
- Throws:
AmetysRepositoryException
- if an error occurred or if the sitemap already exists
-
getSitemaps
Retrieves sitemaps.- Returns:
- the sitemaps or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getRootContents
Retrieves root contents.- Returns:
- the root for contents
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getContents
Retrieves contents.- Returns:
- the contents or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getRootResources
Retrieves root resources.- Returns:
- the root for resources
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getResources
Retrieves resources.- Returns:
- the resources or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getRootPlugins
Get the root for plugins- Returns:
- the root for plugins
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setSkinId
Set the skin id for this site.- Parameters:
skinId
- ths skin id
-
getSkinId
Returns the skin id for this site.- Returns:
- the skin id for this site.
-
getParentSite
Returns the parent site, if any.- Returns:
- the parent site, if any.
-
getSitePath
Returns the site path- Returns:
- the site path
-
getRestrictedPagePolicy
Returns theRestrictedPagePolicy
associated with this Site.- Returns:
- the
RestrictedPagePolicy
associated with this Site.
-
getSite
Returns the namedSite
.- Parameters:
siteName
- the site name.- Returns:
- the named
Site
. - Throws:
UnknownAmetysObjectException
- if the named site does not exist.
-
hasAncestor
Return true if the given site if an ancestor- Parameters:
siteName
- the site name.- Returns:
- true if the given site if an ancestor
-
hasDescendant
Return true if the given site if a descendant- Parameters:
siteName
- the site name.- Returns:
- true if the given site if a descendant
-
hasChildrenSite
Returns true if the given site exists.- Parameters:
siteName
- the site name.- Returns:
- true if the given site exists.
-
getChildrenSiteNames
Returns the sites names.- Returns:
- the sites names.
-
getChildrenSites
Returns all children sites, or empty if none.- Returns:
- all children sites, or empty if none.
- Throws:
AmetysRepositoryException
- if an error occurs
-
getIllustration
Returns the illustration of the site- Returns:
- the illustration of the site
-
illustrationToSAX
Generates SAX events for the site's illustration- Parameters:
contentHandler
- theContentHandler
that will receive the SAX events- Throws:
SAXException
- if error occurs during the SAX events generationIOException
- if an I/O error occurs while reading the illustration
-
setIllustration
public void setIllustration(InputStream is, String mimeType, String filename, ZonedDateTime lastModificationDate) throws IOException Set the illustration of the site- Parameters:
is
- The input stream of the illustrationmimeType
- The mime type of the illustrationfilename
- The filename of the illustrationlastModificationDate
- The last modification date of the illustration- Throws:
IOException
- if an error occurs while setting the illustration
-
remove
Description copied from interface:RemovableAmetysObject
Removes thisAmetysObject
from the Ametys tree.- Specified by:
remove
in interfaceRemovableAmetysObject
- Overrides:
remove
in classSimpleAmetysObject<SiteFactory>
- Throws:
AmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if thisAmetysObject
is referenced by another objects.
-
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.
-
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.
-
copyTo
public Site 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 AmetysObject 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.
-
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.
-
getDataHolder
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Specified by:
getDataHolder
in interfaceDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelAwareDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-
getActivityHolder
Description copied from interface:ActivityHolderAmetysObject
Returns the activity holder holding the activities- Specified by:
getActivityHolder
in interfaceActivityHolderAmetysObject
- Returns:
- the activity holder
- Throws:
javax.jcr.RepositoryException
- if failed to get activity holder node
-