Class MoodleWebServiceImpl
java.lang.Object
org.opencastproject.userdirectory.moodle.MoodleWebServiceImpl
- All Implemented Interfaces:
MoodleWebService
Implementation of the Moodle web service client.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencastproject.userdirectory.moodle.MoodleWebService
MoodleWebService.CoreUserGetUserByFieldFilters -
Field Summary
Fields inherited from interface org.opencastproject.userdirectory.moodle.MoodleWebService
MOODLE_FUNCTION_CORE_USER_GET_USERS_BY_FIELD, MOODLE_FUNCTION_TOOL_OPENCAST_GET_COURSES_FOR_INSTRUCTOR, MOODLE_FUNCTION_TOOL_OPENCAST_GET_COURSES_FOR_LEARNER, MOODLE_FUNCTION_TOOL_OPENCAST_GET_GROUPS_FOR_LEARNER -
Constructor Summary
ConstructorsConstructorDescriptionMoodleWebServiceImpl(URI url, String token) Constructs a new Moodle web service client. -
Method Summary
Modifier and TypeMethodDescriptioncoreUserGetUsersByField(MoodleWebService.CoreUserGetUserByFieldFilters filter, List<String> values) Searches for a user in Moodle.getURL()Returns the URL to the Moodle web service.toolOpencastGetCoursesForInstructor(String username) Returns the list of Moodle course IDs the given user has the instructor capability.toolOpencastGetCoursesForLearner(String username) Returns the list of Moodle course IDs the given user has the learner capability.toolOpencastGetGroupsForLearner(String username) Returns the list of Moodle group IDs where the given user has the learner capability.
-
Constructor Details
-
MoodleWebServiceImpl
Constructs a new Moodle web service client.- Parameters:
url- URL of the Moodle instancetoken- Web service token
-
-
Method Details
-
coreUserGetUsersByField
public List<MoodleUser> coreUserGetUsersByField(MoodleWebService.CoreUserGetUserByFieldFilters filter, List<String> values) throws URISyntaxException, IOException, MoodleWebServiceException, org.json.simple.parser.ParseException Searches for a user in Moodle.- Specified by:
coreUserGetUsersByFieldin interfaceMoodleWebService- Parameters:
filter- Filter type to applyvalues- Value for the filter.- Returns:
- A
MoodleUserlist. - Throws:
URISyntaxException- In case the URL cannot be constructed.IOException- In case of an IO error.MoodleWebServiceException- In case Moodle returns an error.org.json.simple.parser.ParseException- In case the Moodle response cannot be parsed.
-
toolOpencastGetCoursesForInstructor
public List<String> toolOpencastGetCoursesForInstructor(String username) throws URISyntaxException, IOException, MoodleWebServiceException, org.json.simple.parser.ParseException Returns the list of Moodle course IDs the given user has the instructor capability.- Specified by:
toolOpencastGetCoursesForInstructorin interfaceMoodleWebService- Parameters:
username- The username to search for.- Returns:
- A list of Moodle course IDs.
- Throws:
URISyntaxException- In case the URL cannot be constructed.IOException- In case of an IO error.MoodleWebServiceException- In case Moodle returns an error.org.json.simple.parser.ParseException- In case the Moodle response cannot be parsed.- See Also:
-
toolOpencastGetCoursesForLearner
public List<String> toolOpencastGetCoursesForLearner(String username) throws URISyntaxException, IOException, MoodleWebServiceException, org.json.simple.parser.ParseException Returns the list of Moodle course IDs the given user has the learner capability.- Specified by:
toolOpencastGetCoursesForLearnerin interfaceMoodleWebService- Parameters:
username- The username to search for.- Returns:
- A list of Moodle course IDs.
- Throws:
URISyntaxException- In case the URL cannot be constructed.IOException- In case of an IO error.MoodleWebServiceException- In case Moodle returns an error.org.json.simple.parser.ParseException- In case the Moodle response cannot be parsed.- See Also:
-
toolOpencastGetGroupsForLearner
public List<String> toolOpencastGetGroupsForLearner(String username) throws URISyntaxException, IOException, MoodleWebServiceException, org.json.simple.parser.ParseException Description copied from interface:MoodleWebServiceReturns the list of Moodle group IDs where the given user has the learner capability.- Specified by:
toolOpencastGetGroupsForLearnerin interfaceMoodleWebService- Parameters:
username- The username to search for.- Returns:
- A list of Moodle group IDs.
- Throws:
URISyntaxException- In case the URL cannot be constructed.IOException- In case of an IO error.MoodleWebServiceException- In case Moodle returns an error.org.json.simple.parser.ParseException- In case the Moodle response cannot be parsed.
-
getURL
Returns the URL to the Moodle web service.- Specified by:
getURLin interfaceMoodleWebService- Returns:
- URL to the Moodle web service.
- See Also:
-