Class ProgramPage
- java.lang.Object
-
- org.ametys.plugins.odfweb.repository.AbstractOdfPage
-
- org.ametys.plugins.odfweb.repository.ProgramPage
-
- All Implemented Interfaces:
TagAwareAmetysObject,AmetysObject,DataAwareAmetysObject,ModelLessDataAwareAmetysObject,DataHolder,ModelLessDataHolder,TraversableAmetysObject,MetadataAwarePagesContainer,Page,PagesContainer,SiteAwareAmetysObject
public class ProgramPage extends AbstractOdfPage
Page representing aProgramor aSubProgram.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classProgramPage.AbstractTreeIterator<T>Breadth first search iterator for tree structure Each node can provide an iterator that will be put in the end of the queue.(package private) static classProgramPage.ProgramPartTraverserProgram part traverser.-
Nested classes/interfaces inherited from interface org.ametys.web.repository.page.Page
Page.LinkType, Page.PageType
-
-
Field Summary
Fields Modifier and Type Field Description private ProgramPageFactory_factoryprivate Program_parentprivate Page_parentPageprivate String_pathprivate AbstractProgram_programprivate Page_root
-
Constructor Summary
Constructors Constructor Description ProgramPage(ProgramPageFactory factory, Page root, AbstractProgram program, String path, Program parent, Page parentPage)Constructor for program page holding aProgramorSubProgramProgramPage(ProgramPageFactory factory, Page root, Program program, Page parentPage)Constructor for program page holding aProgram.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) String_computeLevelsPath()Compute the path from the root odf page, representing the first and second level pages.private boolean_filterByName(ProgramItem programItem, String name)private Optional<ProgramItem>_findChild(TraversableProgramPart parent, String name)private Optional<Page>_getChildPage(TraversableProgramPart parent, String name)private CoursePage_toChildCoursePage(Course course)private Page_toChildPage(ProgramItem child)private ProgramPage_toChildProgramPage(SubProgram child)private Stream<ProgramItem>_traverseChildren(TraversableProgramPart parent)<A extends AmetysObject>
AgetChild(String path)Retrieves a given child from its relative path.AmetysObjectIterable<? extends Page>getChildrenPages()Retrieves child pages.ModelLessDataHoldergetDataHolder()Returns theDataHolderof thisAmetysObject.intgetDepth()Get the page depthStringgetId()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>StringgetLongTitle()Retrieves the long title.StringgetName()Retrieves the name of the current object.PagegetParent()Returns the parent object in the Ametys hierarchy.StringgetParentPath()Returns the path of the parent object in the Ametys hierarchy.(package private) ProgramgetParentProgram()StringgetPathInSitemap()Computes the path relative to the current sitemap.AbstractProgramgetProgram()Returns the associatedProgramorSubProgram.SitegetSite()Returns this object's site.SitemapgetSitemap()Retrieves the sitemap containing the current sitemap.StringgetSitemapName()Returns this page's sitemap nameStringgetSiteName()Returns this object's site name.StringgetTemplate()Retrieves the template name.ModelAwareDataHoldergetTemplateParametersHolder()Get the view parametersStringgetTitle()Retrieves the title.ZonegetZone(String name)Retrieves a given zone.AmetysObjectIterable<? extends Zone>getZones()Retrieves the zones.booleanhasChild(String name)Tests if this Object has at least one child with the given name.-
Methods inherited from class org.ametys.plugins.odfweb.repository.AbstractOdfPage
getChildPageAt, getChildren, 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, dataToSAX, getDataNames, getRepositoryData
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToSAX, getComposite, getParentDataHolder, getRootDataHolder, getType, getValue, getValue, getValueOfType, getValueOfType, hasNonEmptyValue, 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
-
-
-
-
Field Detail
-
_program
private AbstractProgram _program
-
_parentPage
private Page _parentPage
-
_factory
private ProgramPageFactory _factory
-
-
Constructor Detail
-
ProgramPage
public ProgramPage(ProgramPageFactory factory, Page root, Program program, Page parentPage)
Constructor for program page holding aProgram.- Parameters:
factory- The factoryroot- the ODF root page.program- the program.parentPage- the parentPageor null if not yet computed.
-
ProgramPage
public ProgramPage(ProgramPageFactory factory, Page root, AbstractProgram program, String path, Program parent, Page parentPage)
Constructor for program page holding aProgramorSubProgram- Parameters:
factory- The factoryroot- the ODF root page.program- the program or subprogram.path- The path from the virtual second level page. Can be null if abstract program is aProgramparent- the parent program in case of a subprogram, null otherwiseparentPage- the parentPageor null if not yet computed.
-
-
Method Detail
-
getProgram
public AbstractProgram getProgram()
Returns the associatedProgramorSubProgram.- Returns:
- the associated
ProgramorSubProgram.
-
getDepth
public int getDepth() throws AmetysRepositoryException
Description copied from interface:PageGet the page depth- Returns:
- the page depth
- Throws:
AmetysRepositoryException- if an error occurs.
-
getTemplate
public String getTemplate() throws AmetysRepositoryException
Description copied from interface:PageRetrieves the template name.- Returns:
- the template name or
nullif none has been set. - Throws:
AmetysRepositoryException- if an error occurs.
-
getTitle
public String getTitle() throws AmetysRepositoryException
Description copied from interface:PageRetrieves the title.- Returns:
- the title.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getLongTitle
public String getLongTitle() throws AmetysRepositoryException
Description copied from interface:PageRetrieves 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:PageRetrieves 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:PageRetrieves the zones.- Returns:
- the zones.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getChildrenPages
public AmetysObjectIterable<? extends Page> getChildrenPages() throws AmetysRepositoryException
Description copied from interface:PagesContainerRetrieves child pages.- Returns:
- the child pages.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getPathInSitemap
public String getPathInSitemap() throws AmetysRepositoryException
Description copied from interface:PagesContainerComputes the path relative to the current sitemap.- Returns:
- the path relative to the current sitemap.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getParentProgram
Program getParentProgram()
-
_computeLevelsPath
String _computeLevelsPath()
Compute the path from the root odf page, representing the first and second level pages.- Returns:
- the path
-
getSite
public Site getSite() throws AmetysRepositoryException
Description copied from interface:SiteAwareAmetysObjectReturns 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:SiteAwareAmetysObjectReturns 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:PagesContainerRetrieves 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:PagesContainerReturns 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:TraversableAmetysObjectRetrieves 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.
-
_getChildPage
private Optional<Page> _getChildPage(TraversableProgramPart parent, String name)
-
_findChild
private Optional<ProgramItem> _findChild(TraversableProgramPart parent, String name)
-
_filterByName
private boolean _filterByName(ProgramItem programItem, String name)
-
_toChildPage
private Page _toChildPage(ProgramItem child)
-
_toChildProgramPage
private ProgramPage _toChildProgramPage(SubProgram child)
-
_toChildCoursePage
private CoursePage _toChildCoursePage(Course course)
-
hasChild
public boolean hasChild(String name) throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObjectTests if this Object has at least one child with the given name.- Parameters:
name- the name to test. Cannot benullnor empty nor begin with a'/'and it cannot contain'/'.- Returns:
trueif the named child exists,falseotherwise.- Throws:
AmetysRepositoryException- if an error occurs.
-
getId
public String getId() throws AmetysRepositoryException
Description copied from interface:AmetysObjectRetrieves 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:AmetysObjectRetrieves 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:AmetysObjectReturns the parent object in the Ametys hierarchy.- Returns:
- the parent object or
nullif current object is the root. - Throws:
AmetysRepositoryException- if an error occurs.
-
getParentPath
public String getParentPath() throws AmetysRepositoryException
Description copied from interface:AmetysObjectReturns 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:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Returns:
- the
DataHolderof thisAmetysObject
-
_traverseChildren
private Stream<ProgramItem> _traverseChildren(TraversableProgramPart parent)
-
getTemplateParametersHolder
public ModelAwareDataHolder getTemplateParametersHolder() throws AmetysRepositoryException
Description copied from interface:PageGet the view parameters- Returns:
- the view parameters
- Throws:
AmetysRepositoryException- if an error occurs.
-
-