Class FirstLevelPage
- java.lang.Object
-
- org.ametys.plugins.odfweb.repository.AbstractOdfPage
-
- org.ametys.plugins.odfweb.repository.AbstractLevelPage
-
- org.ametys.plugins.odfweb.repository.FirstLevelPage
-
- All Implemented Interfaces:
TagAwareAmetysObject
,AmetysObject
,DataAwareAmetysObject
,ModelLessDataAwareAmetysObject
,DataHolder
,ModelLessDataHolder
,TraversableAmetysObject
,MetadataAwarePagesContainer
,Page
,PagesContainer
,SiteAwareAmetysObject
public class FirstLevelPage extends AbstractLevelPage
Page representing a first-level page.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.web.repository.page.Page
Page.LinkType, Page.PageType
-
-
Constructor Summary
Constructors Constructor Description FirstLevelPage(FirstLevelPageFactory factory, Page root, String name, String title)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Optional<Map.Entry<String,String>>
_findSecondLevelValueEntry(String levelCode)
private Optional<Map.Entry<String,String>>
_findSecondLevelValueEntry(Map<String,String> secondLevelValues, String levelCode)
private Optional<AmetysObjectIterable<Program>>
_getChildrenProgramPageFromCache()
private boolean
_hasSecondLevelPages()
private ProgramPage
_toProgramPage(Program program)
private SecondLevelPage
_toSecondLevelPage(Map.Entry<String,String> secondLevelValueEntry)
<A extends AmetysObject>
AgetChild(String path)
Retrieves a given child from its relative path.AmetysObjectIterable<? extends Page>
getChildren()
Retrieves children of the current object.AmetysObjectIterable<? extends Page>
getChildrenPages()
Retrieves child pages.ModelLessDataHolder
getDataHolder()
Returns theDataHolder
of thisAmetysObject
.int
getDepth()
Get the page depthString
getId()
Retrieves the unique identifier of this AmetysObject.
It must be unique in the whole repository and must never be null.
It must conform to the URI syntax:
<protocol>://<protocol-specific-part>
String
getLongTitle()
Retrieves the long title.String
getName()
Retrieves the name of the current object.Page
getParent()
Returns the parent object in the Ametys hierarchy.String
getParentPath()
Returns the path of the parent object in the Ametys hierarchy.String
getPathInSitemap()
Computes the path relative to the current sitemap.Site
getSite()
Returns this object's site.Sitemap
getSitemap()
Retrieves the sitemap containing the current sitemap.String
getSitemapName()
Returns this page's sitemap nameString
getSiteName()
Returns this object's site name.ModelAwareDataHolder
getTemplateParametersHolder()
Get the view parametersString
getTitle()
Retrieves the title.Zone
getZone(String name)
Retrieves a given zone.AmetysObjectIterable<? extends Zone>
getZones()
Retrieves the zones.boolean
hasChild(String childName)
Tests if this Object has at least one child with the given name.-
Methods inherited from class org.ametys.plugins.odfweb.repository.AbstractLevelPage
getTemplate
-
Methods inherited from class org.ametys.plugins.odfweb.repository.AbstractOdfPage
getChildPageAt, getChildrenPages, getPath, getReferers, getRootAttachments, getTags, getType, getURL, getURLType, hasZone, isVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, hashCode
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToSAX, getDataNames, getRepositoryData
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
dataToSAX
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToSAX, getComposite, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToSAX
-
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
-
-
-
Constructor Detail
-
FirstLevelPage
public FirstLevelPage(FirstLevelPageFactory factory, Page root, String name, String title)
Constructor.- Parameters:
factory
- the corresponding factoryroot
- the odf root page.name
- the page's name.title
- the page's title.
-
-
Method Detail
-
getDepth
public int getDepth() throws AmetysRepositoryException
Description copied from interface:Page
Get the page depth- Returns:
- the page depth
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTitle
public String getTitle() throws AmetysRepositoryException
Description copied from interface:Page
Retrieves the title.- Returns:
- the title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getLongTitle
public String getLongTitle() throws AmetysRepositoryException
Description copied from interface:Page
Retrieves the long title.- Returns:
- the title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getZone
public Zone getZone(String name) throws UnknownZoneException, AmetysRepositoryException
Description copied from interface:Page
Retrieves a given zone.- Parameters:
name
- the name of the zone.- Returns:
- the given zone.
- Throws:
UnknownZoneException
- if there is no zone for the given name.AmetysRepositoryException
- if an error occurs.
-
getZones
public AmetysObjectIterable<? extends Zone> getZones() throws AmetysRepositoryException
Description copied from interface:Page
Retrieves the zones.- Returns:
- the zones.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getChildrenPages
public AmetysObjectIterable<? extends Page> getChildrenPages() throws AmetysRepositoryException
Description copied from interface:PagesContainer
Retrieves child pages.- Returns:
- the child pages.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
_hasSecondLevelPages
private boolean _hasSecondLevelPages()
-
_getChildrenProgramPageFromCache
private Optional<AmetysObjectIterable<Program>> _getChildrenProgramPageFromCache()
-
_findSecondLevelValueEntry
private Optional<Map.Entry<String,String>> _findSecondLevelValueEntry(String levelCode)
-
_findSecondLevelValueEntry
private Optional<Map.Entry<String,String>> _findSecondLevelValueEntry(Map<String,String> secondLevelValues, String levelCode)
-
_toSecondLevelPage
private SecondLevelPage _toSecondLevelPage(Map.Entry<String,String> secondLevelValueEntry)
-
_toProgramPage
private ProgramPage _toProgramPage(Program program)
-
getPathInSitemap
public String getPathInSitemap() throws AmetysRepositoryException
Description copied from interface:PagesContainer
Computes the path relative to the current sitemap.- Returns:
- the path relative to the current sitemap.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSite
public Site getSite() throws AmetysRepositoryException
Description copied from interface:SiteAwareAmetysObject
Returns this object's site.- Returns:
- this object's site
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSiteName
public String getSiteName() throws AmetysRepositoryException
Description copied from interface:SiteAwareAmetysObject
Returns this object's site name.- Returns:
- this object's site name.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSitemap
public Sitemap getSitemap() throws AmetysRepositoryException
Description copied from interface:PagesContainer
Retrieves the sitemap containing the current sitemap.- Returns:
- the sitemap containing the current sitemap.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSitemapName
public String getSitemapName() throws AmetysRepositoryException
Description copied from interface:PagesContainer
Returns this page's sitemap name- Returns:
- this page's sitemap name
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getChild
public <A extends AmetysObject> A getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException
Description copied from interface:TraversableAmetysObject
Retrieves a given child from its relative path. The path cannot benull
, empty nor begin with a'/'
.- Type Parameters:
A
- the actual type ofAmetysObject
.- Parameters:
path
- the path of the child which can contains a position with.[n]
if same name sibling is allowed.- Returns:
- the child found.
- Throws:
AmetysRepositoryException
- if an error occurs.UnknownAmetysObjectException
- if the object does not exist.
-
getChildren
public AmetysObjectIterable<? extends Page> getChildren() throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObject
Retrieves children of the current object.- Specified by:
getChildren
in interfaceTraversableAmetysObject
- Overrides:
getChildren
in classAbstractOdfPage
- Returns:
- the children or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
hasChild
public boolean hasChild(String childName) throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObject
Tests if this Object has at least one child with the given name.- Parameters:
childName
- the name to test. Cannot benull
nor empty nor begin with a'/'
and it cannot contain'/'
.- Returns:
true
if the named child exists,false
otherwise.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getId
public String getId() throws AmetysRepositoryException
Description copied from interface:AmetysObject
Retrieves the unique identifier of this AmetysObject.
It must be unique in the whole repository and must never be null.
It must conform to the URI syntax:
<protocol>://<protocol-specific-part>
- Returns:
- the unique identifier of this AmetysObject
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getName
public String getName() throws AmetysRepositoryException
Description copied from interface:AmetysObject
Retrieves the name of the current object.- Returns:
- the name.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getParent
public Page getParent() throws AmetysRepositoryException
Description copied from interface:AmetysObject
Returns the parent object in the Ametys hierarchy.- Returns:
- the parent object or
null
if current object is the root. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getParentPath
public String getParentPath() throws AmetysRepositoryException
Description copied from interface:AmetysObject
Returns the path of the parent object in the Ametys hierarchy.- Returns:
- the path of the parent object.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDataHolder
public ModelLessDataHolder getDataHolder()
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Returns:
- the
DataHolder
of thisAmetysObject
-
getTemplateParametersHolder
public ModelAwareDataHolder getTemplateParametersHolder() throws AmetysRepositoryException
Description copied from interface:Page
Get the view parameters- Returns:
- the view parameters
- Throws:
AmetysRepositoryException
- if an error occurs.
-
-