public class ShareableCourseHelper extends AbstractLogEnabled implements Component, Serviceable, Configurable
Modifier and Type | Class and Description |
---|---|
private static class |
ShareableCourseHelper.ShareableConfiguration |
private static class |
ShareableCourseHelper.ShareableField |
Modifier and Type | Field and Description |
---|---|
private static String |
__OWN_KEY |
protected ODFHelper |
_odfHelper
The ODF helper
|
protected OdfReferenceTableHelper |
_odfRefTableHelper
The ODF reference table helper
|
protected AmetysObjectResolver |
_resolver
The Ametys object resolver
|
protected ShareableCourseHelper.ShareableConfiguration |
_shareableCourseConfiguration
The shareable course configuration
|
protected ShareableCourseStatusHelper |
_shareableCourseStatus
The shareable course status
|
static String |
DEGREES_FIELD_METADATA_NAME
The metadata name for degrees field
|
static String |
ORGUNITS_FIELD_METADATA_NAME
The metadata name for orgunits field
|
static String |
PERIODS_FIELD_METADATA_NAME
The metadata name for periods field
|
static String |
PROGRAMS_FIELD_METADATA_NAME
The metadata name for programs field
|
static String |
ROLE
The component role.
|
static String |
SHAREABLE_METADATA_NAME
The metadata name to know if the course is shareable
|
Constructor and Description |
---|
ShareableCourseHelper() |
Modifier and Type | Method and Description |
---|---|
private String |
_getItemIdFromCDM(String cdmValue,
String contentType) |
private boolean |
_isContentExist(String contentId) |
protected boolean |
_parseAutoValidated(Configuration configuration)
Parse configuration to know if courses are validated after initialization
|
protected ShareableCourseHelper.ShareableConfiguration |
_parseConfiguration(Configuration configuration)
Parse configuration to create a shareable course configuration
|
protected ShareableCourseHelper.ShareableField |
_parseDegreeField(Configuration configuration)
Parse configuration to get degree field
|
protected ShareableCourseHelper.ShareableField |
_parseOrgUnitField(Configuration configuration)
Parse configuration to get orgUnit field
|
protected ShareableCourseHelper.ShareableField |
_parsePeriodField(Configuration configuration)
Parse configuration to get period field
|
protected ShareableCourseHelper.ShareableField |
_parseProgramField(Configuration configuration)
Parse configuration to get program field
|
protected boolean |
_parseShareableField(Configuration configuration)
Parse configuration to know if courses are shareable
|
void |
configure(Configuration configuration) |
Set<String> |
getDegrees(Set<Program> programs)
Get degrees from programs
|
List<String> |
getFieldValues(Course courseContent,
String fieldMetadataName)
Get field value
|
Set<String> |
getOrgUnits(Set<Program> programs)
Get orgUnits from programs
|
Set<String> |
getPeriods(Set<Container> containers)
Get periods from containers
|
Set<String> |
getProgramIds(Set<Program> programs)
Get programs ids from programs
|
boolean |
handleShareableCourse()
Return true if shareable course are handled
|
boolean |
initializeShareableFields(Course courseContent,
CourseList courseListContent,
UserIdentity user,
boolean ignoreRights)
Initialize the shareable course fields
|
boolean |
initializeShareableFields(Course courseContent,
List<CourseList> courseListContents,
UserIdentity user,
boolean ignoreRights)
Initialize the shareable course fields
|
boolean |
isShareableCourse(Course courseContent)
True if the course content is shareable
|
boolean |
isShareableFieldsMatch(Course courseContent,
CourseList courseList)
True if shareable course fields match with the course list
|
void |
service(ServiceManager manager) |
getLogger, setLogger
public static final String SHAREABLE_METADATA_NAME
public static final String PROGRAMS_FIELD_METADATA_NAME
public static final String PERIODS_FIELD_METADATA_NAME
public static final String DEGREES_FIELD_METADATA_NAME
public static final String ORGUNITS_FIELD_METADATA_NAME
private static final String __OWN_KEY
protected ShareableCourseHelper.ShareableConfiguration _shareableCourseConfiguration
protected OdfReferenceTableHelper _odfRefTableHelper
protected ShareableCourseStatusHelper _shareableCourseStatus
protected ODFHelper _odfHelper
protected AmetysObjectResolver _resolver
public ShareableCourseHelper()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
protected ShareableCourseHelper.ShareableConfiguration _parseConfiguration(Configuration configuration)
configuration
- the configurationprotected boolean _parseAutoValidated(Configuration configuration)
configuration
- the configurationtrue
if courses are validated after initializationprotected boolean _parseShareableField(Configuration configuration)
configuration
- the configurationtrue
if courses are shareableprotected ShareableCourseHelper.ShareableField _parseProgramField(Configuration configuration)
configuration
- the configurationprotected ShareableCourseHelper.ShareableField _parseDegreeField(Configuration configuration)
configuration
- the configurationprotected ShareableCourseHelper.ShareableField _parsePeriodField(Configuration configuration)
configuration
- the configurationprotected ShareableCourseHelper.ShareableField _parseOrgUnitField(Configuration configuration)
configuration
- the configurationprivate String _getItemIdFromCDM(String cdmValue, String contentType)
private boolean _isContentExist(String contentId)
public boolean initializeShareableFields(Course courseContent, CourseList courseListContent, UserIdentity user, boolean ignoreRights)
courseContent
- the course content to initializecourseListContent
- the course list parent. Can be nulluser
- the user who initialize the shareable fieldsignoreRights
- true to ignore user rightstrue
if there are changespublic boolean initializeShareableFields(Course courseContent, List<CourseList> courseListContents, UserIdentity user, boolean ignoreRights)
courseContent
- the course content to initializecourseListContents
- the list of course list parents. Can be emptyuser
- the user who initialize the shareable fieldsignoreRights
- true to ignore user rightstrue
if there are changespublic boolean isShareableFieldsMatch(Course courseContent, CourseList courseList)
courseContent
- the shareable coursecourseList
- the course listtrue
if shareable course fields match with the course listpublic List<String> getFieldValues(Course courseContent, String fieldMetadataName)
courseContent
- the course contentfieldMetadataName
- the name of the fieldpublic boolean isShareableCourse(Course courseContent)
courseContent
- the course contenttrue
if the course is shareablepublic Set<String> getProgramIds(Set<Program> programs)
programs
- the list of programspublic Set<String> getDegrees(Set<Program> programs)
programs
- the list of programspublic Set<String> getPeriods(Set<Container> containers)
containers
- the list of containerspublic Set<String> getOrgUnits(Set<Program> programs)
programs
- the list of programspublic boolean handleShareableCourse()
true
if shareable course are handled