Class ShareableCourseHelper

    • Method Detail

      • _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 initialize
        courseListContent - the course list parent. Can be null
        user - the user who initialize the shareable fields
        ignoreRights - 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 initialize
        courseListContents - the list of course list parents. Can be empty
        user - the user who initialize the shareable fields
        ignoreRights - 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 course
        courseList - the course list
        Returns:
        true if shareable course fields match with the course list
      • getProgramIds

        public Set<StringgetProgramIds​(Set<Program> programs)
        Get programs ids from programs
        Parameters:
        programs - the list of programs
        Returns:
        the list of progam ids
      • getDegrees

        public Set<StringgetDegrees​(Set<Program> programs)
        Get degrees from programs
        Parameters:
        programs - the list of programs
        Returns:
        the list of degrees
      • getPeriods

        public Set<StringgetPeriods​(Set<Container> containers)
        Get periods from containers
        Parameters:
        containers - the list of containers
        Returns:
        the list of periods
      • getOrgUnits

        public Set<StringgetOrgUnits​(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<CoursegetShareableCourses​(String programId,
                                                                String degreeId,
                                                                String periodId,
                                                                String orgUnitId)
        Get the Courses with shareable filters matching the given arguments
        Parameters:
        programId - the program id. Can be null
        degreeId - the degree id. Can be null
        periodId - the period id. Can be null
        orgUnitId - the orgUnit id. Can be null
        Returns:
        The matching courses