public final class Site extends DefaultTraversableAmetysObject<SiteFactory> implements MovableAmetysObject, CopiableAmetysObject, ModifiableModelAwareDataAwareAmetysObject
AmetysObject for storing site informations.| Modifier and Type | Field and Description |
|---|---|
private static String |
__COLOR_ATTRIBUTE
Constants for color metadata.
|
private static String |
__CONTENTS_NODE_NAME
Constants for contents node name.
|
private static String |
__DESCRIPTION_ATTRIBUTE
Constants for description metadata.
|
private static String |
__DISPLAY_RESTRICTED_PAGES_ATTRIBUTE
Constants for restricted page policy metadata.
|
private static String |
__ILLUSTRATION_ATTRIBUTE
Metadata name for project's site illustration
|
private static String |
__PLUGINS_NODE_NAME
Constants for plugins node name.
|
private static String |
__RESOURCES_NODE_NAME
Constants for resources node name.
|
private static String |
__SITEMAPS_NODE_NAME
Constants for sitemaps node name.
|
private static String |
__SKIN_ATTRIBUTE
Constants for skin metadata.
|
private static String |
__TITLE_ATTRIBUTE
Constants for title metadata.
|
private static String |
__TYPE_ATTRIBUTE
Constants for type metadata.
|
private static String |
__URL_ATTRIBUTE
Constants for URL metadata.
|
static String |
NODE_TYPE
Site node type name.
|
| Constructor and Description |
|---|
Site(Node node,
String parentPath,
SiteFactory factory)
Creates a
Site. |
| Modifier and Type | Method and Description |
|---|---|
private String[] |
_getHashedPath(String name) |
private Node |
_getParentNode(ModifiableTraversableAmetysObject parent,
String siteName) |
Sitemap |
addSitemap(String lang)
Add a sitemap language to the site
|
boolean |
canMoveTo(AmetysObject newParent)
Test if a move can be a success or if it is impossible (e.g.
|
Site |
copyTo(ModifiableTraversableAmetysObject parent,
String name)
Copy the current
AmetysObject to the given object. |
AmetysObject |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
List<String> restrictTo)
Copy the current
AmetysObject to the given object if it is not in the restriction list. |
Collection<String> |
getChildrenSiteNames()
Returns the sites names.
|
AmetysObjectIterable<Site> |
getChildrenSites()
Returns all children sites, or empty if none.
|
String |
getColor()
Retrieves the color
|
AmetysObjectIterable<Content> |
getContents()
Retrieves contents.
|
ModifiableModelAwareDataHolder |
getDataHolder()
Returns the
DataHolder of this AmetysObject. |
String |
getDescription()
Retrieves the description.
|
BinaryMetadata |
getIllustration()
Returns the illustration of the site
|
Site |
getParentSite()
Returns the parent site, if any.
|
AmetysObjectIterable<AmetysObject> |
getResources()
Retrieves resources.
|
RestrictedPagePolicy |
getRestrictedPagePolicy()
Returns the
RestrictedPagePolicy associated with this Site. |
ModifiableTraversableAmetysObject |
getRootContents()
Retrieves root contents.
|
ModifiableTraversableAmetysObject |
getRootPlugins()
Get the root for plugins
|
ModifiableTraversableAmetysObject |
getRootResources()
Retrieves root resources.
|
Site |
getSite(String siteName)
Returns the named
Site. |
Sitemap |
getSitemap(String sitemapName)
Retrieves a sitemap.
|
AmetysObjectIterable<Sitemap> |
getSitemaps()
Retrieves sitemaps.
|
String |
getSitePath()
Returns the site path
|
String |
getSkinId()
Returns the skin id for this site.
|
String |
getTitle()
Retrieves the title.
|
String |
getType()
Retrieves the type.
|
String |
getUrl()
Retrieves the main url.
|
String[] |
getUrlAliases()
Retrieves the url aliases.
|
boolean |
hasAncestor(String siteName)
Return true if the given site if an ancestor
|
boolean |
hasChildrenSite(String siteName)
Returns true if the given site exists.
|
boolean |
hasDescendant(String siteName)
Return true if the given site if a descendant
|
boolean |
hasSitemap(String lang)
Determines the existence of a sitemap
|
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 |
remove()
Removes this
AmetysObject from the Ametys tree. |
void |
setDescription(String description)
Set the description.
|
void |
setIllustration(InputStream is,
String mimeType,
String filename,
Date lastModifiedDate)
Set the illustration of the site
|
void |
setSkinId(String skinId)
Set the skin id for this site.
|
void |
setTitle(String title)
Set the title.
|
void |
setType(String type)
Set the type.
|
void |
setUrl(String url)
Set the url.
|
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, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, rename, revertChanges, saveChangesequals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetComposite, getComposite, getRepeater, getRepeater, removeValue, setValuegetType, getValue, getValue, hasValue, isMultiplecopyTo, getDataNamesequals, getId, getName, getParent, getParentPath, getPath, hashCodetoSAX, toSAXdataToSAX, dataToSAX, dataToSAX, dataToSAXgetNodegetMetadataHolderneedsSave, rename, revertChanges, saveChangesgetChildAt, getChildPositionpublic static final String NODE_TYPE
private static final String __TITLE_ATTRIBUTE
private static final String __TYPE_ATTRIBUTE
private static final String __DESCRIPTION_ATTRIBUTE
private static final String __URL_ATTRIBUTE
private static final String __COLOR_ATTRIBUTE
private static final String __SKIN_ATTRIBUTE
private static final String __DISPLAY_RESTRICTED_PAGES_ATTRIBUTE
private static final String __ILLUSTRATION_ATTRIBUTE
private static final String __SITEMAPS_NODE_NAME
private static final String __CONTENTS_NODE_NAME
private static final String __RESOURCES_NODE_NAME
private static final String __PLUGINS_NODE_NAME
public Site(Node node, String parentPath, SiteFactory factory)
Site.node - the node backing this AmetysObject.parentPath - the parent path in the Ametys hierarchy.factory - the SiteFactory which creates the AmetysObject.public String getTitle() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public String getType() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public void setType(String type) throws AmetysRepositoryException
type - the type.AmetysRepositoryException - if another error occurs.public void setTitle(String title) throws AmetysRepositoryException
title - the title.AmetysRepositoryException - if another error occurs.public String getDescription() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public void setDescription(String description) throws AmetysRepositoryException
description - the description.AmetysRepositoryException - if an error occurs.public String getUrl() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public String[] getUrlAliases() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public void setUrl(String url) throws AmetysRepositoryException
url - the url.AmetysRepositoryException - if an error occurs.public String getColor() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public Sitemap getSitemap(String sitemapName) throws AmetysRepositoryException, UnknownAmetysObjectException
sitemapName - the sitemap name.AmetysRepositoryException - if an error occurs.UnknownAmetysObjectException - if the object does not exist.public boolean hasSitemap(String lang) throws AmetysRepositoryException
lang - The sitemap languageAmetysRepositoryException - if an error occurredpublic Sitemap addSitemap(String lang) throws AmetysRepositoryException
lang - The sitemap languageAmetysRepositoryException - if an error occurred or if the sitemap already existspublic AmetysObjectIterable<Sitemap> getSitemaps() throws AmetysRepositoryException
AmetysObjectIterable.AmetysRepositoryException - if an error occurs.public ModifiableTraversableAmetysObject getRootContents() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public AmetysObjectIterable<Content> getContents() throws AmetysRepositoryException
AmetysObjectIterable.AmetysRepositoryException - if an error occurs.public ModifiableTraversableAmetysObject getRootResources() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public AmetysObjectIterable<AmetysObject> getResources() throws AmetysRepositoryException
AmetysObjectIterable.AmetysRepositoryException - if an error occurs.public ModifiableTraversableAmetysObject getRootPlugins() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.public void setSkinId(String skinId)
skinId - ths skin idpublic String getSkinId()
public Site getParentSite()
public String getSitePath()
public RestrictedPagePolicy getRestrictedPagePolicy()
RestrictedPagePolicy associated with this Site.RestrictedPagePolicy associated with this Site.public Site getSite(String siteName) throws UnknownAmetysObjectException
Site.siteName - the site name.Site.UnknownAmetysObjectException - if the named site does not exist.public boolean hasAncestor(String siteName)
siteName - the site name.public boolean hasDescendant(String siteName)
siteName - the site name.public boolean hasChildrenSite(String siteName)
siteName - the site name.public Collection<String> getChildrenSiteNames()
public AmetysObjectIterable<Site> getChildrenSites() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurspublic BinaryMetadata getIllustration()
public void setIllustration(InputStream is, String mimeType, String filename, Date lastModifiedDate)
is - The input stream of the illustrationmimeType - The mimetype of the illustrationfilename - The filename of the illustrationlastModifiedDate - The last modified date of the illustrationpublic void remove() throws AmetysRepositoryException, RepositoryIntegrityViolationException
RemovableAmetysObjectAmetysObject from the Ametys tree.remove in interface RemovableAmetysObjectremove in class SimpleAmetysObject<SiteFactory>AmetysRepositoryException - if an error occurs.RepositoryIntegrityViolationException - if this AmetysObject is referenced by another objects.public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
MovableAmetysObjectcanMoveTo in interface MovableAmetysObjectnewParent - See moveTo.AmetysRepositoryException - if an error occurs.public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException
MovableAmetysObjectmoveTo in interface MovableAmetysObjectnewParent - 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 Site copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
CopiableAmetysObjectAmetysObject to the given object. Be careful, this method save changes.copyTo in interface CopiableAmetysObjectparent - 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 AmetysObject copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
CopiableAmetysObjectAmetysObject to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo in interface CopiableAmetysObjectparent - 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.private Node _getParentNode(ModifiableTraversableAmetysObject parent, String siteName) throws AmetysRepositoryException
AmetysRepositoryExceptionprivate String[] _getHashedPath(String name)
public void orderBefore(AmetysObject siblingNode) throws AmetysRepositoryException
MovableAmetysObjectorderBefore in interface MovableAmetysObjectsiblingNode - 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 ModifiableModelAwareDataHolder getDataHolder()
DataAwareAmetysObjectDataHolder of this AmetysObject.getDataHolder in interface DataAwareAmetysObjectgetDataHolder in interface ModelAwareDataAwareAmetysObjectgetDataHolder in interface ModifiableModelAwareDataAwareAmetysObjectDataHolder of this AmetysObject