public class CoursePage extends Object implements Page
Modifier and Type | Class and Description |
---|---|
(package private) static class |
CoursePage.CourseListTraverser |
Page.LinkType, Page.PageType
Modifier and Type | Field and Description |
---|---|
private Course |
_course |
private OdfPageHandler |
_odfPageHandler |
private Page |
_parentPage |
private Program |
_parentProgram |
private String |
_path |
private AmetysObjectResolver |
_resolver |
private Page |
_root |
Constructor and Description |
---|
CoursePage(AmetysObjectResolver resolver,
OdfPageHandler odfPageHandler,
Page root,
Course course,
Program parentProgram,
String path,
Page parentPage)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) String |
_computeLevelsPath()
Compute the path from the root odf page, representing the first and second level pages.
|
private boolean |
_filterByPageName(Course course,
String pageName) |
private CoursePage |
_toCoursePage(Course course) |
private Stream<Course> |
_traverseCourseLists() |
<A extends AmetysObject> |
getChild(String path)
Retrieves a given child from its relative path.
|
Page |
getChildPageAt(int index)
Gets the child
Page at the given position |
AmetysObjectIterable<? extends Page> |
getChildren()
Retrieves children of the current object.
|
AmetysObjectIterable<? extends Page> |
getChildrenPages()
Retrieves child pages.
|
AmetysObjectIterable<? extends Page> |
getChildrenPages(boolean includeInvisiblePages)
Retrieves child pages.
|
Course |
getCourse()
Returns the associated
Course . |
int |
getDepth()
Get the page depth
|
String |
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.
|
CompositeMetadata |
getMetadataHolder()
Returns the root
CompositeMetadata of this AmetysObject . |
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 |
getPath()
Retrieves the path of the current object.
|
String |
getPathInSitemap()
Computes the path relative to the current sitemap.
|
Set<String> |
getReferers()
Retrieves all
AmetysObject ids referencing this page. |
ResourceCollection |
getRootAttachments()
Retrieves the attachments root node
|
Site |
getSite()
Returns this object's site.
|
Sitemap |
getSitemap()
Retrieves the sitemap containing the current sitemap.
|
String |
getSitemapName()
Returns this page's sitemap name
|
String |
getSiteName()
Returns this object's site name.
|
Set<String> |
getTags()
Retrieves current tags.
|
String |
getTemplate()
Retrieves the template name.
|
String |
getTitle()
Retrieves the title.
|
Page.PageType |
getType()
Retrieves the type.
|
String |
getURL()
Retrieves the linked URL.
|
Page.LinkType |
getURLType()
Retrieves the linked URL type.
|
Zone |
getZone(String name)
Retrieves a given zone.
|
AmetysObjectIterable<? extends Zone> |
getZones()
Retrieves the zones.
|
boolean |
hasChild(String name)
Tests if this Object has at least one child with the given name.
|
boolean |
hasZone(String name)
Determine if a zone exists
|
boolean |
isVisible()
Determine if the page is visible into navigation elements
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildAt, getChildPosition
equals, hashCode
private AmetysObjectResolver _resolver
private OdfPageHandler _odfPageHandler
private Page _parentPage
private Program _parentProgram
public CoursePage(AmetysObjectResolver resolver, OdfPageHandler odfPageHandler, Page root, Course course, Program parentProgram, String path, Page parentPage)
resolver
- the AmetysObjectResolver
.odfPageHandler
- the OdfPageHandler
to handle ODF pages.root
- the odf root page.course
- the course.parentProgram
- the parent programpath
- path from the parent ProgramPage
parentPage
- the parent Page
or null if not yet computed.String _computeLevelsPath()
public int getDepth() throws AmetysRepositoryException
Page
getDepth
in interface Page
AmetysRepositoryException
- if an error occurs.public Set<String> getReferers() throws AmetysRepositoryException
Page
AmetysObject
ids referencing this page.getReferers
in interface Page
AmetysObject
ids referencing this page.AmetysRepositoryException
- if an error occurs.public ResourceCollection getRootAttachments() throws AmetysRepositoryException
Page
getRootAttachments
in interface Page
AmetysRepositoryException
- if an error occurs.public String getTemplate() throws AmetysRepositoryException
Page
getTemplate
in interface Page
null
if none has
been set.AmetysRepositoryException
- if an error occurs.public String getTitle() throws AmetysRepositoryException
Page
getTitle
in interface Page
AmetysRepositoryException
- if an error occurs.public String getLongTitle() throws AmetysRepositoryException
Page
getLongTitle
in interface Page
AmetysRepositoryException
- if an error occurs.public Page.PageType getType() throws AmetysRepositoryException
Page
getType
in interface Page
AmetysRepositoryException
- if an error occurs.Page.PageType
public String getURL() throws AmetysRepositoryException
Page
getURL
in interface Page
AmetysRepositoryException
- if an error occurs.public Page.LinkType getURLType() throws AmetysRepositoryException
Page
getURLType
in interface Page
AmetysRepositoryException
- if an error occurs.public Zone getZone(String name) throws UnknownZoneException, AmetysRepositoryException
Page
getZone
in interface Page
name
- the name of the zone.UnknownZoneException
- if there is no zone for the given name.AmetysRepositoryException
- if an error occurs.public AmetysObjectIterable<? extends Zone> getZones() throws AmetysRepositoryException
Page
getZones
in interface Page
AmetysRepositoryException
- if an error occurs.public boolean hasZone(String name) throws AmetysRepositoryException
Page
hasZone
in interface Page
name
- The name of the zoneAmetysRepositoryException
- If an error occuredpublic AmetysObjectIterable<? extends Page> getChildrenPages() throws AmetysRepositoryException
PagesContainer
getChildrenPages
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.private CoursePage _toCoursePage(Course course)
public String getPathInSitemap() throws AmetysRepositoryException
PagesContainer
getPathInSitemap
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public Site getSite() throws AmetysRepositoryException
SiteAwareAmetysObject
getSite
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getSiteName() throws AmetysRepositoryException
SiteAwareAmetysObject
getSiteName
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public Sitemap getSitemap() throws AmetysRepositoryException
PagesContainer
getSitemap
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public String getSitemapName() throws AmetysRepositoryException
PagesContainer
getSitemapName
in interface PagesContainer
AmetysRepositoryException
- if an error occurs.public <A extends AmetysObject> A getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException
TraversableAmetysObject
null
, empty nor begin with a '/'
.getChild
in interface TraversableAmetysObject
A
- the actual type of AmetysObject
.path
- the path of the child which can contains a position with.
[n]
if same name sibling is allowed.AmetysRepositoryException
- if an error occurs.UnknownAmetysObjectException
- if the object does not exist.private boolean _filterByPageName(Course course, String pageName)
public AmetysObjectIterable<? extends Page> getChildren() throws AmetysRepositoryException
TraversableAmetysObject
getChildren
in interface TraversableAmetysObject
AmetysObjectIterable
.AmetysRepositoryException
- if an error occurs.public boolean hasChild(String name) throws AmetysRepositoryException
TraversableAmetysObject
hasChild
in interface TraversableAmetysObject
name
- the name to test. Cannot be null
nor empty nor
begin with a '/'
and it cannot contain '/'
.true
if the named child exists,
false
otherwise.AmetysRepositoryException
- if an error occurs.public String getId() throws AmetysRepositoryException
AmetysObject
<protocol>://<protocol-specific-part>
getId
in interface AmetysObject
AmetysRepositoryException
- if an error occurs.public String getName() throws AmetysRepositoryException
AmetysObject
getName
in interface AmetysObject
AmetysRepositoryException
- if an error occurs.public Page getParent() throws AmetysRepositoryException
AmetysObject
getParent
in interface AmetysObject
null
if current object
is the root.AmetysRepositoryException
- if an error occurs.public String getParentPath() throws AmetysRepositoryException
AmetysObject
getParentPath
in interface AmetysObject
AmetysRepositoryException
- if an error occurs.public String getPath() throws AmetysRepositoryException
AmetysObject
getPath
in interface AmetysObject
AmetysRepositoryException
- if an error occurs.public CompositeMetadata getMetadataHolder()
MetadataAwareAmetysObject
CompositeMetadata
of this AmetysObject
.getMetadataHolder
in interface MetadataAwareAmetysObject
CompositeMetadata
of this AmetysObject
public Set<String> getTags() throws AmetysRepositoryException
TagAwareAmetysObject
getTags
in interface TagAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public boolean isVisible() throws AmetysRepositoryException
Page
isVisible
in interface Page
AmetysRepositoryException
- if an error occurs.public AmetysObjectIterable<? extends Page> getChildrenPages(boolean includeInvisiblePages) throws AmetysRepositoryException
PagesContainer
getChildrenPages
in interface PagesContainer
includeInvisiblePages
- true to include invisible pagesAmetysRepositoryException
- if an error occurs.public Page getChildPageAt(int index) throws UnknownAmetysObjectException, AmetysRepositoryException
PagesContainer
Page
at the given positiongetChildPageAt
in interface PagesContainer
index
- the position of the Page
within the ordered set of its sibling objects.Page
if foundUnknownAmetysObjectException
- if no child page was found at this positionAmetysRepositoryException
- if an error occursprivate Stream<Course> _traverseCourseLists()