Package org.ametys.odf.course
Class ShareableCourseHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.odf.course.ShareableCourseHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Configurable
,Serviceable
public class ShareableCourseHelper extends AbstractLogEnabled implements Component, Serviceable, Configurable
Helper for shareable course
-
-
Field Summary
Fields Modifier and Type Field Description protected ODFHelper
_odfHelper
The ODF helperprotected OdfReferenceTableHelper
_odfRefTableHelper
The ODF reference table helperprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected org.ametys.odf.course.ShareableCourseHelper.ShareableConfiguration
_shareableCourseConfiguration
The shareable course configurationprotected ShareableCourseStatusHelper
_shareableCourseStatus
The shareable course statusstatic String
ROLE
The component role.
-
Constructor Summary
Constructors Constructor Description ShareableCourseHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
_parseAutoValidated(Configuration configuration)
Parse configuration to know if courses are validated after initializationprotected org.ametys.odf.course.ShareableCourseHelper.ShareableConfiguration
_parseConfiguration(Configuration configuration)
Parse configuration to create a shareable course configurationprotected org.ametys.odf.course.ShareableCourseHelper.ShareableField
_parseDegreeField(Configuration configuration)
Parse configuration to get degree fieldprotected org.ametys.odf.course.ShareableCourseHelper.ShareableField
_parseOrgUnitField(Configuration configuration)
Parse configuration to get orgUnit fieldprotected org.ametys.odf.course.ShareableCourseHelper.ShareableField
_parsePeriodField(Configuration configuration)
Parse configuration to get period fieldprotected org.ametys.odf.course.ShareableCourseHelper.ShareableField
_parseProgramField(Configuration configuration)
Parse configuration to get program fieldvoid
configure(Configuration configuration)
Set<String>
getDegrees(Set<Program> programs)
Get degrees from programsSet<String>
getOrgUnits(Set<Program> programs)
Get orgUnits from programsSet<String>
getPeriods(Set<Container> containers)
Get periods from containersSet<String>
getProgramIds(Set<Program> programs)
Get programs ids from programsAmetysObjectIterable<Course>
getShareableCourses(String programId, String degreeId, String periodId, String orgUnitId)
Get theCourse
s with shareable filters matching the given argumentsboolean
handleShareableCourse()
Return true if shareable course are handledboolean
initializeShareableFields(Course courseContent, List<CourseList> courseListContents, UserIdentity user, boolean ignoreRights)
Initialize the shareable course fieldsboolean
initializeShareableFields(Course courseContent, CourseList courseListContent, UserIdentity user, boolean ignoreRights)
Initialize the shareable course fieldsboolean
isShareableFieldsMatch(Course courseContent, CourseList courseList)
True if shareable course fields match with the course listvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_shareableCourseConfiguration
protected org.ametys.odf.course.ShareableCourseHelper.ShareableConfiguration _shareableCourseConfiguration
The shareable course configuration
-
_odfRefTableHelper
protected OdfReferenceTableHelper _odfRefTableHelper
The ODF reference table helper
-
_shareableCourseStatus
protected ShareableCourseStatusHelper _shareableCourseStatus
The shareable course status
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
-
Constructor Detail
-
ShareableCourseHelper
public ShareableCourseHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_parseConfiguration
protected org.ametys.odf.course.ShareableCourseHelper.ShareableConfiguration _parseConfiguration(Configuration configuration)
Parse configuration to create a shareable course configuration- Parameters:
configuration
- the configuration- Returns:
- the shareable course configuration
-
_parseAutoValidated
protected boolean _parseAutoValidated(Configuration configuration)
Parse configuration to know if courses are validated after initialization- Parameters:
configuration
- the configuration- Returns:
true
if courses are validated after initialization
-
_parseProgramField
protected org.ametys.odf.course.ShareableCourseHelper.ShareableField _parseProgramField(Configuration configuration)
Parse configuration to get program field- Parameters:
configuration
- the configuration- Returns:
- the program field
-
_parseDegreeField
protected org.ametys.odf.course.ShareableCourseHelper.ShareableField _parseDegreeField(Configuration configuration)
Parse configuration to get degree field- Parameters:
configuration
- the configuration- Returns:
- the degree field
-
_parsePeriodField
protected org.ametys.odf.course.ShareableCourseHelper.ShareableField _parsePeriodField(Configuration configuration)
Parse configuration to get period field- Parameters:
configuration
- the configuration- Returns:
- the period field
-
_parseOrgUnitField
protected org.ametys.odf.course.ShareableCourseHelper.ShareableField _parseOrgUnitField(Configuration configuration)
Parse configuration to get orgUnit field- Parameters:
configuration
- the configuration- Returns:
- the orgUnit field
-
initializeShareableFields
public boolean initializeShareableFields(Course courseContent, CourseList courseListContent, UserIdentity user, boolean ignoreRights)
Initialize the shareable course fields- Parameters:
courseContent
- the course content to initializecourseListContent
- the course list parent. Can be nulluser
- the user who initialize the shareable fieldsignoreRights
- true to ignore user rights- Returns:
true
if there are changes
-
initializeShareableFields
public boolean initializeShareableFields(Course courseContent, List<CourseList> courseListContents, UserIdentity user, boolean ignoreRights)
Initialize the shareable course fields- Parameters:
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 rights- Returns:
true
if there are changes
-
isShareableFieldsMatch
public boolean isShareableFieldsMatch(Course courseContent, CourseList courseList)
True if shareable course fields match with the course list- Parameters:
courseContent
- the shareable coursecourseList
- the course list- Returns:
true
if shareable course fields match with the course list
-
getProgramIds
public Set<String> getProgramIds(Set<Program> programs)
Get programs ids from programs- Parameters:
programs
- the list of programs- Returns:
- the list of progam ids
-
getDegrees
public Set<String> getDegrees(Set<Program> programs)
Get degrees from programs- Parameters:
programs
- the list of programs- Returns:
- the list of degrees
-
getPeriods
public Set<String> getPeriods(Set<Container> containers)
Get periods from containers- Parameters:
containers
- the list of containers- Returns:
- the list of periods
-
getOrgUnits
public Set<String> getOrgUnits(Set<Program> programs)
Get orgUnits from programs- Parameters:
programs
- the list of programs- Returns:
- the list of orgUnits
-
handleShareableCourse
public boolean handleShareableCourse()
Return true if shareable course are handled- Returns:
true
if shareable course are handled
-
getShareableCourses
public AmetysObjectIterable<Course> getShareableCourses(String programId, String degreeId, String periodId, String orgUnitId)
Get theCourse
s with shareable filters matching the given arguments- Parameters:
programId
- the program id. Can be nulldegreeId
- the degree id. Can be nullperiodId
- the period id. Can be nullorgUnitId
- the orgUnit id. Can be null- Returns:
- The matching courses
-
-