public class OdfClassificationHandler 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 I18nUtils |
_i18nUtils
The i18n utils.
|
protected Map<String,Map<String,String>> |
_levelValuesCache
Level values cache.
|
protected ServiceManager |
_manager
Avalon service manager
|
protected OdfReferenceTableHelper |
_odfReferenceTableHelper
Odf reference table helper
|
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.
|
protected static String |
DEFAULT_LEVEL1_METADATA
The default level 1 metadata.
|
protected static String |
DEFAULT_LEVEL2_METADATA
The default level 2 metadata.
|
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 |
---|
OdfClassificationHandler() |
Modifier and Type | Method and Description |
---|---|
private Stream<Map.Entry<String,MetadataDefinition>> |
_collectEligibleChildMetadata(MetadataDefinitionHolder parentMetaDef,
String prefix,
boolean allowMultiple) |
private String |
_convertLevel2RawForContent(String levelValue) |
private String |
_convertLevel2RawForOrgUnit(String lang,
String levelValue) |
private String |
_convertLevel2RawForRefTable(String metaContentType,
String levelValue) |
private String |
_convertLevelValue2RawValue(String lang,
String levelMeta,
String levelValue)
Convert a level value to the raw value
|
private String |
_convertRaw2LevelForContent(String contentId) |
private String |
_convertRaw2LevelForOrgUnit(String orgUnitId) |
private String |
_convertRaw2LevelForRefTable(String tableRefId,
String contentId) |
protected String |
_convertRawValue2LevelValue(String metadataPath,
String rawLevelValue)
Convert the metadata raw value into a level value
|
private Map<String,String> |
_getLevelValues(String metadata,
String language)
Get the available values of a program's metadata to be used as a level in the virtual odf page hierarchy.
|
private Map<String,String> |
_getLevelValuesForContentType(String metaContentType,
String language) |
private Map<String,String> |
_getLevelValuesForEnumerator(String language,
Enumerator enumerator) |
private Map<String,String> |
_getLevelValuesForOrgUnits() |
private Map<String,String> |
_getLevelValuesForRefTable(String metaContentType,
String language) |
private boolean |
_isEligibleMetadata(MetadataDefinition metaDef,
boolean allowMultiple) |
void |
clearLevelValues()
Clear the cache of available values for levels used for ODF virtual pages
|
void |
clearLevelValues(String metadataPath,
String lang)
Clear the cache of available values for level
|
String |
decodeLevelValue(String value)
Decode level value used in a URI
|
String |
encodeLevelValue(String value)
Encode level value to be use into a URI.
|
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.
|
Map<String,String> |
getLevelValues(String metadata,
String language)
Get the first level metadata values (with translated label).
|
String |
getOrgunitIdFromUaiCode(String lang,
String uaiCode)
Get the orgunit identifier given an uai code
|
List<String> |
getProgramLevelRawValues(Program program,
String levelMetaPath)
Get the level value of a program by extracting and transforming the raw program value at the desired metadata path
|
List<String> |
getProgramLevelValues(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> |
getPrograms(String catalog,
String lang,
String level1MetaPath,
String level1,
String level2MetaPath,
String level2,
String programName,
Collection<Expression> additionalExpressions)
Get a collection of programs corresponding to following parameters.
|
void |
initialize() |
boolean |
isEligibleMetadataForLevel(String metadataPath,
boolean allowMultiple)
True if the program metadata is eligible
|
Map<String,Map<String,Collection<Program>>> |
organizeProgramsByLevels(AmetysObjectIterable<Program> programs,
String level1,
String level2)
Organize passed programs by levels into a Map.
|
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 String DEFAULT_LEVEL1_METADATA
protected static final String DEFAULT_LEVEL2_METADATA
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 ServiceManager _manager
protected ContentTypesHelper _contentTypesHelper
protected ContentHelper _contentHelper
protected OdfReferenceTableHelper _odfReferenceTableHelper
protected RootOrgUnitProvider _orgUnitProvider
public OdfClassificationHandler()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public Map<String,I18nizableText> getCatalogs()
public boolean isEligibleMetadataForLevel(String metadataPath, boolean allowMultiple)
metadataPath
- the metadata pathallowMultiple
- true is we allow multiple metadatapublic Map<String,MetadataDefinition> getEligibleMetadataForLevel()
public Map<String,MetadataDefinition> getEnumeratedMetadata(String programContentTypeId, boolean allowMultiple)
programContentTypeId
- The content type's idallowMultiple
- true
true to allow multiple metadataprivate Stream<Map.Entry<String,MetadataDefinition>> _collectEligibleChildMetadata(MetadataDefinitionHolder parentMetaDef, String prefix, boolean allowMultiple)
private boolean _isEligibleMetadata(MetadataDefinition metaDef, boolean allowMultiple)
public List<String> getProgramLevelValues(Program program, String levelMetaPath)
program
- The programlevelMetaPath
- The desired metadata path that represent a levelpublic List<String> getProgramLevelRawValues(Program program, String levelMetaPath)
program
- The programlevelMetaPath
- The desired metadata path that represent a levelprotected String _convertRawValue2LevelValue(String metadataPath, String rawLevelValue)
metadataPath
- The path of the metadata corresponding to the levelrawLevelValue
- The raw level valuenull
if there is no level value for this raw valueprivate String _convertRaw2LevelForRefTable(String tableRefId, String contentId)
private String _convertRaw2LevelForOrgUnit(String orgUnitId)
private String _convertRaw2LevelForContent(String contentId)
private String _convertLevel2RawForRefTable(String metaContentType, String levelValue)
private String _convertLevel2RawForContent(String levelValue)
public void clearLevelValues()
public void clearLevelValues(String metadataPath, String lang)
lang
- the languagemetadataPath
- the path of level's metadatapublic Map<String,String> getLevelValues(String metadata, String language)
metadata
- Metadata of first levellanguage
- Lang to getpublic String encodeLevelValue(String value)
value
- The raw valuepublic String decodeLevelValue(String value)
value
- The encoded valueprivate Map<String,String> _getLevelValues(String metadata, String language)
metadata
- the metadata path.language
- the language.private Map<String,String> _getLevelValuesForRefTable(String metaContentType, String language)
private Map<String,String> _getLevelValuesForOrgUnits()
private Map<String,String> _getLevelValuesForContentType(String metaContentType, String language)
private Map<String,String> _getLevelValuesForEnumerator(String language, Enumerator enumerator) throws Exception
Exception
public AmetysObjectIterable<Program> getPrograms(String catalog, String lang, String level1MetaPath, String level1, String level2MetaPath, String level2, String programName, Collection<Expression> additionalExpressions)
catalog
- Name of the cataloglang
- Languagelevel1MetaPath
- Having a non-empty value for the metadata pathlevel1
- If this parameter is not null or empty and level1MetaPath too, we filter programs by the metadata level1MetaPath value of level1level2MetaPath
- Having a non-empty value for the metadata pathlevel2
- If this parameter is not null or empty and level2MetaPath too, we filter programs by the metadata level2MetaPath value of level2programName
- The program nameadditionalExpressions
- Additional expressions to add to searchpublic String getOrgunitIdFromUaiCode(String lang, String uaiCode)
lang
- LanguageuaiCode
- The uai codeprivate String _convertLevelValue2RawValue(String lang, String levelMeta, String levelValue)
lang
- The languagelevelMeta
- The name of metadata holding the levellevelValue
- The level valueprivate String _convertLevel2RawForOrgUnit(String lang, String levelValue)
public Map<String,Map<String,Collection<Program>>> organizeProgramsByLevels(AmetysObjectIterable<Program> programs, String level1, String level2) throws SAXException
programs
- Programs to organizelevel1
- Name of the metadata of first levellevel2
- Name of the metadata of second levelSAXException
- if an error occured