use of org.olat.modules.lecture.LectureService in project openolat by klemens.
the class CourseHandler method cloneLectureConfig.
private void cloneLectureConfig(RepositoryEntry source, RepositoryEntry target) {
LectureService lectureService = CoreSpringFactory.getImpl(LectureService.class);
lectureService.copyRepositoryEntryLectureConfiguration(source, target);
}
use of org.olat.modules.lecture.LectureService in project openolat by klemens.
the class LectureBlockRollCallWebService method getRollCalls.
/**
* Return a list lecture block roll call.
*
* @response.representation.200.qname {http://www.example.com}lectureBlockRollCallVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc A lecture block roll call
* @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKROLLCALLVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param closed If true, the status of the block is done or the status of the roll call is closed or auto closed
* @param hasAbsence If true, the roll call has an absence
* @param hasSupervisorNotificationDate If true, the roll call has a supervisor notification date set
* @param httpRequest The HTTP request
* @return The roll calls
*/
@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getRollCalls(@QueryParam("closed") Boolean closed, @QueryParam("hasAbsence") Boolean hasAbsence, @QueryParam("hasSupervisorNotificationDate") Boolean hasSupervisorNotificationDate, @QueryParam("lectureBlockKey") Long lectureBlockKey, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
LectureService lectureService = CoreSpringFactory.getImpl(LectureService.class);
LectureBlockRollCallSearchParameters searchParams = new LectureBlockRollCallSearchParameters();
if (hasAbsence != null) {
searchParams.setHasAbsence(hasAbsence);
}
if (hasSupervisorNotificationDate != null) {
searchParams.setHasSupervisorNotificationDate(hasSupervisorNotificationDate);
}
if (closed != null) {
searchParams.setClosed(closed);
}
if (lectureBlockKey != null) {
searchParams.setLectureBlockKey(lectureBlockKey);
}
List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(searchParams);
List<LectureBlockRollCallVO> voList = new ArrayList<>(rollCalls.size());
for (LectureBlockRollCall rollCall : rollCalls) {
voList.add(new LectureBlockRollCallVO(rollCall));
}
LectureBlockRollCallVO[] voes = voList.toArray(new LectureBlockRollCallVO[voList.size()]);
return Response.ok(voes).build();
}
use of org.olat.modules.lecture.LectureService in project openolat by klemens.
the class LectureBlockRollCallWebService method getRollCall.
/**
* Return the lecture block roll call specified by the primary key.
*
* @response.representation.200.qname {http://www.example.com}lectureBlockRollCallVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc A lecture block roll call
* @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKROLLCALLVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The role call was not found
* @param rollCallKey The primary key of the roll call
* @param httpRequest The HTTP request
* @return The roll call
*/
@GET
@Path("{rollCallKey}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getRollCall(@PathParam("rollCallKey") Long rollCallKey, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
LectureService lectureService = CoreSpringFactory.getImpl(LectureService.class);
LectureBlockRollCallSearchParameters searchParams = new LectureBlockRollCallSearchParameters();
searchParams.setRollCallKey(rollCallKey);
List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(searchParams);
if (rollCalls.size() == 1) {
LectureBlockRollCall rollCall = rollCalls.get(0);
LectureBlockRollCallVO vo = new LectureBlockRollCallVO(rollCall);
return Response.ok(vo).build();
}
return Response.serverError().status(Status.NOT_FOUND).build();
}
Aggregations