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
FieldsModifier and TypeFieldDescriptionstatic final StringParameter name for project's site illustrationstatic final StringSite node type name.Fields inherited from interface org.ametys.plugins.repository.activities.ActivityHolder
ACTIVITIES_ROOT_NODE_NAME, ACTIVITY_NAME_PREFIX, JCR_UTC_FORMATFields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, STATUS_SUFFIX -
Constructor Summary
ConstructorsConstructorDescriptionSite(javax.jcr.Node node, String parentPath, SiteFactory factory) Creates aSite. -
Method Summary
Modifier and TypeMethodDescriptionaddSitemap(String lang) Add a sitemap language to the sitebooleancanMoveTo(AmetysObject newParent) Test if a move can be a success or if it is impossible (e.g.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.Returns the activity holder holding the activitiesReturns the sites names.Returns all children sites, or empty if none.getColor()Retrieves the colorRetrieves contents.Returns theDataHolderof thisAmetysObject.Retrieves the description.Returns the illustration of the siteReturns the parent site, if any.Retrieves resources.Returns theRestrictedPagePolicyassociated 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.booleanhasAncestor(String siteName) Return true if the given site if an ancestorbooleanhasChildrenSite(String siteName) Returns true if the given site exists.booleanhasDescendant(String siteName) Return true if the given site if a descendantbooleanhasSitemap(String lang) Determines the existence of a sitemapvoidillustrationToSAX(ContentHandler contentHandler) Generates SAX events for the site's illustrationvoidmoveTo(AmetysObject newParent, boolean renameIfExist) Move the current object as a new child of the given object.voidorderBefore(AmetysObject siblingNode) Order a node before another sibling node (or as the last node)voidremove()Removes thisAmetysObjectfrom the Ametys tree.voidsetDescription(String description) Set the description.voidsetIllustration(InputStream is, String mimeType, String filename, ZonedDateTime lastModificationDate) Set the illustration of the sitevoidSet the skin id for this site.voidSet the title.voidSet the type.voidSet 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, removeDeniedUsersMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, 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.activities.ActivityHolder
addActivityMethods inherited from interface org.ametys.plugins.repository.activities.ActivityHolderAmetysObject
addActivity, addActivity, getActivitiesMethods 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, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAXMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject
getSystemPropertyExtensionPoint, indexData, indexDataMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAXForEdition, getDataNames, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModel, getStatus, getValue, getValue, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
dataToJSON, dataToJSON, dataToJSON, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, getDataNames, getType, getValue, hasValue, hasValueOrEmpty, isMultipleMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryDataMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolderMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getRepositoryData, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setExternalValue, setLocalValue, setStatus, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValuesMethods 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- theSiteFactorywhich 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 theRestrictedPagePolicyassociated with this Site.- Returns:
- the
RestrictedPagePolicyassociated 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- theContentHandlerthat 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:RemovableAmetysObjectRemoves thisAmetysObjectfrom the Ametys tree.- Specified by:
removein interfaceRemovableAmetysObject- Overrides:
removein classSimpleAmetysObject<SiteFactory>- Throws:
AmetysRepositoryException- if an error occurs.RepositoryIntegrityViolationException- if thisAmetysObjectis referenced by another objects.
-
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.
-
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.
-
copyTo
public Site 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 AmetysObject 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.
-
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.
-
getDataHolder
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelAwareDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
getActivityHolder
Description copied from interface:ActivityHolderAmetysObjectReturns the activity holder holding the activities- Specified by:
getActivityHolderin interfaceActivityHolderAmetysObject- Returns:
- the activity holder
- Throws:
javax.jcr.RepositoryException- if failed to get activity holder node
-