public class OdfPageHandler extends AbstractLogEnabled implements Component, Initializable, Serviceable
Modifier and Type | Field and Description |
---|---|
protected CatalogsManager |
_catalogsManager
The ODF Catalog enumeration
|
protected ContentHelper |
_contentHelper
Content helper
|
protected ContentTypesHelper |
_contentTypesHelper
Content types helper
|
protected ContentTypeExtensionPoint |
_cTypeEP
The content type extension point.
|
protected Map<String,Map<String,Boolean>> |
_hasOdfRoot
For each site, indicate if an ODF root is present.
|
protected I18nUtils |
_i18nUtils
The i18n utils.
|
protected ServiceManager |
_manager
Avalon service manager
|
protected OdfClassificationHandler |
_odfClassificationHandler
Root orgunit provider
|
protected OdfReferenceTableHelper |
_odfReferenceTableHelper
Odf reference table helper
|
protected OdfProgramRestrictionManager |
_odfRestrictionsManager
Restriction manager
|
protected Map<String,Map<String,Map<String,Set<String>>>> |
_odfRootPages
The ODF root pages, indexed by workspace, site and sitemap name.
|
protected RootOrgUnitProvider |
_orgUnitProvider
Root orgunit provider
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected WorkspaceSelector |
_workspaceSelector
The workspace selector.
|
static String |
CATALOG_METADATA_NAME
Catalog metadata name.
|
static String |
LEVEL1_METADATA_NAME
First level metadata name.
|
static String |
LEVEL2_METADATA_NAME
Second level metadata name.
|
protected static List<String> |
NON_ELIGIBLE_CTYPES_FOR_LEVEL
Content types that are not eligible for first and second level
|
static String |
ROLE
The avalon role.
|
Constructor and Description |
---|
OdfPageHandler() |
Modifier and Type | Method and Description |
---|---|
protected Page |
_getOdfRootPage(String siteName,
String sitemapName)
Get the ODF root page.
|
protected Set<Page> |
_getOdfRootPages(String siteName,
String sitemapName)
Get the ODF root page.
|
void |
clearRootCache()
Clear the ODF root page cache.
|
void |
clearRootCache(String siteName,
String sitemapName)
Clear the ODF root page cache for a given site and language.
|
String |
computeLevelsPath(Page rootPage,
Program parentProgram)
Compute the path from the root odf page, representing the first and second level pages.
|
String |
decodeLevelValue(String value)
Decode level value used in a URI
|
String |
encodeLevelValue(String value)
Encode level value to be use into a URI.
|
String |
getCatalog(Page rootPage)
Get the catalog value of the ODF root page
|
Map<String,I18nizableText> |
getCatalogs()
Get the ODF catalogs
|
Map<String,MetadataDefinition> |
getEligibleMetadataForLevel()
Get the eligible enumerated metadata for ODF page level
|
Map<String,MetadataDefinition> |
getEnumeratedMetadata(String programContentTypeId,
boolean allowMultiple)
Get the enumerated metadata definition for the given content type.
|
String |
getLevel1Metadata(Page rootPage)
Get the first level metadata name.
|
String |
getLevel1Metadata(String siteName,
String sitemapName,
String catalog)
Get the first level metadata name.
|
String |
getLevel1PageName(Page rootPage,
Program program)
Get the name of the page of first level for a given program
|
Map<String,String> |
getLevel1Values(Page rootPage)
Get the first level metadata values (with translated label).
|
Map<String,String> |
getLevel1Values(String siteName,
String sitemapName,
String catalog)
Get the first level metadata values (with translated label).
|
String |
getLevel2Metadata(Page rootPage)
Get the second level metadata name.
|
String |
getLevel2Metadata(String siteName,
String sitemapName,
String catalog)
Get the second level metadata name.
|
String |
getLevel2PageName(Page rootPage,
Program program)
Get the name of the page of second level for a given program
|
Map<String,String> |
getLevel2Values(Page rootPage)
Get the second level metadata values (with translated label).
|
Map<String,String> |
getLevel2Values(String siteName,
String sitemapName,
String catalog)
Get the second level metadata values (with translated label).
|
Page |
getOdfRootPage(String siteName,
String sitemapName)
Get the first ODF root page.
|
Page |
getOdfRootPage(String siteName,
String sitemapName,
String catalogName)
Get ODF root page of a specific catalog.
|
List<String> |
getOdfRootPageIds(String siteName,
String sitemapName)
Get the id of ODF root pages
|
Set<Page> |
getOdfRootPages(String siteName,
String sitemapName)
Get the ODF root pages.
|
String |
getOrgunitIdFromUaiCode(Page rootPage,
String uaiCode)
Get the orgunit identifier given an uai code
|
String |
getPageName(ProgramItem item)
Returns the page's name of a
ProgramItem . |
String |
getProgramLevel1Value(Page rootPage,
Program program)
Get the first level value of a program by extracting and transforming the raw program value
|
String |
getProgramLevel2Value(Page rootPage,
Program program)
Get the second level value of a program by extracting and transforming the raw program value
|
String |
getProgramLevelValue(Program program,
String levelMetaPath)
Get the level value of a program by extracting and transforming the raw program value at the desired metadata path
|
AmetysObjectIterable<Program> |
getProgramsWithRestrictions(Page rootPage,
String level1,
String level2,
String programCode,
String programName)
Get the programs available for a ODF root page, taking account the site's restrictions
|
AmetysObjectIterable<Program> |
getProgramsWithRestrictions(Page rootPage,
String level1Metadata,
String level1,
String level2Metadata,
String level2,
String programCode,
String programName)
Get the programs available for a ODF root page, taking account the site's restrictions
|
boolean |
hasOdfRootPage(Site site)
Test if the given site has at least one sitemap with an odf root page.
|
void |
initialize() |
boolean |
isODFRootPage(Page page)
Determines if the page is a ODF root page
|
boolean |
isValidRestriction(Page rootPage,
Program program)
Determines if the program is part of the site restrictions
|
void |
service(ServiceManager serviceManager) |
getLogger, setLogger
public static final String LEVEL1_METADATA_NAME
public static final String LEVEL2_METADATA_NAME
public static final String CATALOG_METADATA_NAME
protected static final List<String> NON_ELIGIBLE_CTYPES_FOR_LEVEL
protected AmetysObjectResolver _resolver
protected I18nUtils _i18nUtils
protected ContentTypeExtensionPoint _cTypeEP
protected CatalogsManager _catalogsManager
protected WorkspaceSelector _workspaceSelector
protected Map<String,Map<String,Map<String,Set<String>>>> _odfRootPages
protected Map<String,Map<String,Boolean>> _hasOdfRoot
protected ServiceManager _manager
protected OdfProgramRestrictionManager _odfRestrictionsManager
protected ContentTypesHelper _contentTypesHelper
protected ContentHelper _contentHelper
protected OdfReferenceTableHelper _odfReferenceTableHelper
protected RootOrgUnitProvider _orgUnitProvider
protected OdfClassificationHandler _odfClassificationHandler
public OdfPageHandler()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public Page getOdfRootPage(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- The site namesitemapName
- The sitemap's nameAmetysRepositoryException
- if an error occurspublic Page getOdfRootPage(String siteName, String sitemapName, String catalogName) throws AmetysRepositoryException
siteName
- The site namesitemapName
- The sitemap namecatalogName
- The catalog nameAmetysRepositoryException
- if an error occurspublic List<String> getOdfRootPageIds(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- The site namesitemapName
- The sitemap nameAmetysRepositoryException
- if an error occurs.public Set<Page> getOdfRootPages(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- the current site.sitemapName
- the current sitemap/language.AmetysRepositoryException
- if an error occurs.public boolean hasOdfRootPage(Site site)
site
- the site to test.public boolean isValidRestriction(Page rootPage, Program program)
rootPage
- The ODF root pageprogram
- The programtrue
the program is part of the site restrictionspublic void clearRootCache()
public void clearRootCache(String siteName, String sitemapName)
siteName
- the current site.sitemapName
- the current sitemap/language.public boolean isODFRootPage(Page page)
page
- The page to testprotected Page _getOdfRootPage(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- the current site.sitemapName
- the current sitemap/language.AmetysRepositoryException
- if an error occurs.protected Set<Page> _getOdfRootPages(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- the current site.sitemapName
- the current sitemap/language.AmetysRepositoryException
- if an error occurs.public String getCatalog(Page rootPage)
rootPage
- The ODF root pagepublic String getLevel1Metadata(String siteName, String sitemapName, String catalog)
siteName
- the site name.sitemapName
- the sitemap name.catalog
- the current selected catalog.public String getLevel1Metadata(Page rootPage)
rootPage
- the ODF root page.public String getLevel2Metadata(String siteName, String sitemapName, String catalog)
siteName
- the site name.sitemapName
- the sitemap name.catalog
- the current selected catalog.public String getLevel2Metadata(Page rootPage)
rootPage
- the ODF root page.public Map<String,String> getLevel1Values(String siteName, String sitemapName, String catalog)
siteName
- the site name.sitemapName
- the sitemap name.catalog
- the current selected catalog.public String getProgramLevelValue(Program program, String levelMetaPath)
program
- The programlevelMetaPath
- The desired metadata path that represent a levelpublic String getProgramLevel1Value(Page rootPage, Program program)
rootPage
- The root pageprogram
- The programnull
if not foundpublic String getProgramLevel2Value(Page rootPage, Program program)
rootPage
- The root pageprogram
- The programnull
if not foundpublic String getLevel1PageName(Page rootPage, Program program)
rootPage
- The ODF root pageprogram
- The programpublic String getLevel2PageName(Page rootPage, Program program)
rootPage
- The ODF root pageprogram
- The programpublic String getOrgunitIdFromUaiCode(Page rootPage, String uaiCode)
rootPage
- Odf root pageuaiCode
- The uai codepublic AmetysObjectIterable<Program> getProgramsWithRestrictions(Page rootPage, String level1, String level2, String programCode, String programName)
rootPage
- The ODF root pagelevel1
- filters results with a level1 value. Can be null.level2
- filters results with a level2 value. Can be null.programCode
- expected program code. Can be null.programName
- expected program name. Can be null.public AmetysObjectIterable<Program> getProgramsWithRestrictions(Page rootPage, String level1Metadata, String level1, String level2Metadata, String level2, String programCode, String programName)
rootPage
- The ODF root pagelevel1Metadata
- metadata name for first levellevel1
- filters results with a level1 value. Can be null.level2Metadata
- metadata name for second levellevel2
- filters results with a level2 value. Can be null.programCode
- expected program code. Can be null.programName
- expected program name. Can be null.public Map<String,String> getLevel1Values(Page rootPage)
rootPage
- the ODF root page.public Map<String,String> getLevel2Values(String siteName, String sitemapName, String catalog)
siteName
- the site name.sitemapName
- the sitemap name.catalog
- the current selected catalog.public Map<String,String> getLevel2Values(Page rootPage)
rootPage
- the ODF root page.public String encodeLevelValue(String value)
value
- The raw valuepublic String decodeLevelValue(String value)
value
- The encoded valuepublic String getPageName(ProgramItem item)
item
- The program itemIllegalArgumentException
- if the program item is not a AbstractProgram
nor a Course
.public Map<String,MetadataDefinition> getEligibleMetadataForLevel()
public Map<String,I18nizableText> getCatalogs()
public Map<String,MetadataDefinition> getEnumeratedMetadata(String programContentTypeId, boolean allowMultiple)
programContentTypeId
- The content type's idallowMultiple
- true
true to allow multiple metadatapublic String computeLevelsPath(Page rootPage, Program parentProgram)
rootPage
- The odf root pageparentProgram
- The program to compute