From 1b67933b7ea9b331adc7bba31fd8381e5ba7e825 Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Sun, 7 Jun 2020 15:53:02 +0200 Subject: [PATCH] no-jira: remove the old REST API documentation --- .../calendar/restapi/CalWebService.java | 59 +- .../restapi/UserCalendarWebService.java | 34 +- .../olat/commons/info/restapi/Examples.java | 40 - .../info/restapi/InfoMessageWebService.java | 27 +- .../info/restapi/InfoMessagesWebService.java | 33 +- .../restapi/CollaboraWebService.java | 32 +- .../restapi/Office365WebService.java | 37 +- .../restapi/OnlyOfficeWebService.java | 19 +- .../restapi/NotificationsWebService.java | 94 +-- .../notifications/restapi/vo/Examples.java | 41 - .../services/vfs/restapi/VFSWebservice.java | 66 +- .../EfficiencyStatementWebService.java | 30 +- .../restapi/CertificationWebService.java | 49 +- .../course/db/restapi/CourseDbWebService.java | 171 ++-- .../olat/course/nodes/bc/BCWebService.java | 134 +-- .../olat/course/nodes/co/COWebService.java | 61 +- .../olat/course/nodes/en/ENWebService.java | 85 +- .../CurriculumElementTypesWebService.java | 184 ++--- .../restapi/CurriculumElementsWebService.java | 746 ++++++----------- .../restapi/CurriculumsWebService.java | 195 ++--- .../modules/curriculum/restapi/Examples.java | 74 -- .../restapi/DocumentPoolModuleWebService.java | 23 +- .../modules/docpool/restapi/Examples.java | 37 - .../fo/restapi/ForumCourseNodeWebService.java | 157 ++-- .../fo/restapi/ForumImportWebService.java | 8 +- .../modules/fo/restapi/ForumWebService.java | 273 ++----- .../fo/restapi/MyForumsWebService.java | 68 +- .../modules/gotomeeting/restapi/Examples.java | 41 - .../restapi/GoToTrainingWebService.java | 58 +- .../modules/lecture/restapi/Examples.java | 69 -- .../LectureBlockRollCallWebService.java | 93 +-- .../restapi/LectureBlockWebService.java | 137 ++-- .../restapi/LectureBlocksRootWebService.java | 30 +- .../restapi/LectureBlocksWebService.java | 119 +-- .../restapi/OpenMeetingsWebService.java | 11 +- .../qpool/restapi/QuestionPoolWebService.java | 85 +- .../modules/reminder/restapi/Examples.java | 40 - .../reminder/restapi/RemindersWebService.java | 70 +- .../modules/taxonomy/restapi/Examples.java | 62 -- .../taxonomy/restapi/TaxonomyWebService.java | 225 ++--- .../olat/modules/vitero/restapi/Examples.java | 53 -- .../restapi/ViteroBookingWebService.java | 96 +-- .../wiki/restapi/GroupWikiWebService.java | 5 +- .../modules/wiki/restapi/WikisWebService.java | 8 +- .../restapi/ChangePasswordWebService.java | 6 +- .../restapi/RegistrationWebService.java | 18 +- .../group/LearningGroupWebService.java | 226 ++--- .../olat/restapi/group/MyGroupWebService.java | 61 +- .../org/olat/restapi/i18n/I18nWebService.java | 15 +- .../restapi/repository/CatalogWebService.java | 237 ++---- .../RepositoryEntriesWebService.java | 63 +- .../RepositoryEntryLifecycleWebService.java | 13 +- .../repository/RepositoryEntryWebService.java | 310 +++---- .../repository/SharedFolderWebService.java | 37 +- .../course/CourseAssessmentWebService.java | 98 +-- .../course/CourseElementWebService.java | 770 ++++++------------ .../course/CourseGroupWebService.java | 115 +-- .../CourseResourceFolderWebService.java | 138 ++-- .../repository/course/CourseWebService.java | 155 +--- .../course/CoursesInfosWebService.java | 19 +- .../repository/course/CoursesWebService.java | 55 +- .../security/AuthenticationWebService.java | 33 +- .../java/org/olat/restapi/support/Ping.java | 23 +- .../org/olat/restapi/support/vo/Examples.java | 197 ----- .../restapi/system/DatabaseWebService.java | 15 +- .../restapi/system/IndexerWebService.java | 42 +- .../olat/restapi/system/LogWebService.java | 13 +- .../olat/restapi/system/MemoryWebService.java | 45 +- .../restapi/system/MonitoringWebService.java | 17 +- .../system/NotificationsAdminWebService.java | 29 +- .../system/OpenOLATStatisticsWebService.java | 91 +-- .../restapi/system/RuntimeWebService.java | 66 +- .../olat/restapi/system/StatusWebservice.java | 17 +- .../olat/restapi/system/SystemWebService.java | 58 +- .../restapi/system/ThreadsWebService.java | 10 +- .../org/olat/restapi/system/vo/Examples.java | 138 ---- .../olat/user/restapi/ContactsWebService.java | 13 +- .../java/org/olat/user/restapi/Examples.java | 100 --- ...IdentityToIdentityRelationsWebService.java | 70 +- .../restapi/OrganisationTypesWebService.java | 134 +-- .../user/restapi/OrganisationsWebService.java | 168 +--- .../user/restapi/RelationRolesWebService.java | 90 +- .../restapi/UserAuthenticationWebService.java | 95 +-- .../user/restapi/UserCoursesWebService.java | 49 +- .../user/restapi/UserFoldersWebService.java | 49 +- .../org/olat/user/restapi/UserWebService.java | 275 ++----- 86 files changed, 2291 insertions(+), 5861 deletions(-) delete mode 100644 src/main/java/org/olat/commons/info/restapi/Examples.java delete mode 100644 src/main/java/org/olat/core/commons/services/notifications/restapi/vo/Examples.java delete mode 100644 src/main/java/org/olat/modules/curriculum/restapi/Examples.java delete mode 100644 src/main/java/org/olat/modules/docpool/restapi/Examples.java delete mode 100644 src/main/java/org/olat/modules/gotomeeting/restapi/Examples.java delete mode 100644 src/main/java/org/olat/modules/lecture/restapi/Examples.java delete mode 100644 src/main/java/org/olat/modules/reminder/restapi/Examples.java delete mode 100644 src/main/java/org/olat/modules/taxonomy/restapi/Examples.java delete mode 100644 src/main/java/org/olat/modules/vitero/restapi/Examples.java delete mode 100644 src/main/java/org/olat/restapi/support/vo/Examples.java delete mode 100644 src/main/java/org/olat/restapi/system/vo/Examples.java delete mode 100644 src/main/java/org/olat/user/restapi/Examples.java diff --git a/src/main/java/org/olat/commons/calendar/restapi/CalWebService.java b/src/main/java/org/olat/commons/calendar/restapi/CalWebService.java index 82d97edc593..88fb062346e 100644 --- a/src/main/java/org/olat/commons/calendar/restapi/CalWebService.java +++ b/src/main/java/org/olat/commons/calendar/restapi/CalWebService.java @@ -57,12 +57,10 @@ import org.olat.core.util.StringHelper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.ArraySchema; - import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -71,8 +69,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com * */ - - @Tag (name = "Calendar") public class CalWebService { @@ -85,16 +81,14 @@ public class CalWebService { @GET @Path("events") @Operation(summary = "List events from a calendar.", description = "Returns list of events from a specific calendar.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Request was successful", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "Not found")} - ) + @ApiResponse(responseCode = "200", description = "Request was successful", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))) + } + ) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getEventsByCalendar(@QueryParam("start")@Parameter(description = "Set the date for the earliest event") @DefaultValue("0") Integer start, @QueryParam("limit") @Parameter(description = "Limit the amount of events to be returned") @DefaultValue("25") Integer limit, @@ -159,11 +153,9 @@ public class CalWebService { @PUT @Path("event") @Operation(summary = "Put a specific event.", description = "Puts a specific event in a specific calendar.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200",description = "Ok"), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "Not found")} - ) + @ApiResponse(responseCode = "200",description = "Ok") + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putEventByCalendar(EventVO event, @Context HttpServletRequest httpRequest) { @@ -174,12 +166,9 @@ public class CalWebService { @PUT @Path("events") @Operation(summary = "Put specific events.", description = "Puts specific events in a specific calendar.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok" - ), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "Not found.")} - ) + @ApiResponse(responseCode = "200", description = "Ok") + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "Not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putEventsByCalendar(EventVO[] eventArray, @Context HttpServletRequest httpRequest) { @@ -193,12 +182,9 @@ public class CalWebService { @POST @Path("event") @Operation(summary = "Post a specific event.", description = "Posts a specific event in a specific calendar.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok" - ), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "Not found")} - ) + @ApiResponse(responseCode = "200", description = "Ok") + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postEventByCalendar(EventVO event, @Context HttpServletRequest httpRequest) { @@ -209,12 +195,9 @@ public class CalWebService { @POST @Path("events") @Operation(summary = "Post specific events.", description = "Posts specific events in a specific calendar.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok." - ), - @ApiResponse(responseCode = "401", description = "Not authorized."), - @ApiResponse(responseCode = "404", description = "Not found.")} - ) + @ApiResponse(responseCode = "200", description = "Ok.") + @ApiResponse(responseCode = "401", description = "Not authorized.") + @ApiResponse(responseCode = "404", description = "Not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postEventsByCalendar(EventVO[] eventArray, @Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/commons/calendar/restapi/UserCalendarWebService.java b/src/main/java/org/olat/commons/calendar/restapi/UserCalendarWebService.java index 6438ab5fe01..da7ac14f8f0 100644 --- a/src/main/java/org/olat/commons/calendar/restapi/UserCalendarWebService.java +++ b/src/main/java/org/olat/commons/calendar/restapi/UserCalendarWebService.java @@ -88,7 +88,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -119,15 +118,13 @@ public class UserCalendarWebService { @GET @Tag(name = "Calendar") @Operation(summary = "List calendars of a specific user.", description = "Returns list of calendars of a specific user. Will always return the administrator's calendars for administrators.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Request was successful.", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CalendarVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CalendarVO.class))) - }, links = {}), - @ApiResponse(responseCode = "401", description = "Not authorized."), - @ApiResponse(responseCode = "404", description = "Not found.")} - ) + @ApiResponse(responseCode = "200", description = "Request was successful.", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CalendarVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CalendarVO.class))) + }, links = {}) + @ApiResponse(responseCode = "401", description = "Not authorized.") + @ApiResponse(responseCode = "404", description = "Not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCalendars(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { UserRequest ureq = getUserRequest(httpRequest); @@ -176,16 +173,13 @@ public class UserCalendarWebService { @GET @Path("events") @Operation(summary = "List all events from a user.", description = "Returns list of all events in for a specific user.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Request was successful.", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "Not authorized."), - @ApiResponse(responseCode = "404", description = "Not found.")} -) + @ApiResponse(responseCode = "200", description = "Request was successful.", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = EventVO.class))) + }) + @ApiResponse(responseCode = "401", description = "Not authorized.") + @ApiResponse(responseCode = "404", description = "Not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getEvents(@PathParam("identityKey") Long identityKey, @QueryParam("start") @Parameter(description = "Set the date for the earliest event.")@DefaultValue("0") Integer start, diff --git a/src/main/java/org/olat/commons/info/restapi/Examples.java b/src/main/java/org/olat/commons/info/restapi/Examples.java deleted file mode 100644 index 0ca7302af63..00000000000 --- a/src/main/java/org/olat/commons/info/restapi/Examples.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ - -package org.olat.commons.info.restapi; - - -public class Examples { - - public static final InfoMessageVO SAMPLE_INFOMESSAGEVO = new InfoMessageVO(); - public static final InfoMessageVOes SAMPLE_INFOMESSAGEVOes = new InfoMessageVOes(); - - static { - SAMPLE_INFOMESSAGEVO.setKey(345l); - SAMPLE_INFOMESSAGEVO.setTitle("John"); - SAMPLE_INFOMESSAGEVO.setMessage("Smith"); - SAMPLE_INFOMESSAGEVO.setResName("CourseModule"); - SAMPLE_INFOMESSAGEVO.setResId(81929756230689l); - SAMPLE_INFOMESSAGEVO.setResSubPath("81939515470663"); - SAMPLE_INFOMESSAGEVO.setBusinessPath("[RepositoryEntry:109051904][CourseNode:81939515470663]"); - SAMPLE_INFOMESSAGEVO.setAuthorKey(35789l); - SAMPLE_INFOMESSAGEVOes.getInfoMessages().add(SAMPLE_INFOMESSAGEVO); - } -} diff --git a/src/main/java/org/olat/commons/info/restapi/InfoMessageWebService.java b/src/main/java/org/olat/commons/info/restapi/InfoMessageWebService.java index 5f9303d1b9f..5b16980b169 100644 --- a/src/main/java/org/olat/commons/info/restapi/InfoMessageWebService.java +++ b/src/main/java/org/olat/commons/info/restapi/InfoMessageWebService.java @@ -33,7 +33,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -54,28 +53,20 @@ public class InfoMessageWebService { /** * Get an new info message by key - * @response.representation.200.qname {http://www.example.com}infoMessageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The info message - * @response.representation.200.example {@link org.olat.commons.info.restapi.Examples#SAMPLE_INFOMESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param infoMessageKey The key * @param request The HTTP request * @return It returns the newly info message */ @GET - @Operation(summary = "Get an new info message by key", - description = "Get an new info message by key") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The info message", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = InfoMessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = InfoMessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not Found")} - ) + @Operation(summary = "Get an new info message by key", description = "Get an new info message by key") + @ApiResponse(responseCode = "200", description = "The info message", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = InfoMessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = InfoMessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not Found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMessage(@Context HttpServletRequest request) { InfoMessageVO msgVO = new InfoMessageVO(msg); diff --git a/src/main/java/org/olat/commons/info/restapi/InfoMessagesWebService.java b/src/main/java/org/olat/commons/info/restapi/InfoMessagesWebService.java index 42ae6b276f1..a7cde089b58 100644 --- a/src/main/java/org/olat/commons/info/restapi/InfoMessagesWebService.java +++ b/src/main/java/org/olat/commons/info/restapi/InfoMessagesWebService.java @@ -20,8 +20,8 @@ package org.olat.commons.info.restapi; -import static org.olat.restapi.security.RestSecurityHelper.getUserRequest; import static org.olat.restapi.security.RestSecurityHelper.getRoles; +import static org.olat.restapi.security.RestSecurityHelper.getUserRequest; import java.util.Collections; @@ -53,7 +53,6 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -78,9 +77,7 @@ public class InfoMessagesWebService { /** * The version of the Info messages Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @@ -95,11 +92,7 @@ public class InfoMessagesWebService { /** * Creates a new info message - * @response.representation.200.qname {http://www.example.com}infoMessageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The info message - * @response.representation.200.example {@link org.olat.commons.info.restapi.Examples#SAMPLE_INFOMESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param resName The OLAT Resourceable name * @param resId The OLAT Resourceable id * @param resSubPath The resource sub path (optional) @@ -111,18 +104,14 @@ public class InfoMessagesWebService { * @return It returns the id of the newly info message */ @PUT - @Operation(summary = "Creates a new info message", - description = "Creates a new info message") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The info message", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = InfoMessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = InfoMessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not Found")} - ) + @Operation(summary = "Creates a new info message", description = "Creates a new info message") + @ApiResponse(responseCode = "200", description = "The info message", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = InfoMessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = InfoMessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not Found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createEmptyCourse(final @QueryParam("resName") @Parameter(description = "The OLAT Resourceable name") String resName, final @QueryParam("resId") @Parameter(description = "The OLAT Resourceable id") Long resId, @QueryParam("resSubPath") @Parameter(description = "The resource sub path (optional)") String resSubPath, diff --git a/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java b/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java index ac7f1193566..342dcd67177 100644 --- a/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java +++ b/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java @@ -59,7 +59,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -82,13 +81,12 @@ public class CollaboraWebService { @GET @Operation(summary = "Get file Info", description = "Get file Info") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CheckFileInfoVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CheckFileInfoVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "File not found")}) + @ApiResponse(responseCode = "200", description = "The files", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CheckFileInfoVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CheckFileInfoVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "403", description = "Forbidden") + @ApiResponse(responseCode = "404", description = "File not found") @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo( @@ -139,9 +137,8 @@ public class CollaboraWebService { @GET @Path("/contents") @Operation(summary = "Retrieve content", description = "Retrieve the content of a file") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The contents"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The contents") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response getFile( @PathParam("fileId") String fileId, @QueryParam("access_token") String accessToken, @@ -175,13 +172,12 @@ public class CollaboraWebService { @POST @Path("/contents") @Operation(summary = "Post content", description = "Post content to a file") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The contents", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = PutFileVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = PutFileVO.class)) }), - @ApiResponse(responseCode = "401", description = "No access for token"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "File not found") }) + @ApiResponse(responseCode = "200", description = "The contents", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PutFileVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = PutFileVO.class)) }) + @ApiResponse(responseCode = "401", description = "No access for token") + @ApiResponse(responseCode = "403", description = "Forbidden") + @ApiResponse(responseCode = "404", description = "File not found") @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public Response putFile( diff --git a/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java b/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java index 980c57fbbe0..6ef468c0d91 100644 --- a/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java +++ b/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java @@ -59,7 +59,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -86,13 +85,12 @@ public class Office365WebService { @GET @Operation(summary = "Get file Info", description = "Get file Info") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CheckFileInfoVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CheckFileInfoVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "File not found")}) + @ApiResponse(responseCode = "200", description = "The files", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CheckFileInfoVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CheckFileInfoVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "403", description = "Forbidden") + @ApiResponse(responseCode = "404", description = "File not found") @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo( @PathParam("fileId") String fileId, @@ -160,11 +158,10 @@ public class Office365WebService { @POST @Operation(summary = "WOPI REST post request for file", description = "WOPI REST post request for file") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "WOPI REST post request for file"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "File not found")}) + @ApiResponse(responseCode = "200", description = "WOPI REST post request for file") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "403", description = "Forbidden") + @ApiResponse(responseCode = "404", description = "File not found") public Response post( @PathParam("fileId") String fileId, @QueryParam("access_token") String accessToken, @@ -332,9 +329,8 @@ public class Office365WebService { @GET @Path("/contents") @Operation(summary = "Retrieve content", description = "Retrieve the content") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The contents"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The contents") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response getFile( @PathParam("fileId") String fileId, @QueryParam("access_token") String accessToken, @@ -381,11 +377,10 @@ public class Office365WebService { @POST @Path("/contents") @Operation(summary = "Post content", description = "Post content to a file") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The contents"), - @ApiResponse(responseCode = "401", description = "No access for token"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "File not found") }) + @ApiResponse(responseCode = "200", description = "The contents") + @ApiResponse(responseCode = "401", description = "No access for token") + @ApiResponse(responseCode = "403", description = "Forbidden") + @ApiResponse(responseCode = "404", description = "File not found") @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public Response putFile( diff --git a/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java b/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java index 37361edaad8..53cd85266e2 100644 --- a/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java +++ b/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java @@ -39,12 +39,12 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.apache.logging.log4j.Logger; import org.olat.core.commons.services.doceditor.onlyoffice.Callback; import org.olat.core.commons.services.doceditor.onlyoffice.OnlyOfficeModule; import org.olat.core.commons.services.doceditor.onlyoffice.OnlyOfficeSecurityService; import org.olat.core.commons.services.doceditor.onlyoffice.OnlyOfficeService; import org.olat.core.id.Identity; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.StringHelper; import org.olat.core.util.vfs.VFSLeaf; @@ -56,7 +56,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -80,12 +79,11 @@ public class OnlyOfficeWebService { @POST @Path("/callback") @Operation(summary = "Post Callback", description = "Post Callback") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The contents", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CallbackResponseVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CallbackResponseVO.class)) }), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "File not found") }) + @ApiResponse(responseCode = "200", description = "The contents", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CallbackResponseVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CallbackResponseVO.class)) }) + @ApiResponse(responseCode = "403", description = "Forbidden") + @ApiResponse(responseCode = "404", description = "File not found") @Produces(MediaType.APPLICATION_JSON) public Response postCallback( @PathParam("fileId") String fileId, @@ -215,9 +213,8 @@ public class OnlyOfficeWebService { @GET @Path("/contents") @Operation(summary = "Retrieve content", description = "Retrieve the content of a file") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "ONLYOFFICE REST get file contents request for File ID"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "ONLYOFFICE REST get file contents request for File ID") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response getFile( @PathParam("fileId") String fileId, @Context HttpHeaders httpHeaders) { diff --git a/src/main/java/org/olat/core/commons/services/notifications/restapi/NotificationsWebService.java b/src/main/java/org/olat/core/commons/services/notifications/restapi/NotificationsWebService.java index 538263386fd..6e03767edb1 100644 --- a/src/main/java/org/olat/core/commons/services/notifications/restapi/NotificationsWebService.java +++ b/src/main/java/org/olat/core/commons/services/notifications/restapi/NotificationsWebService.java @@ -24,7 +24,6 @@ package org.olat.core.commons.services.notifications.restapi; import static org.olat.restapi.security.RestSecurityHelper.parseDate; - import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -71,11 +70,10 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -98,28 +96,19 @@ public class NotificationsWebService { /** * Get the publisher by resource name and id + sub identifier. * - * @response.representation.200.qname {http://www.example.com}publisherVo - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The publisher - * @response.representation.200.example {@link org.olat.core.commons.services.notifications.restapi.vo.Examples#SAMPLE_PUBLISHERVO} - * @response.representation.204.doc The publisher doesn't exist - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @return It returns the <code>CourseVO</code> object representing the course. */ @GET @Path("publisher/{ressourceName}/{ressourceId}/{subIdentifier}") @Operation(summary = "Get publisher", - description = "Get the publisher by resource name and id + sub identifier") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The publisher", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = PublisherVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = PublisherVO.class)) - } - ), - @ApiResponse(responseCode = "204", description = "The publisher doesn't exist"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) + description = "Get the publisher by resource name and id + sub identifier") + @ApiResponse(responseCode = "200", description = "The publisher", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PublisherVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = PublisherVO.class)) + }) + @ApiResponse(responseCode = "204", description = "The publisher doesn't exist") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response getPublisher(@PathParam("ressourceName") String ressourceName, @PathParam("ressourceId") Long ressourceId, @PathParam("subIdentifier") String subIdentifier, @Context HttpServletRequest request) { @@ -141,18 +130,14 @@ public class NotificationsWebService { @GET @Path("subscribers/{ressourceName}/{ressourceId}/{subIdentifier}") @Operation(summary = "Get subscribers", - description = "Get the subscribers by resource name and id + sub identifier") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The subscribers", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = SubscriberVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = SubscriberVO.class))) - } - ), - @ApiResponse(responseCode = "204", description = "The subscribers don't exist"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) - + description = "Get the subscribers by resource name and id + sub identifier") + @ApiResponse(responseCode = "200", description = "The subscribers", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = SubscriberVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = SubscriberVO.class))) + }) + @ApiResponse(responseCode = "204", description = "The subscribers don't exist") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response getSubscriber(@PathParam("ressourceName") String ressourceName, @PathParam("ressourceId") Long ressourceId, @PathParam("subIdentifier") String subIdentifier, @Context HttpServletRequest request) { @@ -183,13 +168,10 @@ public class NotificationsWebService { @PUT @Path("subscribers") - @Operation(summary = "Put subscribers", - description = "Put the subscribers") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The author or message not found")} - ) + @Operation(summary = "Put subscribers", description = "Put the subscribers") + @ApiResponse(responseCode = "200", description = "Ok") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The author or message not found") @Consumes({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response subscribe(PublisherVO publisherVO, @Context HttpServletRequest request) { if(!isAdmin(request)) { @@ -213,13 +195,10 @@ public class NotificationsWebService { @DELETE @Path("subscribers/{subscriberKey}") - @Operation(summary = "Delete subscribers", - description = "Delete the subscribers by id") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The author or message not found")} - ) + @Operation(summary = "Delete subscribers", description = "Delete the subscribers by id") + @ApiResponse(responseCode = "200", description = "Ok") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The author or message not found") @Consumes({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response unsubscribe(@PathParam("subscriberKey") Long subscriberKey, @Context HttpServletRequest request) { if(!isAdmin(request)) { @@ -234,10 +213,7 @@ public class NotificationsWebService { /** * Retrieves the notification of the logged in user. - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The notifications - * @response.representation.200.example {@link org.olat.core.commons.services.notifications.restapi.vo.Examples#SAMPLE_INFOVOes} - * @response.representation.404.doc The identity not found + * * @param date The date (optional) * @param type The type of notifications (User, Forum...) (optional) * @param httpRequest The HTTP request @@ -245,17 +221,13 @@ public class NotificationsWebService { * correspond to a <code>SubscriptionInfoVO</code>. <code>SubscriptionInfoVO</code> */ @GET - @Operation(summary = "Retrieves the notification of the logged in user", - description = "Retrieves the notification of the logged in user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok.", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "404", description = "The identity not found")} - ) + @Operation(summary = "Retrieves the notification of the logged in user", description = "Retrieves the notification of the logged in user") + @ApiResponse(responseCode = "200", description = "Ok.", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response getNotifications(@QueryParam("date") @Parameter(description = "The date (optional)") String date, @QueryParam("type") @Parameter(description = "The type of notifications (User, Forum...) (optional)") String type, @Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/core/commons/services/notifications/restapi/vo/Examples.java b/src/main/java/org/olat/core/commons/services/notifications/restapi/vo/Examples.java deleted file mode 100644 index 9962d49928c..00000000000 --- a/src/main/java/org/olat/core/commons/services/notifications/restapi/vo/Examples.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ - -package org.olat.core.commons.services.notifications.restapi.vo; - -public class Examples { - - public static final PublisherVO SAMPLE_PUBLISHERVO = new PublisherVO(); - - public static final SubscriptionInfoVO SAMPLE_INFOVO = new SubscriptionInfoVO(); - public static final SubscriptionInfoVOes SAMPLE_INFOVOes = new SubscriptionInfoVOes(); - - static { - SAMPLE_PUBLISHERVO.setResName("BusinessGroup"); - SAMPLE_PUBLISHERVO.setResId(357886347l); - SAMPLE_PUBLISHERVO.setSubidentifier("toolforum"); - SAMPLE_PUBLISHERVO.setData("3456"); - SAMPLE_PUBLISHERVO.setType("Forum"); - SAMPLE_PUBLISHERVO.setBusinessPath("[BusinessGroup:357886347][toolforum:0]"); - - SAMPLE_INFOVO.setTitle("Infos"); - SAMPLE_INFOVOes.getSubscriptionInfos().add(SAMPLE_INFOVO); - } -} diff --git a/src/main/java/org/olat/core/commons/services/vfs/restapi/VFSWebservice.java b/src/main/java/org/olat/core/commons/services/vfs/restapi/VFSWebservice.java index 703b7aee10a..b8da4794d8d 100644 --- a/src/main/java/org/olat/core/commons/services/vfs/restapi/VFSWebservice.java +++ b/src/main/java/org/olat/core/commons/services/vfs/restapi/VFSWebservice.java @@ -97,9 +97,7 @@ public class VFSWebservice { /** * Retrieves the version of the Folder Course Node Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @@ -113,9 +111,8 @@ public class VFSWebservice { } /** - * This retrieves the files or a specific file in the root folder - * @response.representation.200.doc The list of files - * @response.representation.200.qname {http://www.example.com}linkVOes + * This retrieves the files or a specific file in the root folder. + * * @param uriInfo The uri infos * @param request The REST request * @return @@ -133,9 +130,8 @@ public class VFSWebservice { } /** - * This retrieves the files or a specific file in a folder - * @response.representation.200.doc The list of files or the file - * @response.representation.200.qname {http://www.example.com}linkVOes + * This retrieves the files or a specific file in a folder. + * * @param path the path to the folder * @param uriInfo The uri infos * @param request The REST request @@ -156,10 +152,9 @@ public class VFSWebservice { /** * This retrieves some metadata of a specific file in a folder - * The metadata are: filename, size, date of last modification, MIME-type and file href for downloading via REST - * @response.representation.200.doc The metadata of the file - * @response.representation.200.qname {http://www.example.com}fileMetadataVO - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_FILE_METADATA} + * The metadata are: filename, size, date of last modification, + * MIME-type and file href for downloading via REST. + * * @param path the path to the file * @param uriInfo The uri infos * @return @@ -180,9 +175,8 @@ public class VFSWebservice { /** * Upload a file to the root folder or create a new folder. One of the two sets - * of parameters must be set: foldername to create - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * of parameters must be set: foldername to create. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (optional) @@ -205,9 +199,8 @@ public class VFSWebservice { /** * Upload a file to the root folder or create a new folder. One of the two sets - * of parameters must be set: foldername to create - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * of parameters must be set: foldername to create. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (encoded with Base64) @@ -237,9 +230,8 @@ public class VFSWebservice { } /** - * Upload a file to the specified folder or create a new folder - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Upload a file to the specified folder or create a new folder. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (optional) @@ -263,9 +255,8 @@ public class VFSWebservice { } /** - * Upload a file to the specified folder or create a new folder - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Upload a file to the specified folder or create a new folder. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (encoded with Base64) @@ -296,9 +287,8 @@ public class VFSWebservice { } /** - * Upload a file to the root folder or create a new folder - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Upload a file to the root folder or create a new folder. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (optional) @@ -319,9 +309,8 @@ public class VFSWebservice { } /** - * Upload a file to the root folder or create a new folder - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Upload a file to the root folder or create a new folder. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (optional) @@ -349,9 +338,8 @@ public class VFSWebservice { } /** - * Upload a file to the specified folder or create a new folder - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Upload a file to the specified folder or create a new folder. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (optional) @@ -400,9 +388,8 @@ public class VFSWebservice { } /** - * Upload a file to the specified folder or create a new folder - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Upload a file to the specified folder or create a new folder. + * * @param foldername The name of the new folder (optional) * @param filename The name of the file (optional) * @param file The content of the file (optional) @@ -432,9 +419,8 @@ public class VFSWebservice { } /** - * Create folders - * @response.representation.200.doc The link to the created file - * @response.representation.200.qname {http://www.example.com}linkVO + * Create folders. + * * @param uriInfo The uri infos * @param path The path to the folder * @return The link to the created file diff --git a/src/main/java/org/olat/course/assessment/restapi/EfficiencyStatementWebService.java b/src/main/java/org/olat/course/assessment/restapi/EfficiencyStatementWebService.java index aea5c20b01b..c4763086a59 100644 --- a/src/main/java/org/olat/course/assessment/restapi/EfficiencyStatementWebService.java +++ b/src/main/java/org/olat/course/assessment/restapi/EfficiencyStatementWebService.java @@ -52,7 +52,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -76,11 +75,10 @@ public class EfficiencyStatementWebService { @GET @Path("{identityKey}") @Operation(summary = "Get statement", description = "Get statemenet") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The statement", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = EfficiencyStatementVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = EfficiencyStatementVO.class)) }), - @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") }) + @ApiResponse(responseCode = "200", description = "The statement", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = EfficiencyStatementVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = EfficiencyStatementVO.class)) }) + @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getEfficiencyStatement(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, @Context HttpServletRequest request) { @@ -104,19 +102,15 @@ public class EfficiencyStatementWebService { /** * Create a new efficiency statement. * - * @response.representation.200.doc If the statement was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the resource cannot be found * @param identityKey The owner of the certificate * @param resourceKey The primary key of the resource of the repository entry of the course. * @return Nothing special */ @PUT @Operation(summary = "Create a new efficiency statement", description = "Create a new efficiency statement") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "If the statement was persisted "), - @ApiResponse(responseCode = "401", description = "e roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity or the resource cannot be found") }) + @ApiResponse(responseCode = "200", description = "If the statement was persisted ") + @ApiResponse(responseCode = "401", description = "e roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity or the resource cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putEfficiencyStatement(@PathParam("resourceKey") Long resourceKey, @@ -127,9 +121,6 @@ public class EfficiencyStatementWebService { /** * Create a new efficiency statement. * - * @response.representation.200.doc If the statement was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the resource cannot be found * @param identityKey The owner of the certificate * @param resourceKey The primary key of the resource of the repository entry of the course. * @return Nothing special @@ -137,10 +128,9 @@ public class EfficiencyStatementWebService { @PUT @Path("{identityKey}") @Operation(summary = "Create a new efficiency statement", description = "Create a new efficiency statement") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "If the statement was persisted "), - @ApiResponse(responseCode = "401", description = "e roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity or the resource cannot be found") }) + @ApiResponse(responseCode = "200", description = "If the statement was persisted ") + @ApiResponse(responseCode = "401", description = "e roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity or the resource cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putEfficiencyStatement(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, diff --git a/src/main/java/org/olat/course/certificate/restapi/CertificationWebService.java b/src/main/java/org/olat/course/certificate/restapi/CertificationWebService.java index a5daa8a792c..aaeda1a4d7a 100644 --- a/src/main/java/org/olat/course/certificate/restapi/CertificationWebService.java +++ b/src/main/java/org/olat/course/certificate/restapi/CertificationWebService.java @@ -67,7 +67,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -91,10 +90,9 @@ public class CertificationWebService { @HEAD @Path("{identityKey}") @Operation(summary = "Return the certificate", description = "Return the certificate ") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The certificate"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") }) + @ApiResponse(responseCode = "200", description = "The certificate") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") @Produces({"application/pdf"}) public Response getCertificateInfo(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, @Context HttpServletRequest request) { @@ -130,10 +128,6 @@ public class CertificationWebService { /** * Return the certificate as PDF file. * - * @response.representation.200.mediaType application/pdf - * @response.representation.200.doc The certificate as file - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The owner or the certificate cannot be found * @param identityKey The owner of the certificate * @param resourceKey The primary key of the resource of the repository entry of the course. * @param request The request @@ -142,10 +136,9 @@ public class CertificationWebService { @GET @Path("{identityKey}") @Operation(summary = "Return the certificate as PDF file", description = "Return the certificate as PDF file") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The certificate as file"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") }) + @ApiResponse(responseCode = "200", description = "The certificate as file") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") @Produces({"application/pdf"}) public Response getCertificate(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, @Context HttpServletRequest request) { @@ -172,10 +165,9 @@ public class CertificationWebService { @DELETE @Path("{identityKey}") @Operation(summary = "Delete certificate", description = "Delete certificate") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The certificate was deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") }) + @ApiResponse(responseCode = "200", description = "The certificate was deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") public Response deleteCertificateInfo(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, @Context HttpServletRequest request) { Identity identity = securityManager.loadIdentityByKey(identityKey); @@ -207,10 +199,6 @@ public class CertificationWebService { /** * Generate a new certificate. * - * @response.representation.200.doc If the certificate was created - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the resource cannot be found - * @response.representation.500.doc An unexpected error happened during the creation of the certificate * @param identityKey The owner of the certificate * @param resourceKey The primary key of the resource of the repository entry of the course. * @param score The score which appears in the certificate @@ -222,11 +210,10 @@ public class CertificationWebService { @PUT @Path("{identityKey}") @Operation(summary = "Generate a new certificate", description = "Generate a new certificate") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "If the certificate was created "), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity or the resource cannot be found"), - @ApiResponse(responseCode = "500", description = "An unexpected error happened during the creation of the certificate")}) + @ApiResponse(responseCode = "200", description = "If the certificate was created ") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity or the resource cannot be found") + @ApiResponse(responseCode = "500", description = "An unexpected error happened during the creation of the certificate") public Response putCertificate(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, @QueryParam("score")@Parameter(description = "The score which appears in the certificate") Float score, @QueryParam("maxScore")@Parameter(description = "The max score which appears in the certificate") Float maxScore, @@ -283,9 +270,6 @@ public class CertificationWebService { /** * Upload a new certificate. * - * @response.representation.200.doc if the certificate was uploaded - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the resource cannot be found * @param identityKey The owner of the certificate * @param resourceKey The primary key of the resource of the repository entry of the course. * @param request The request @@ -294,10 +278,9 @@ public class CertificationWebService { @POST @Path("{identityKey}") @Operation(summary = "Upload a new certificate", description = "Upload a new certificate") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "if the certificate was uploaded"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") }) + @ApiResponse(responseCode = "200", description = "if the certificate was uploaded") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The owner or the certificate cannot be found") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response postCertificate(@PathParam("identityKey") Long identityKey, @PathParam("resourceKey") Long resourceKey, @Context HttpServletRequest request) { diff --git a/src/main/java/org/olat/course/db/restapi/CourseDbWebService.java b/src/main/java/org/olat/course/db/restapi/CourseDbWebService.java index c1576d39d2e..06fcd1c2a37 100644 --- a/src/main/java/org/olat/course/db/restapi/CourseDbWebService.java +++ b/src/main/java/org/olat/course/db/restapi/CourseDbWebService.java @@ -60,7 +60,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -83,9 +82,7 @@ public class CourseDbWebService { /** * Retrieves the version of the Course DB Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @@ -100,10 +97,7 @@ public class CourseDbWebService { /** * Retrieve all values of the authenticated user - * @response.representation.200.qname {http://www.example.com}keyValuePair - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc All the values in the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_KEYVALUEVOes} + * * @param courseId The course resourceable's id * @param category The name of the database * @param request The HTTP request @@ -113,14 +107,10 @@ public class CourseDbWebService { @Path("values") @Operation(summary = "Retrieve all values of the authenticated user", description = "Retrieve all values of the authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "All the values in the course", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) - } - )} - ) + @ApiResponse(responseCode = "200", description = "All the values in the course", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class)))}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getValues(@PathParam("courseId") Long courseId, @PathParam("category") String category, @Context HttpServletRequest request) { ICourse course = loadCourse(courseId); @@ -139,11 +129,7 @@ public class CourseDbWebService { /** * Put a new value for an authenticated user. - * @response.representation.qname {http://www.example.com}keyValuePair - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc the key value pair is saved on the db - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_KEYVALUEVOes} - * @response.representation.200.doc the key value pair is saved on the db + * * @param courseId The course resourceable's id * @param category The name of the database * @param pair The key value pair @@ -153,15 +139,12 @@ public class CourseDbWebService { @PUT @Path("values") @Operation(summary = "Put a new value for an authenticated user", - description = "Put a new value for an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "the key value pair is saved on the db", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) - } - )} - ) + description = "Put a new value for an authenticated user") + @ApiResponse(responseCode = "200", description = "the key value pair is saved on the db", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putValues(@PathParam("courseId") Long courseId, @PathParam("category") String category, KeyValuePair pair, @Context HttpServletRequest request) { return internPutValues(courseId, category, pair, request); @@ -169,11 +152,7 @@ public class CourseDbWebService { /** * Update a value for an authenticated user. - * @response.representation.qname {http://www.example.com}keyValuePair - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc the key value pair is saved on the db - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_KEYVALUEVOes} - * @response.representation.200.doc the key value pair is saved on the db + * * @param courseId The course resourceable's id * @param category The name of the database * @param pair The key value pair @@ -183,15 +162,12 @@ public class CourseDbWebService { @POST @Path("values") @Operation(summary = "Update a value for an authenticated user", - description = "Update a value for an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "the key value pair is saved on the db", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) - } - )} - ) + description = "Update a value for an authenticated user") + @ApiResponse(responseCode = "200", description = "the key value pair is saved on the db", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postValues(@PathParam("courseId") Long courseId, @PathParam("category") String category, KeyValuePair pair, @Context HttpServletRequest request) { return internPutValues(courseId, category, pair, request); @@ -199,11 +175,7 @@ public class CourseDbWebService { /** * Retrieve a value of an authenticated user. - * @response.representation.200.qname {http://www.example.com}keyValuePair - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The value in the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_KEYVALUEVO} - * @response.representation.404.doc The entry cannot be found + * * @param courseId The course resourceable's id * @param category The name of the database * @parma name The name of the key value pair @@ -214,18 +186,12 @@ public class CourseDbWebService { @Path("values/{name}") @Operation(summary = "Retrieve a value of an authenticated user", description = "Retrieve a value of an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The value in the course", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) - } - ), - @ApiResponse(responseCode = "204", description = "The entry cannot be found" - - ) - } - ) + @ApiResponse(responseCode = "200", description = "The value in the course", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) + }) + @ApiResponse(responseCode = "204", description = "The entry cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getValue(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @Context HttpServletRequest request) { ICourse course = loadCourse(courseId); @@ -242,11 +208,7 @@ public class CourseDbWebService { /** * Retrieve a value of an authenticated user. - * @response.representation.200.qname {http://www.example.com}keyValuePair - * @response.representation.200.mediaType text/plain, text/html - * @response.representation.200.doc A value of the course - * @response.representation.200.example Green - * @response.representation.404.doc The entry cannot be found + * * @param courseId The course resourceable's id * @param category The name of the database * @param name The name of the key value pair @@ -257,18 +219,12 @@ public class CourseDbWebService { @Path("values/{name}") @Operation(summary = "Retrieve a value of an authenticated user", description = "Retrieve a value of an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The value in the course", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) - } - ), - @ApiResponse(responseCode = "404", description = "The entry cannot be found" - - ) - } - ) + @ApiResponse(responseCode = "200", description = "The value in the course", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = KeyValuePair.class))) + }) + @ApiResponse(responseCode = "404", description = "The entry cannot be found") @Produces({MediaType.TEXT_PLAIN, MediaType.TEXT_HTML}) public Response getValuePlain(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @Context HttpServletRequest request) { @@ -286,7 +242,7 @@ public class CourseDbWebService { /** * Put a new value for an authenticated user. - * @response.representation.200.doc The value is saved in the course + * * @param courseId The course resourceable's id * @param category The name of the database * @param name The name of the key value pair @@ -297,11 +253,8 @@ public class CourseDbWebService { @PUT @Path("values/{name}") @Operation(summary = "Put a new value for an authenticated user", - description = "Put a new value for an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The value is saved in the course") - } - ) + description = "Put a new value for an authenticated user") + @ApiResponse(responseCode = "200", description = "The value is saved in the course") public Response putValue(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @QueryParam("value") @Parameter(description = "The value of the key value pair") String value, @Context HttpServletRequest request) { return internPutValue(courseId, category, name, value, request); @@ -309,7 +262,7 @@ public class CourseDbWebService { /** * Update a value for an authenticated user. - * @response.representation.200.doc The value is saved in the course + * * @param courseId The course resourceable's id * @param category The name of the database * @param name The name of the key value pair @@ -320,11 +273,8 @@ public class CourseDbWebService { @POST @Path("values/{name}") @Operation(summary = "Update a value for an authenticated user", - description = "Update a value for an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The value is saved in the course") - } - ) + description = "Update a value for an authenticated user") + @ApiResponse(responseCode = "200", description = "The value is saved in the course") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response formValue(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @FormParam("val") String value, @Context HttpServletRequest request){ @@ -333,9 +283,7 @@ public class CourseDbWebService { /** * Delete a value for an authenticated user. - * @response.representation.200.doc the key value pair is remove from the db - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The entry cannot be found + * * @param courseId The course resourceable's id * @param category The name of the database * @param name The name of the key value pair @@ -345,19 +293,10 @@ public class CourseDbWebService { @DELETE @Path("values/{name}") @Operation(summary = "Delete a value for an authenticated user", - description = "Delete a value for an authenticated user") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "the key value pair is remove from the db" - - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient" - - ), - @ApiResponse(responseCode = "404", description = "The entry cannot be found" - - ) - } - ) + description = "Delete a value for an authenticated user") + @ApiResponse(responseCode = "200", description = "the key value pair is remove from the db") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The entry cannot be found") public Response deleteValue(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @Context HttpServletRequest request) { UserRequest ureq = RestSecurityHelper.getUserRequest(request); @@ -376,9 +315,6 @@ public class CourseDbWebService { /** * Fallback method for the browsers * - * @response.representation.200.doc the key value pair is remove from the db - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The entry cannot be found * @param courseId The course resourceable's id * @param category The name of the database * @param name The name of the key value pair @@ -388,19 +324,10 @@ public class CourseDbWebService { @POST @Path("values/{name}/delete") @Operation(summary = "Fallback method for the browsers", - description = "Fallbakc method for the browsers") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "the key value pair is remove from the db" - - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient" - - ), - @ApiResponse(responseCode = "404", description = "The entry cannot be found" - - ) - } - ) + description = "Fallbakc method for the browsers") + @ApiResponse(responseCode = "200", description = "the key value pair is remove from the db") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The entry cannot be found") public Response deleteValuePost(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @Context HttpServletRequest request) { return deleteValue(courseId, category, name, request); diff --git a/src/main/java/org/olat/course/nodes/bc/BCWebService.java b/src/main/java/org/olat/course/nodes/bc/BCWebService.java index e12cfad51b7..c535c1b81b6 100644 --- a/src/main/java/org/olat/course/nodes/bc/BCWebService.java +++ b/src/main/java/org/olat/course/nodes/bc/BCWebService.java @@ -86,7 +86,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -107,12 +106,7 @@ public class BCWebService extends AbstractCourseNodeWebService { /** * Retrieves metadata of the course node - * @response.representation.200.qname {http://www.example.com}folderVOes - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_FOLDERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id * @param httpRequest The HTTP request @@ -121,16 +115,14 @@ public class BCWebService extends AbstractCourseNodeWebService { @GET @Operation(summary = "Retrieve metadata", description = "Retrieves metadata of the course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "TThe roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))) + } + ) + @ApiResponse(responseCode = "401", description = "TThe roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getFolders(@PathParam("courseId") Long courseId, @Context HttpServletRequest httpRequest) { final ICourse course = CoursesWebService.loadCourse(courseId); @@ -178,13 +170,7 @@ public class BCWebService extends AbstractCourseNodeWebService { /** * This attaches a Folder Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The folder node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this folder * @param position The node's position relative to its sibling nodes (optional) @@ -201,16 +187,14 @@ public class BCWebService extends AbstractCourseNodeWebService { @Operation(summary = "attach a Folder Element onto course", description = "This attaches a Folder Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + } + ) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachFolder(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") @Parameter(description = "The node's id which will be the parent of this folder") String parentNodeId, @@ -226,13 +210,6 @@ public class BCWebService extends AbstractCourseNodeWebService { /** * This attaches a Folder Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The folder node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this folder * @param position The node's position relative to its sibling nodes (optional) @@ -249,16 +226,14 @@ public class BCWebService extends AbstractCourseNodeWebService { @Operation(summary = "attach a Folder Element onto course", description = "This attaches a Folder Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The folder node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The folder node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + } + ) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachFolderPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -271,13 +246,6 @@ public class BCWebService extends AbstractCourseNodeWebService { /** * This updates a Folder Element onto a given course. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The folder node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found * @param courseId The course resourceable's id * @param nodeId The node's id of this folder * @param shortTitle The node short title @@ -293,16 +261,14 @@ public class BCWebService extends AbstractCourseNodeWebService { @Path("{nodeId}") @Operation(summary = "update a Folder Element onto course", description = "This updates a Folder Element onto a given course") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The folder node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The folder node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + } + ) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateFolder(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -316,12 +282,7 @@ public class BCWebService extends AbstractCourseNodeWebService { /** * Retrieves metadata of the course node - * @response.representation.200.qname {http://www.example.com}folderVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_FOLDERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id * @param httpRequest The HTTP request @@ -331,16 +292,14 @@ public class BCWebService extends AbstractCourseNodeWebService { @Path("{nodeId}") @Operation(summary = "Retrieves metadata of the course node", description = "Retrieves metadata of the course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = FolderVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = FolderVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = FolderVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = FolderVO.class)) + } + ) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getFolder(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) { ICourse course = CoursesWebService.loadCourse(courseId); @@ -377,6 +336,7 @@ public class BCWebService extends AbstractCourseNodeWebService { /** * Return the FX implementation to manage a folder. + * * @param courseId * @param nodeId * @param request @@ -385,11 +345,7 @@ public class BCWebService extends AbstractCourseNodeWebService { @Path("{nodeId}/files") @Operation(summary = "Return the FX implementation to manage a folder", description = "Return the FX implementation to manage a folder") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok" - - )} - ) + @ApiResponse(responseCode = "200", description = "Ok") public VFSWebservice getVFSWebService(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest request) { ICourse course = CoursesWebService.loadCourse(courseId); if(course == null) { diff --git a/src/main/java/org/olat/course/nodes/co/COWebService.java b/src/main/java/org/olat/course/nodes/co/COWebService.java index 393cc62553d..5044b7432fd 100755 --- a/src/main/java/org/olat/course/nodes/co/COWebService.java +++ b/src/main/java/org/olat/course/nodes/co/COWebService.java @@ -71,7 +71,6 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -92,14 +91,7 @@ public class COWebService extends AbstractCourseNodeWebService { /** * This attaches a contact element onto a given course, the element will be * inserted underneath the supplied parentNodeId - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this structure * @param position The node's position relative to its sibling nodes (optional) @@ -120,18 +112,15 @@ public class COWebService extends AbstractCourseNodeWebService { */ @PUT @Operation(summary = "attach a contact element onto a given course", - description = "This attaches a contact element onto a given course, the element will be\n" + + description = "This attaches a contact element onto a given course, the element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachContact(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") @Parameter(description = "The node's id which will be the parent of this structure")String parentNodeId, @@ -150,14 +139,7 @@ public class COWebService extends AbstractCourseNodeWebService { /** * This attaches a contact element onto a given course, the element will be * inserted underneath the supplied parentNodeId - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this * structure @@ -179,18 +161,15 @@ public class COWebService extends AbstractCourseNodeWebService { */ @POST @Operation(summary = "attach a contact element onto a given course", - description = "This attaches a contact element onto a given course, the element will be\n" + + description = "This attaches a contact element onto a given course, the element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachContactPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -218,7 +197,7 @@ public class COWebService extends AbstractCourseNodeWebService { private class ContactConfigDelegate implements CustomConfigDelegate { /** - * Depricated Configvalues + * Deprecated Configvalues */ private Boolean coaches; private Boolean participants; @@ -312,7 +291,7 @@ public class COWebService extends AbstractCourseNodeWebService { @Override public void configure(ICourse course, CourseNode newNode, ModuleConfiguration moduleConfig) { /** - * if depricatedconfig is used + * if deprecated config is used */ if(participants != null){ moduleConfig.set(CONFIG_KEY_EMAILTOGROUPS, getGroupNamesToString(groups)); diff --git a/src/main/java/org/olat/course/nodes/en/ENWebService.java b/src/main/java/org/olat/course/nodes/en/ENWebService.java index 6e3aaceea87..d6abe28e563 100644 --- a/src/main/java/org/olat/course/nodes/en/ENWebService.java +++ b/src/main/java/org/olat/course/nodes/en/ENWebService.java @@ -60,7 +60,6 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -83,14 +82,7 @@ public class ENWebService extends AbstractCourseNodeWebService { /** * This attaches an enrollment element onto a given course, the element will be * inserted underneath the supplied parentNodeId - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this structure * @param position The node's position relative to its sibling nodes (optional) @@ -106,18 +98,15 @@ public class ENWebService extends AbstractCourseNodeWebService { */ @PUT @Operation(summary = "attach an enrollment element onto a given course", - description = "This attaches a contact element onto a given course, the element will be\n" + + description = "This attaches a contact element onto a given course, the element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachEnrolmment(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") @Parameter(description = "The node's id which will be the parent of this structure") String parentNodeId, @@ -134,14 +123,7 @@ public class ENWebService extends AbstractCourseNodeWebService { /** * This attaches an enrollment element onto a given course, the element will be * inserted underneath the supplied parentNodeId - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this * structure @@ -158,18 +140,15 @@ public class ENWebService extends AbstractCourseNodeWebService { */ @POST @Operation(summary = "attach an enrollment element onto a given course", - description = "This attaches a contact element onto a given course, the element will be\n" + + description = "This attaches a contact element onto a given course, the element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachEnrollmenetPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -184,12 +163,7 @@ public class ENWebService extends AbstractCourseNodeWebService { /** * Retrieves the groups where the enrollment happens - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Retrieves the groups where the enrollment happens - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or course node not found + * * @param nodeId The node's id * @param httpRequest The HTTP request * @return An array of groups @@ -197,17 +171,14 @@ public class ENWebService extends AbstractCourseNodeWebService { @GET @Path("{nodeId}/groups") @Operation(summary = "Retrieves the groups where the enrollment happens", - description = "Retrieves the groups where the enrollment happens") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Retrieves the groups where the enrollment happens", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + description = "Retrieves the groups where the enrollment happens") + @ApiResponse(responseCode = "200", description = "Retrieves the groups where the enrollment happens", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getGroups(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) { ICourse course = CoursesWebService.loadCourse(courseId); @@ -241,8 +212,6 @@ public class ENWebService extends AbstractCourseNodeWebService { return Response.ok(voArr).build(); } - - private class EnrollmentConfigDelegate implements CustomConfigDelegate { private final boolean cancelEnabled; private final List<String> groups; diff --git a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementTypesWebService.java b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementTypesWebService.java index ea98c3116f3..fe0201067ab 100644 --- a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementTypesWebService.java +++ b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementTypesWebService.java @@ -51,7 +51,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -72,26 +71,18 @@ public class CurriculumElementTypesWebService { /** * Return the curriculum element types used in the whole OpenOLAT instance. * - * @response.representation.200.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of curriculum element types - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of curriculum element types */ @GET @Operation(summary = "Return the curriculum element types", - description = "Return the curriculum element types used in the whole OpenOLAT instance") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "An array of curriculum element types", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.")} - ) + description = "Return the curriculum element types used in the whole OpenOLAT instance") + @ApiResponse(responseCode = "200", description = "An array of curriculum element types", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getElementTypes() { List<CurriculumElementType> elementTypes = curriculumService.getCurriculumElementTypes(); @@ -106,31 +97,19 @@ public class CurriculumElementTypesWebService { /** * Creates and persists a new curriculum element type entity. * - * @response.representation.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element type to persist - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted curriculum element type - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumelementType The curriculum element type to persist * @return The new persisted <code>curriculum element type</code> */ @PUT @Operation(summary = "Create and persists a new curriculum element type entity", - description = "Creates and persists a new curriculum element type entity") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The persisted curriculum element type", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "406", description = "application/xml, application/json.")} - ) + description = "Creates and persists a new curriculum element type entity") + @ApiResponse(responseCode = "200", description = "The persisted curriculum element type", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "406", description = "application/xml, application/json.") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putCurriculumElementType(CurriculumElementTypeVO curriculumelementType) { @@ -141,31 +120,19 @@ public class CurriculumElementTypesWebService { /** * Updates a new curriculum element type entity. * - * @response.representation.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element type to update - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged curriculum element type - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumElementType The curriciulum element type to merge * @return The merged <code>curriculum element type</code> */ @POST @Operation(summary = "Update a new curriculum element type entity", - description = "Updates a new curriculum element type entity") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The merged curriculum element type", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "406", description = "application/xml, application/json.")} - ) + description = "Updates a new curriculum element type entity") + @ApiResponse(responseCode = "200", description = "The merged curriculum element type", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "406", description = "application/xml, application/json.") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postCurriculumElementType(CurriculumElementTypeVO curriculumElementType) { @@ -177,15 +144,6 @@ public class CurriculumElementTypesWebService { * Updates a new curriculum element type entity. The primary key is taken from * the URL. The curriculum element type object can be "primary key free". * - * @response.representation.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element type to update - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged type curriculum element - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumElementTypeKey The curriculum element type primary key * @param curriculumElementType The curriculum element type to merge * @return The merged <code>curriculum element type</code> @@ -193,18 +151,15 @@ public class CurriculumElementTypesWebService { @POST @Path("{curriculumElementTypeKey}") @Operation(summary = "Update a new curriculum element type entity", - description = "Updates a new curriculum element type entity. The primary key is taken from\n" + + description = "Updates a new curriculum element type entity. The primary key is taken from\n" + " the URL. The curriculum element type object can be \"primary key free\"") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The merged type curriculum element", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "406", description = "application/xml, application/json.")} - ) + @ApiResponse(responseCode = "200", description = "The merged type curriculum element", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "406", description = "application/xml, application/json.") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postCurriculumElementType(@PathParam("curriculumElementTypeKey") Long curriculumElementTypeKey, @@ -250,27 +205,19 @@ public class CurriculumElementTypesWebService { /** * Get a specific curriculum element type. * - * @response.representation.200.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The curriculum element type - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param curriculumElementTypeKey The curriculum element type primary key * @return The curriculum element type */ @GET @Path("{curriculumElementTypeKey}") @Operation(summary = "Get a specific curriculum element type", - description = "Get a specific curriculum element type") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The merged type curriculum element", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.")} - ) + description = "Get a specific curriculum element type") + @ApiResponse(responseCode = "200", description = "The merged type curriculum element", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementTypeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculumElementTypes(@PathParam("curriculumElementTypeKey") Long curriculumElementTypeKey) { CurriculumElementType elementType = curriculumService.getCurriculumElementType(new CurriculumElementTypeRefImpl(curriculumElementTypeKey)); @@ -283,29 +230,20 @@ public class CurriculumElementTypesWebService { /** * Get the allowed sub-types of a specified curriculum element type. * - * @response.representation.200.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of curriculum element types - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element type was not found * @param curriculumElementTypeKey The curriculum element type primary key * @return An array of curriculum element types */ @GET @Path("{curriculumElementTypeKey}/allowedSubTypes") @Operation(summary = "Get the allowed sub-types", - description = "Get the allowed sub-types of a specified curriculum element type") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "An array of curriculum element types", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "405", description = "The curriculum element type was not found")} - ) + description = "Get the allowed sub-types of a specified curriculum element type") + @ApiResponse(responseCode = "200", description = "An array of curriculum element types", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementTypeVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "405", description = "The curriculum element type was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getAllowedSubTypes(@PathParam("curriculumElementTypeKey") Long curriculumElementTypeKey) { CurriculumElementType type = curriculumService.getCurriculumElementType(new CurriculumElementTypeRefImpl(curriculumElementTypeKey)); @@ -324,12 +262,6 @@ public class CurriculumElementTypesWebService { /** * Add a sub-type to a specified curriculum element type. * - * @response.representation.200.qname {http://www.example.com}curriculumElementTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The sub type was added to the allowed sub types - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element type was not found * @param curriculumElementTypeKey The type * @param subTypeKey The sub type * @return Nothing @@ -337,13 +269,10 @@ public class CurriculumElementTypesWebService { @PUT @Path("{curriculumElementTypeKey}/allowedSubTypes/{subTypeKey}") @Operation(summary = "Add a sub-type to a specified curriculum element type", - description = "Add a sub-type to a specified curriculum element type") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The sub type was added to the allowed sub types" - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "405", description = "The curriculum element type was not found")} - ) + description = "Add a sub-type to a specified curriculum element type") + @ApiResponse(responseCode = "200", description = "The sub type was added to the allowed sub types") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "405", description = "The curriculum element type was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response allowSubTaxonomyLevelType(@PathParam("curriculumElementTypeKey") Long curriculumElementTypeKey, @PathParam("subTypeKey") Long subTypeKey) { CurriculumElementType type = curriculumService.getCurriculumElementType(new CurriculumElementTypeRefImpl(curriculumElementTypeKey)); @@ -359,9 +288,6 @@ public class CurriculumElementTypesWebService { /** * Remove a sub-type to a specified curriculum element type. * - * @response.representation.200.doc The sub type was removed successfully - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element type was not found * @param curriculumElementTypeKey The type * @param subTypeKey The sub type to remove * @return Nothing @@ -369,12 +295,10 @@ public class CurriculumElementTypesWebService { @DELETE @Path("{curriculumElementTypeKey}/allowedSubTypes/{subTypeKey}") @Operation(summary = "Remove a sub-type to a specified curriculum element type", - description = "Remove a sub-type to a specified curriculum element type") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The sub type was removed successfully"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "405", description = "The curriculum element type was not found")} - ) + description = "Remove a sub-type to a specified curriculum element type") + @ApiResponse(responseCode = "200", description = "The sub type was removed successfully") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "405", description = "The curriculum element type was not found") public Response disalloweSubType(@PathParam("curriculumElementTypeKey") Long curriculumElementTypeKey, @PathParam("subTypeKey") Long subTypeKey) { CurriculumElementType type = curriculumService.getCurriculumElementType(new CurriculumElementTypeRefImpl(curriculumElementTypeKey)); CurriculumElementType subType = curriculumService.getCurriculumElementType(new CurriculumElementTypeRefImpl(subTypeKey)); diff --git a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementsWebService.java b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementsWebService.java index ebe9e061c85..8185cc0836e 100644 --- a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementsWebService.java +++ b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumElementsWebService.java @@ -74,7 +74,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** @@ -109,27 +108,19 @@ public class CurriculumElementsWebService { /** * Return the curriculum elements of a curriculum. * - * @response.representation.200.qname {http://www.example.com}curriculumElementVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param taxonomyKey If true, the status of the block is done or the status of the roll call is closed or auto closed * @param httpRequest The HTTP request * @return The taxonomy */ @GET @Operation(summary = "Return the curriculum elements of a curriculum", - description = "Return the curriculum elements of a curriculum") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "A taxonomy", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) + description = "Return the curriculum elements of a curriculum") + @ApiResponse(responseCode = "200", description = "A taxonomy", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculumElements() { List<CurriculumElement> elements = curriculumService.getCurriculumElements(curriculum, CurriculumElementStatus.notDeleted()); @@ -143,11 +134,6 @@ public class CurriculumElementsWebService { /** * Get a specific curriculum element. * - * @response.representation.200.qname {http://www.example.com}curriculumElementVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The curriculum element - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param curriculumElementKey The curriculum element primary key * @param httpRequest The HTTP request * @return The curriculum element @@ -155,16 +141,13 @@ public class CurriculumElementsWebService { @GET @Path("{curriculumElementKey}") @Operation(summary = "Get a specific curriculum element", - description = "Get a specific curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum element", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) + description = "Get a specific curriculum element") + @ApiResponse(responseCode = "200", description = "The curriculum element", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculumElement(@PathParam("curriculumElementKey") Long curriculumElementKey, @Context HttpServletRequest httpRequest) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -178,31 +161,19 @@ public class CurriculumElementsWebService { /** * Creates and persists a new curriculum element entity. * - * @response.representation.qname {http://www.example.com}curriculumElementVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element to persist - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted curriculum element - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumElement The curriculum element to persist * @return The new persisted <code>curriculum element</code> */ @PUT @Operation(summary = "Creates and persists a new curriculum element entity", - description = "Creates and persists a new curriculum element entity") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum element to persist", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + description = "Creates and persists a new curriculum element entity") + @ApiResponse(responseCode = "200", description = "The curriculum element to persist", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putCurriculumElement(CurriculumElementVO curriculumElement) @@ -214,31 +185,19 @@ public class CurriculumElementsWebService { /** * Updates a curriculum element entity. * - * @response.representation.qname {http://www.example.com}curriculumElementVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element to update - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged curriculum element - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumElement The curriculum element to merge * @return The merged <code>curriculum element</code> */ @POST @Operation(summary = "Updates a curriculum element entity", - description = "Updates a curriculum element entity") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum element to update", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + description = "Updates a curriculum element entity") + @ApiResponse(responseCode = "200", description = "The curriculum element to update", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postCurriculumElement(CurriculumElementVO curriculumElement) @@ -251,15 +210,6 @@ public class CurriculumElementsWebService { * Updates a curriculum element entity. The primary key is taken from * the URL. The curriculum element object can be "primary key free". * - * @response.representation.qname {http://www.example.com}curriculumElementVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element to update - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged curriculum element - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumElementKey The curriculum element primary key * @param curriculumElement The curriculum element to merge * @return The merged <code>curriculum element</code> @@ -267,18 +217,15 @@ public class CurriculumElementsWebService { @POST @Path("{curriculumElementKey}") @Operation(summary = "Updates a curriculum element entity", - description = "Updates a curriculum element entity. The primary key is taken from\n" + + description = "Updates a curriculum element entity. The primary key is taken from\n" + " the URL. The curriculum element object can be \"primary key free\"") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum element to update", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + @ApiResponse(responseCode = "200", description = "The curriculum element to update", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postCurriculumElement(@PathParam("curriculumElementKey") Long curriculumElementKey, CurriculumElementVO curriculumElement) @@ -367,29 +314,20 @@ public class CurriculumElementsWebService { /** * Get the curriculum elements laying under the specified curriculum element. * - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc Get the curriculum elements under the specified element - * @response.representation.200.doc The curriculum elements under the specified element - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element was not found * @param curriculumElementKey The curriculum element * @return An array of curriculum elements */ @GET @Path("{curriculumElementKey}/elements") @Operation(summary = "Get the curriculum elements", - description = "Get the curriculum elements laying under the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum elements under the specified element", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element was not found")} - ) + description = "Get the curriculum elements laying under the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The curriculum elements under the specified element", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element was not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculumElementChildren(@PathParam("curriculumElementKey") Long curriculumElementKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -410,31 +348,20 @@ public class CurriculumElementsWebService { /** * Get the repository entries laying under the specified curriculum element. * - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc Get the repository entries - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The repository entries - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the repository entry was not found * @param curriculumElementKey The curriculum element * @return An array of repository entries */ @GET @Path("{curriculumElementKey}/entries") @Operation(summary = "Get the repository entries", - description = "Get the repository entries laying under the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The repository entries", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found")} - ) + description = "Get the repository entries laying under the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The repository entries", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRepositoryEntriesInElement(@PathParam("curriculumElementKey") Long curriculumElementKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -455,9 +382,6 @@ public class CurriculumElementsWebService { /** * To see if a repository entry is under the specified curriculum element. * - * @response.representation.200.doc The repository entry is there - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the repository entry was not found * @param curriculumElementKey The curriculum element * @param repositoryEntryKey The repository entry * @return Nothing @@ -465,12 +389,10 @@ public class CurriculumElementsWebService { @HEAD @Path("{curriculumElementKey}/entries/{repositoryEntryKey}") @Operation(summary = "see if a repository entry is under curriculum element", - description = "To see if a repository entry is under the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The repository entry is there"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found")} - ) + description = "To see if a repository entry is under the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The repository entry is there") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response headRepositoryEntryInElement(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("repositoryEntryKey") Long repositoryEntryKey) { @@ -494,31 +416,20 @@ public class CurriculumElementsWebService { /** * Load the repository entry laying under the specified curriculum element. * - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc Get the repository entries - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The repository entries - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the repository entry was not found * @param curriculumElementKey The curriculum element * @return An array of repository entries */ @GET @Path("{curriculumElementKey}/entries/{repositoryEntryKey}") @Operation(summary = "Load the repository entry", - description = "Load the repository entry laying under the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The repository entries", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found")} - ) + description = "Load the repository entry laying under the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The repository entries", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRepositoryEntryInElement(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("repositoryEntryKey") Long repositoryEntryKey) { @@ -542,10 +453,6 @@ public class CurriculumElementsWebService { /** * Add a relation between a repository entry and a curriculum element. * - * @response.representation.200.doc The relation was added - * @response.representation.304.doc There is already a relation, nothing changed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the repository entry was not found * @param curriculumElementKey The curriculum element * @param repositoryEntryKey The repository entry * @return Nothing @@ -553,13 +460,11 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/entries/{repositoryEntryKey}") @Operation(summary = "Add a relation", - description = "Add a relation between a repository entry and a curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The relation was added"), - @ApiResponse(responseCode = "304", description = "There is already a relation, nothing changed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found")} - ) + description = "Add a relation between a repository entry and a curriculum element") + @ApiResponse(responseCode = "200", description = "The relation was added") + @ApiResponse(responseCode = "304", description = "There is already a relation, nothing changed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found") public Response addRepositoryEntryToElement(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("repositoryEntryKey") Long repositoryEntryKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -585,10 +490,6 @@ public class CurriculumElementsWebService { /** * Remove a relation between a curriculum element and a repository entry. * - * @response.representation.200.doc The relation was successfully removed. - * @response.representation.304.doc There is no relation to remove - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the repository entry was not found * @param curriculumElementKey The curriculum element * @param repositoryEntryKey The repository entry * @return Nothing @@ -596,13 +497,11 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/entries/{repositoryEntryKey}") @Operation(summary = "Remove a relation", - description = "Remove a relation between a curriculum element and a repository entry") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The relation was successfully removed"), - @ApiResponse(responseCode = "304", description = "here is no relation to remove"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found")} - ) + description = "Remove a relation between a curriculum element and a repository entry") + @ApiResponse(responseCode = "200", description = "The relation was successfully removed") + @ApiResponse(responseCode = "304", description = "here is no relation to remove") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the repository entry was not found") public Response removeRepositoryEntryToElement(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("repositoryEntryKey") Long repositoryEntryKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -627,11 +526,6 @@ public class CurriculumElementsWebService { /** * Get the memberships informations of the specified curriculum element. * - * @response.representation.200.qname {http://www.example.com}curriculumElementMemberVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The curriculum element membership - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTMEMBERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param curriculumElementKey The curriculum element primary key * @param httpRequest The HTTP request * @return The curriculum element @@ -639,16 +533,13 @@ public class CurriculumElementsWebService { @GET @Path("{curriculumElementKey}/members") @Operation(summary = "Get memberships informations", - description = "Get the memberships informations of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum element membership", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementMemberVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementMemberVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) + description = "Get the memberships informations of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The curriculum element membership", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumElementMemberVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumElementMemberVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response getMembers(@PathParam("curriculumElementKey") Long curriculumElementKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); if(curriculumElement == null) { @@ -671,29 +562,21 @@ public class CurriculumElementsWebService { * Get all members of the specified curriculum element. A query parameter can * specify the role of them. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of authors - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @GET @Path("{curriculumElementKey}/users") @Operation(summary = "Get all members", - description = "Get all members of the specified curriculum element. A query parameter can\n" + + description = "Get all members of the specified curriculum element. A query parameter can\n" + " specify the role of them") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of authors", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "401", description = "The course not found")} - ) + @ApiResponse(responseCode = "200", description = "The array of authors", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "401", description = "The course not found") public Response getUsers(@PathParam("curriculumElementKey") Long curriculumElementKey, @QueryParam("role") @Parameter(description = "Filter by specific role") String role) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); if(curriculumElement == null) { @@ -717,14 +600,6 @@ public class CurriculumElementsWebService { /** * Add a membership to the specified curriculum element. * - * @response.representation.qname {http://www.example.com}curriculumElementMemberVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTMEMBERVO} - * @response.representation.200.doc The membership was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param curriculumElementKey The curriculum element primary key * @param membership The membership informations * @return Nothing @@ -732,13 +607,11 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/members") @Operation(summary = "Add a membership ", - description = "Add a membership to the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was persisted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")} - ) + description = "Add a membership to the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was persisted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") public Response putMembers(@PathParam("curriculumElementKey") Long curriculumElementKey, CurriculumElementMemberVO membership) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -764,9 +637,6 @@ public class CurriculumElementsWebService { /** * Remove all memberships of the identity from the specified curriculum element. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -774,12 +644,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/members/{identityKey}") @Operation(summary = "Remove all memberships ", - description = "Remove all memberships of the identity from the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Remove all memberships of the identity from the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response deleteMembers(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -801,29 +669,20 @@ public class CurriculumElementsWebService { /** * Get all participants of the specified curriculum element. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of participants - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element not found * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @GET @Path("{curriculumElementKey}/participants") @Operation(summary = "Get all participants", - description = "Get all participants of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of participants", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Get all participants of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The array of participants", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getParticipants(@PathParam("curriculumElementKey") Long curriculumElementKey) { return getMembers(curriculumElementKey, CurriculumRoles.participant); @@ -832,29 +691,20 @@ public class CurriculumElementsWebService { /** * Get all coaches of the specified curriculum element. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of coaches - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element not found * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @GET @Path("{curriculumElementKey}/coaches") @Operation(summary = "Get all coaches", - description = "Get all coaches of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of coaches", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Get all coaches of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The array of coaches", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCoaches(@PathParam("curriculumElementKey") Long curriculumElementKey) { return getMembers(curriculumElementKey, CurriculumRoles.coach); @@ -863,29 +713,20 @@ public class CurriculumElementsWebService { /** * Get all owners of the specified curriculum element. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of coaches - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element not found * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @GET @Path("{curriculumElementKey}/owners") @Operation(summary = "Get all owners", - description = "Get all owners of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of owners", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Get all owners of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The array of owners", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOwners(@PathParam("curriculumElementKey") Long curriculumElementKey) { return getMembers(curriculumElementKey, CurriculumRoles.owner); @@ -894,29 +735,21 @@ public class CurriculumElementsWebService { /** * Get all master coaches of the specified curriculum element. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of coaches - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element not found * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @GET @Path("{curriculumElementKey}/mastercoaches") @Operation(summary = "Get all master coaches", - description = "Get all master coaches of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of master coaches", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Get all master coaches of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The array of master coaches", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + } + ) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMasterCoaches(@PathParam("curriculumElementKey") Long curriculumElementKey) { return getMembers(curriculumElementKey, CurriculumRoles.mastercoach); @@ -925,29 +758,20 @@ public class CurriculumElementsWebService { /** * Get all curriculum managers of the specified curriculum element. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of curriculum managers - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element not found * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @GET @Path("{curriculumElementKey}/curriculumelementowners") @Operation(summary = "Get all curriculum managers", - description = "Get all curriculum managers of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of curriculum managers", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Get all curriculum managers of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The array of curriculum managers", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculumManagers(@PathParam("curriculumElementKey") Long curriculumElementKey) { return getMembers(curriculumElementKey, CurriculumRoles.curriculumelementowner); @@ -972,9 +796,6 @@ public class CurriculumElementsWebService { /** * Make the specified user a participant of the curriculum element. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to make a participant of * @return Nothing @@ -982,12 +803,10 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/participants/{identityKey}") @Operation(summary = "Make the specified user a participant of the curriculum element ", - description = "Make the specified user a participant of the curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Make the specified user a participant of the curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response putParticipant(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return putMember(curriculumElementKey, identityKey, CurriculumRoles.participant); } @@ -995,9 +814,6 @@ public class CurriculumElementsWebService { /** * Make the specified user a coach of the curriculum element. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to make a coach of * @return Nothing @@ -1005,12 +821,10 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/coaches/{identityKey}") @Operation(summary = "Make the specified user a coach of the curriculum element", - description = "Make the specified user a coach of the curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Make the specified user a coach of the curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response putCoach(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return putMember(curriculumElementKey, identityKey, CurriculumRoles.coach); } @@ -1018,9 +832,6 @@ public class CurriculumElementsWebService { /** * Make the specified user a course owner of the curriculum element. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to make a course owner of * @return Nothing @@ -1028,12 +839,10 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/owners/{identityKey}") @Operation(summary = "Make the specified user a course owner of the curriculum element", - description = "Make the specified user a course owner of the curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Make the specified user a course owner of the curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response putOwner(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return putMember(curriculumElementKey, identityKey, CurriculumRoles.owner); } @@ -1041,9 +850,6 @@ public class CurriculumElementsWebService { /** * Make the specified user a curriculum manager of the curriculum element. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to make a curriculum manager of * @return Nothing @@ -1051,12 +857,10 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/curriculumelementowners/{identityKey}") @Operation(summary = "Make the specified user a curriculum manager of the curriculum element", - description = "Make the specified user a curriculum manager of the curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Make the specified user a curriculum manager of the curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response putCurriculumElementOwner(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return putMember(curriculumElementKey, identityKey, CurriculumRoles.curriculumelementowner); } @@ -1064,9 +868,6 @@ public class CurriculumElementsWebService { /** * Make the specified user a master coach of the curriculum element. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to make a curriculum manager of * @return Nothing @@ -1074,12 +875,10 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/mastercoaches/{identityKey}") @Operation(summary = "Make the specified user a master coach of the curriculum element", - description = "Make the specified user a master coach of the curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Make the specified user a master coach of the curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response putMasterCoach(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return putMember(curriculumElementKey, identityKey, CurriculumRoles.mastercoach); } @@ -1104,14 +903,6 @@ public class CurriculumElementsWebService { /** * Make the array of users participant of the specified curriculum element. * - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.200.doc The memberships was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param curriculumElementKey The curriculum element primary key * @param participants The future participants * @return Nothing @@ -1119,18 +910,15 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/participants") @Operation(summary = "Make the array of users participant of the specified curriculum element", - description = "Make the array of users participant of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The memberships was persisted", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")} - ) + description = "Make the array of users participant of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The memberships was persisted", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putParticipants(@PathParam("curriculumElementKey") Long curriculumElementKey, UserVO[] participants) { return putMembers(curriculumElementKey, participants, CurriculumRoles.participant); @@ -1139,14 +927,6 @@ public class CurriculumElementsWebService { /** * Make the array of users coach of the specified curriculum element. * - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.200.doc The memberships was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param curriculumElementKey The curriculum element primary key * @param participants The future coaches * @return Nothing @@ -1154,13 +934,11 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/coaches") @Operation(summary = "Make the array of users coach of the specified curriculum element", - description = "Make the array of users coach of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The memberships was persisted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")} - ) + description = "Make the array of users coach of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The memberships was persisted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putCoaches(@PathParam("curriculumElementKey") Long curriculumElementKey, UserVO[] coaches) { return putMembers(curriculumElementKey, coaches, CurriculumRoles.coach); @@ -1169,14 +947,6 @@ public class CurriculumElementsWebService { /** * Make the array of users course owner of the specified curriculum element. * - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.200.doc The memberships was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param curriculumElementKey The curriculum element primary key * @param owners The future course owners * @return Nothing @@ -1184,13 +954,11 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/owners") @Operation(summary = "Make the array of users course owner of the specified curriculum element", - description = "Make the array of users course owner of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The memberships was persisted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")} - ) + description = "Make the array of users course owner of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The memberships was persisted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putOwners(@PathParam("curriculumElementKey") Long curriculumElementKey, UserVO[] owners) { return putMembers(curriculumElementKey, owners, CurriculumRoles.owner); @@ -1199,14 +967,6 @@ public class CurriculumElementsWebService { /** * Make the array of users course master coaches of the specified curriculum element. * - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.200.doc The memberships was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param curriculumElementKey The curriculum element primary key * @param masterCoaches The future master coaches * @return Nothing @@ -1214,13 +974,11 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/mastercoaches") @Operation(summary = "Make the array of users course master coaches of the specified curriculum element", - description = "Make the array of users course master coaches of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The memberships was persisted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")} - ) + description = "Make the array of users course master coaches of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The memberships was persisted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putMasterCoaches(@PathParam("curriculumElementKey") Long curriculumElementKey, UserVO[] masterCoaches) { return putMembers(curriculumElementKey, masterCoaches, CurriculumRoles.mastercoach); @@ -1229,14 +987,6 @@ public class CurriculumElementsWebService { /** * Make the array of users curriculum managers of the specified curriculum element. * - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.200.doc The memberships was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param curriculumElementKey The curriculum element primary key * @param participants The future curriculum manages * @return Nothing @@ -1244,13 +994,11 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/curriculumelementowners") @Operation(summary = "Make the array of users curriculum managers of the specified curriculum element", - description = "Make the array of users curriculum managers of the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The memberships was persisted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")} - ) + description = "Make the array of users curriculum managers of the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The memberships was persisted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putCurriculumManagers(@PathParam("curriculumElementKey") Long curriculumElementKey, UserVO[] coaches) { return putMembers(curriculumElementKey, coaches, CurriculumRoles.curriculumelementowner); @@ -1277,9 +1025,6 @@ public class CurriculumElementsWebService { /** * Remove the participant membership of the identity from the specified curriculum element. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -1287,12 +1032,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/participants/{identityKey}") @Operation(summary = "Remove the participant membership", - description = "Remove the participant membership of the identity from the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Remove the participant membership of the identity from the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") public Response deleteParticipant(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return deleteMember(curriculumElementKey, identityKey, CurriculumRoles.participant); @@ -1301,9 +1044,6 @@ public class CurriculumElementsWebService { /** * Remove the coach membership of the identity from the specified curriculum element. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -1311,12 +1051,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/coaches/{identityKey}") @Operation(summary = "Remove the coach membership", - description = "Remove the coach membership of the identity from the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Remove the coach membership of the identity from the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") public Response deleteCoach(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return deleteMember(curriculumElementKey, identityKey, CurriculumRoles.coach); @@ -1325,9 +1063,6 @@ public class CurriculumElementsWebService { /** * Remove the owner membership of the identity from the specified curriculum element. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -1335,12 +1070,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/owners/{identityKey}") @Operation(summary = "Remove the owners membership", - description = "Remove the owners membership of the identity from the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Remove the owners membership of the identity from the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") public Response deleteOwner(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return deleteMember(curriculumElementKey, identityKey, CurriculumRoles.owner); @@ -1349,9 +1082,6 @@ public class CurriculumElementsWebService { /** * Remove the master coach membership of the identity from the specified curriculum element. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -1359,12 +1089,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/mastercoaches/{identityKey}") @Operation(summary = "Remove the master coach membership", - description = "Remove the master coach membership of the identity from the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Remove the master coach membership of the identity from the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") public Response deleteMasterCoach(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return deleteMember(curriculumElementKey, identityKey, CurriculumRoles.mastercoach); @@ -1373,9 +1101,6 @@ public class CurriculumElementsWebService { /** * Remove the curriculum manager membership of the identity from the specified curriculum element. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -1383,12 +1108,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/curriculumelementowners/{identityKey}") @Operation(summary = "Remove the curriculum manager membership", - description = "Remove the curriculum manager membership of the identity from the specified curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element not found")} - ) + description = "Remove the curriculum manager membership of the identity from the specified curriculum element") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element not found") public Response deleteCurriculumManager(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("identityKey") Long identityKey) { return deleteMember(curriculumElementKey, identityKey, CurriculumRoles.curriculumelementowner); @@ -1414,17 +1137,14 @@ public class CurriculumElementsWebService { @GET @Path("{curriculumElementKey}/taxonomy/levels") @Operation(summary = "Get levels", - description = "Get levels from a specific curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The list of levels", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum or curriculum element not found")} - ) + description = "Get levels from a specific curriculum element") + @ApiResponse(responseCode = "200", description = "The list of levels", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum or curriculum element not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTaxonomyLevels(@PathParam("curriculumElementKey") Long curriculumElementKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -1445,17 +1165,14 @@ public class CurriculumElementsWebService { @PUT @Path("{curriculumElementKey}/taxonomy/levels/{taxonomyLevelKey}") @Operation(summary = "Put level", - description = "Put level from a specific curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The level", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum or curriculum element not found")} - ) + description = "Put level from a specific curriculum element") + @ApiResponse(responseCode = "200", description = "The level", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum or curriculum element not found") public Response getTaxonomyLevels(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); @@ -1484,13 +1201,10 @@ public class CurriculumElementsWebService { @DELETE @Path("{curriculumElementKey}/taxonomy/levels/{taxonomyLevelKey}") @Operation(summary = "Delete level", - description = "Delete level from a specific curriculum element") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Remove level" - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum or curriculum element not found")} - ) + description = "Delete level from a specific curriculum element") + @ApiResponse(responseCode = "200", description = "Remove level") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum or curriculum element not found") public Response deleteTaxonomyLevel(@PathParam("curriculumElementKey") Long curriculumElementKey, @PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { CurriculumElement curriculumElement = curriculumService.getCurriculumElement(new CurriculumElementRefImpl(curriculumElementKey)); diff --git a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java index d706e623921..6632ffccae0 100644 --- a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java +++ b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java @@ -20,8 +20,8 @@ package org.olat.modules.curriculum.restapi; -import static org.olat.restapi.security.RestSecurityHelper.getRoles; import static org.olat.restapi.security.RestSecurityHelper.getIdentity; +import static org.olat.restapi.security.RestSecurityHelper.getRoles; import java.util.ArrayList; import java.util.List; @@ -63,11 +63,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -92,18 +91,13 @@ public class CurriculumsWebService { /** * - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 * @return The version number */ @GET @Path("version") @Operation(summary = "Get the version of the User Web Service", - description = "Get the version of the User Web Service") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service")} - ) + description = "Get the version of the User Web Service") + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -112,26 +106,18 @@ public class CurriculumsWebService { /** * Return the curriculums a manager user is allowed to see. * - * @response.representation.200.qname {http://www.example.com}curriculumVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of curriculums - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of curriculums */ @GET @Operation(summary = "Return the curriculums a manager user is allowed to see", - description = "Return the curriculums a manager user is allowed to see") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "An array of curriculums", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) + description = "Return the curriculums a manager user is allowed to see") + @ApiResponse(responseCode = "200", description = "An array of curriculums", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculums(@Context HttpServletRequest httpRequest) { Roles roles = getRoles(httpRequest); @@ -165,32 +151,20 @@ public class CurriculumsWebService { /** * Creates and persists a new curriculum. * - * @response.representation.qname {http://www.example.com}curriculumVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum to persist - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted curriculum - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculum The curriculum to persist * @param request The HTTP request * @return The new persisted <code>curriculum</code> */ @PUT @Operation(summary = "Creates and persists a new curriculum", - description = "Creates and persists a new curriculum") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The persisted curriculum", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + description = "Creates and persists a new curriculum") + @ApiResponse(responseCode = "200", description = "The persisted curriculum", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putCurriculum(CurriculumVO curriculum, @Context HttpServletRequest httpRequest) { @@ -206,32 +180,20 @@ public class CurriculumsWebService { /** * Updates a curriculum entity. * - * @response.representation.qname {http://www.example.com}curriculumVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum to update - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged curriculum - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculum The curriculum to merge * @param request The HTTP request * @return The merged <code>curriculum</code> */ @POST @Operation(summary = "Updates a curriculum entity", - description = "Updates a curriculum entity") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum to update", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + description = "Updates a curriculum entity") + @ApiResponse(responseCode = "200", description = "The curriculum to update", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postCurriculum(CurriculumVO curriculum, @Context HttpServletRequest httpRequest) { @@ -247,11 +209,6 @@ public class CurriculumsWebService { /** * Get a specific curriculum. * - * @response.representation.200.qname {http://www.example.com}curriculumVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The curriculum - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param curriculumKey The curriculum primary key * @param httpRequest The HTTP request * @return The curriculum @@ -259,17 +216,14 @@ public class CurriculumsWebService { @GET @Path("{curriculumKey}") @Operation(summary = "Get a specific curriculum", - description = "Get a specific curriculum") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The curriculum", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + description = "Get a specific curriculum") + @ApiResponse(responseCode = "200", description = "The curriculum", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculum(@PathParam("curriculumKey") Long curriculumKey, @Context HttpServletRequest httpRequest) { Curriculum curriculum = curriculumService.getCurriculum(new CurriculumRefImpl(curriculumKey)); @@ -297,15 +251,6 @@ public class CurriculumsWebService { * Updates a curriculum entity. The primary key is taken from * the URL. The curriculum object can be "primary key free". * - * @response.representation.qname {http://www.example.com}curriculumVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum to update - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged curriculum - * @response.representation.200.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param curriculumKey The curriculum primary key * @param curriculum The curriculum to merge * @param request The HTTP request @@ -314,18 +259,15 @@ public class CurriculumsWebService { @POST @Path("{curriculumKey}") @Operation(summary = "Update a curriculum entity", - description = "Updates a curriculum entity. The primary key is taken from\n" + + description = "Updates a curriculum entity. The primary key is taken from\n" + " the URL. The curriculum object can be \"primary key free\"") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The merged curriculum", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + @ApiResponse(responseCode = "200", description = "The merged curriculum", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CurriculumVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CurriculumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postCurriculum(@PathParam("curriculumKey") Long curriculumKey, CurriculumVO curriculum, @Context HttpServletRequest httpRequest) { @@ -409,12 +351,6 @@ public class CurriculumsWebService { /** * Get all curriculum managers of the specified curriculum. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of curriculum managers - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element not found * @param curriculumKey The curriculum primary key * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> @@ -422,17 +358,14 @@ public class CurriculumsWebService { @GET @Path("{curriculumKey}/curriculumowners") @Operation(summary = "Get all curriculum managers", - description = "Get all curriculum managers of the specified curriculum") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The array of curriculum managers", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")} - ) + description = "Get all curriculum managers of the specified curriculum") + @ApiResponse(responseCode = "200", description = "The array of curriculum managers", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") public Response getCurriculumManagers(@PathParam("curriculumKey") Long curriculumKey, @Context HttpServletRequest httpRequest) { return getMembers(curriculumKey, CurriculumRoles.curriculumowner, httpRequest); } @@ -457,9 +390,6 @@ public class CurriculumsWebService { /** * Make the specified user a curriculum manager of the curriculum. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found * @param curriculumKey The curriculum primary key * @param identityKey The member to make a curriculum manager of * @return Nothing @@ -467,12 +397,10 @@ public class CurriculumsWebService { @PUT @Path("{curriculumKey}/curriculumowners/{identityKey}") @Operation(summary = "Make the specified user a curriculum manager of the curriculum", - description = "Make the specified user a curriculum manager of the curriculum") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Make the specified user a curriculum manager of the curriculum") + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response putCurriculumOwner(@PathParam("curriculumKey") Long curriculumKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { return putMember(curriculumKey, identityKey, CurriculumRoles.curriculumowner, httpRequest); @@ -498,9 +426,6 @@ public class CurriculumsWebService { /** * Remove the curriculum manager membership of the identity from the specified curriculum . * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum or the identity was not found * @param curriculumElementKey The curriculum primary key * @param identityKey The member to remove * @return Nothing @@ -508,12 +433,10 @@ public class CurriculumsWebService { @DELETE @Path("{curriculumKey}/curriculumowners/{identityKey}") @Operation(summary = "Remove the curriculum manager membership", - description = "Remove the curriculum manager membership of the identity from the specified curriculum") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")} - ) + description = "Remove the curriculum manager membership of the identity from the specified curriculum") + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response deleteCurriculumManager(@PathParam("curriculumKey") Long curriculumKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { return deleteMember(curriculumKey, identityKey, CurriculumRoles.curriculumowner, httpRequest); diff --git a/src/main/java/org/olat/modules/curriculum/restapi/Examples.java b/src/main/java/org/olat/modules/curriculum/restapi/Examples.java deleted file mode 100644 index 4ff2e338ff3..00000000000 --- a/src/main/java/org/olat/modules/curriculum/restapi/Examples.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.curriculum.restapi; - -import java.util.Date; - -/** - * - * Initial date: 15 mai 2018<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final CurriculumVO SAMPLE_CURRICULUMVO = new CurriculumVO(); - - public static final CurriculumElementVO SAMPLE_CURRICULUMELEMENTVO = new CurriculumElementVO(); - - public static final CurriculumElementTypeVO SAMPLE_CURRICULUMELEMENTTYPEVO = new CurriculumElementTypeVO(); - - public static final CurriculumElementMemberVO SAMPLE_CURRICULUMELEMENTMEMBERVO = new CurriculumElementMemberVO(); - - static { - SAMPLE_CURRICULUMVO.setKey(2l); - SAMPLE_CURRICULUMVO.setDisplayName("Dipl. engineer"); - SAMPLE_CURRICULUMVO.setIdentifier("DIP-ENG-CH"); - SAMPLE_CURRICULUMVO.setDescription("A diploma as engineer"); - SAMPLE_CURRICULUMVO.setDegree("License"); - SAMPLE_CURRICULUMVO.setExternalId("DIP-12387"); - SAMPLE_CURRICULUMVO.setManagedFlagsString("delete"); - SAMPLE_CURRICULUMVO.setOrganisationKey(1l); - - SAMPLE_CURRICULUMELEMENTVO.setKey(3l); - SAMPLE_CURRICULUMELEMENTVO.setIdentifier("CURR-EL-1"); - SAMPLE_CURRICULUMELEMENTVO.setDisplayName("A curriculum element"); - SAMPLE_CURRICULUMELEMENTVO.setDescription("This is a description"); - SAMPLE_CURRICULUMELEMENTVO.setCurriculumKey(2l); - SAMPLE_CURRICULUMELEMENTVO.setExternalId("EXT-19"); - SAMPLE_CURRICULUMELEMENTVO.setBeginDate(new Date()); - SAMPLE_CURRICULUMELEMENTVO.setEndDate(new Date()); - SAMPLE_CURRICULUMELEMENTVO.setCurriculumElementTypeKey(25l); - SAMPLE_CURRICULUMELEMENTVO.setParentElementKey(1l); - SAMPLE_CURRICULUMELEMENTVO.setManagedFlagsString("delete"); - - SAMPLE_CURRICULUMELEMENTTYPEVO.setKey(25l); - SAMPLE_CURRICULUMELEMENTTYPEVO.setCssClass("o_icon_type"); - SAMPLE_CURRICULUMELEMENTTYPEVO.setDisplayName("a curriculum element type"); - SAMPLE_CURRICULUMELEMENTTYPEVO.setIdentifier("CUR-EL-TYP-1"); - SAMPLE_CURRICULUMELEMENTTYPEVO.setExternalId("CET-1001"); - SAMPLE_CURRICULUMELEMENTTYPEVO.setDescription("This is the description of a type"); - SAMPLE_CURRICULUMELEMENTTYPEVO.setManagedFlagsString("displayName"); - - SAMPLE_CURRICULUMELEMENTMEMBERVO.setIdentityKey(111l); - SAMPLE_CURRICULUMELEMENTMEMBERVO.setInheritanceMode("none"); - SAMPLE_CURRICULUMELEMENTMEMBERVO.setRole("participant"); - } -} \ No newline at end of file diff --git a/src/main/java/org/olat/modules/docpool/restapi/DocumentPoolModuleWebService.java b/src/main/java/org/olat/modules/docpool/restapi/DocumentPoolModuleWebService.java index d25df1452b7..95b2a6caa26 100644 --- a/src/main/java/org/olat/modules/docpool/restapi/DocumentPoolModuleWebService.java +++ b/src/main/java/org/olat/modules/docpool/restapi/DocumentPoolModuleWebService.java @@ -45,7 +45,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -62,27 +61,19 @@ public class DocumentPoolModuleWebService { /** * Return the configuration of the taxonomy module. * - * @response.representation.200.qname {http://www.example.com}taxonomyModuleConfigurationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The configuration of the taxonomy module - * @response.representation.200.example {@link org.olat.modules.docpool.restapi.Examples#SAMPLE_DOCUMENTPOOLMODULECONFIGURATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return The module configuration */ @GET @Path("module/configuration") @Operation(summary = "Return the configuration of the taxonomy module", - description = "Return the configuration of the taxonomy module") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The configuration of the taxonomy module", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = DocumentPoolModuleConfigurationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = DocumentPoolModuleConfigurationVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")} - ) + description = "Return the configuration of the taxonomy module") + @ApiResponse(responseCode = "200", description = "The configuration of the taxonomy module", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = DocumentPoolModuleConfigurationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = DocumentPoolModuleConfigurationVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getModuleConfiguration(@Context HttpServletRequest httpRequest) { Roles roles = getRoles(httpRequest); diff --git a/src/main/java/org/olat/modules/docpool/restapi/Examples.java b/src/main/java/org/olat/modules/docpool/restapi/Examples.java deleted file mode 100644 index cbafe2e1dae..00000000000 --- a/src/main/java/org/olat/modules/docpool/restapi/Examples.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.docpool.restapi; - -/** - * - * Initial date: 10 nov. 2017<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final DocumentPoolModuleConfigurationVO SAMPLE_DOCUMENTPOOLMODULECONFIGURATIONVO = new DocumentPoolModuleConfigurationVO(); - - static { - SAMPLE_DOCUMENTPOOLMODULECONFIGURATIONVO.setEnabled(true); - SAMPLE_DOCUMENTPOOLMODULECONFIGURATIONVO.setTaxonomyTreeKey("1"); - } - -} diff --git a/src/main/java/org/olat/modules/fo/restapi/ForumCourseNodeWebService.java b/src/main/java/org/olat/modules/fo/restapi/ForumCourseNodeWebService.java index 67bd43eb7c8..ed73227d605 100644 --- a/src/main/java/org/olat/modules/fo/restapi/ForumCourseNodeWebService.java +++ b/src/main/java/org/olat/modules/fo/restapi/ForumCourseNodeWebService.java @@ -80,7 +80,6 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -106,29 +105,21 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { /** * Retrieves metadata of the published course node - * @response.representation.200.qname {http://www.example.com}forumVOes - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_FORUMVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param httpRequest The HTTP request * @return The persisted structure element (fully populated) */ @GET @Operation(summary = "Retrieves metadata of the published course node", - description = "Retrieves metadata of the published course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ForumVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ForumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + description = "Retrieves metadata of the published course node") + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ForumVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ForumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getForums(@PathParam("courseId") Long courseId, @Context HttpServletRequest httpRequest) { final ICourse course = CoursesWebService.loadCourse(courseId); @@ -167,12 +158,7 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { /** * This attaches a Forum Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this single * page @@ -187,18 +173,15 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { */ @POST @Operation(summary = "attach a Forum Element onto a given course", - description = "This attaches a Forum Element onto a given course. The element will be\n" + + description = "This attaches a Forum Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachForumPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -214,12 +197,7 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { /** * This attaches a Forum Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this single * page @@ -234,18 +212,15 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { */ @PUT @Operation(summary = "attach a Forum Element onto a given course", - description = "This attaches a Forum Element onto a given course. The element will be\n" + + description = "This attaches a Forum Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachForum(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") @Parameter(description = "The node's id which will be the parent of this single page") String parentNodeId, @QueryParam("position") @Parameter(description = "The node's position relative to its sibling nodes (optional)") Integer position, @QueryParam("shortTitle") @Parameter(description = "The node short title") @DefaultValue("undefined") String shortTitle, @@ -259,12 +234,7 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { /** * Retrieves metadata of the published course node - * @response.representation.200.qname {http://www.example.com}forumVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_FORUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id * @param httpRequest The HTTP request @@ -273,17 +243,14 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { @GET @Path("{nodeId}") @Operation(summary = "Retrieve metadata of the published course node", - description = "Retrieves metadata of the published course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ForumVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ForumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + description = "Retrieves metadata of the published course node") + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ForumVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ForumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getForum(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) { ICourse course = CoursesWebService.loadCourse(courseId); @@ -348,12 +315,7 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { /** * Creates a new thread in the forum of the course node - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author, forum or message not found + * * @param courseId The id of the course. * @param nodeId The id of the course node. * @param title The title for the first post in the thread @@ -369,17 +331,14 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { @PUT @Path("{nodeId}/thread") @Operation(summary = "Create a new thread in the forum of the course node", - description = "Creates a new thread in the forum of the course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The course node metadatas", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found")} - ) + description = "Creates a new thread in the forum of the course node") + @ApiResponse(responseCode = "200", description = "The course node metadatas", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response newThreadToForum(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @QueryParam("title")@Parameter(description = "The title for the first post in the thread") String title, @QueryParam("body") @Parameter(description = "The body for the first post in the thread") String body, @QueryParam("identityName") @Parameter(description = "The author identity name (optional)")String identityName, @QueryParam("sticky")@Parameter(description = "Creates sticky thread.") Boolean isSticky, @@ -390,12 +349,7 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { /** * Creates a new forum message in the forum of the course node - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author, forum or message not found + * * @param courseId The id of the course. * @param nodeId The id of the course node. * @param parentMessageId The id of the parent message. @@ -411,17 +365,14 @@ public class ForumCourseNodeWebService extends AbstractCourseNodeWebService { @PUT @Path("{nodeId}/message") @Operation(summary = "Creates a new forum message", - description = "Creates a new forum message in the forum of the course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The root message of the thread", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The author, forum or message not found")} - ) + description = "Creates a new forum message in the forum of the course node") + @ApiResponse(responseCode = "200", description = "The root message of the thread", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The author, forum or message not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response newMessageToForum(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @QueryParam("parentMessageId") @Parameter(description = "The id of the parent message") Long parentMessageId, @QueryParam("title") @Parameter(description = "The title for the first post in the thread") String title, @QueryParam("body") @Parameter(description = "The body for the first post in the thread") String body, @QueryParam("identityName") @Parameter(description = "The author identity name (optional)") String identityName, @Context HttpServletRequest request) { diff --git a/src/main/java/org/olat/modules/fo/restapi/ForumImportWebService.java b/src/main/java/org/olat/modules/fo/restapi/ForumImportWebService.java index 51c6b2990f2..6b6111ff9e6 100644 --- a/src/main/java/org/olat/modules/fo/restapi/ForumImportWebService.java +++ b/src/main/java/org/olat/modules/fo/restapi/ForumImportWebService.java @@ -21,7 +21,6 @@ package org.olat.modules.fo.restapi; import javax.ws.rs.GET; - import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -36,7 +35,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -61,16 +59,12 @@ public class ForumImportWebService { /** * The version of the Forum Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 * @return */ @GET @Path("version") @Operation(summary = "The version of the Forum Web Service", description = "The version of the Forum Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the Forum Web Service")}) + @ApiResponse(responseCode = "200", description = "The version of the Forum Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); diff --git a/src/main/java/org/olat/modules/fo/restapi/ForumWebService.java b/src/main/java/org/olat/modules/fo/restapi/ForumWebService.java index ac22c57c6aa..53c2fe36aa1 100644 --- a/src/main/java/org/olat/modules/fo/restapi/ForumWebService.java +++ b/src/main/java/org/olat/modules/fo/restapi/ForumWebService.java @@ -91,7 +91,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -127,26 +126,18 @@ public class ForumWebService { /** * Retrieves the forum. - * @response.representation.200.qname {http://www.example.com}forumVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_FORUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The forum not found + * * @return The forum */ @GET @Operation(summary = "Retrieves the forum of a group.", description = "Retrieves the forum of a group.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Request was successful.", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ForumVO.class)), - @Content(mediaType = "application/xml",schema = @Schema(implementation = ForumVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The forum not found.")} - ) + @ApiResponse(responseCode = "200", description = "Request was successful.", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ForumVO.class)), + @Content(mediaType = "application/xml",schema = @Schema(implementation = ForumVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The forum not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getForum() { if(forum == null) { @@ -159,12 +150,7 @@ public class ForumWebService { /** * Retrieves the threads in the forum - * @response.representation.200.qname {http://www.example.com}messageVOes - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author, forum or message not found + * * @param start * @param limit * @param orderBy (value name,creationDate) @@ -176,18 +162,14 @@ public class ForumWebService { */ @GET @Path("threads") - @Operation(summary = "Get threads", - description = "Retrieves the threads in the forum.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Request was successful.", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "The author, forum or message not found.")} -) + @Operation(summary = "Get threads", description = "Retrieves the threads in the forum.") + @ApiResponse(responseCode = "200", description = "Request was successful.", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "The author, forum or message not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getThreads(@QueryParam("start") @Parameter(description = "Set the date for the earliest thread.")@DefaultValue("0") Integer start, @QueryParam("limit") @Parameter(description = "Limit the amount of threads to be returned.") @DefaultValue("25") Integer limit, @QueryParam("orderBy") @Parameter(description = "orderBy (value name,creationDate)") @DefaultValue("creationDate") String orderBy, @@ -215,13 +197,7 @@ public class ForumWebService { /** * Creates a new thread in the forum of the course node - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author, forum or message not found + * * @param forumKey The id of the forum * @param title The title for the first post in the thread * @param body The body for the first post in the thread @@ -232,17 +208,14 @@ public class ForumWebService { @POST @Path("threads") @Operation(summary = "Post threads", - description = "Creates a new thread in the forum of the course node.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok.", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "The author, forum or message not found.")} - ) + description = "Creates a new thread in the forum of the course node.") + @ApiResponse(responseCode = "200", description = "Ok.", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "The author, forum or message not found.") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response newThreadToForumPost(@FormParam("title") String title, @@ -253,12 +226,7 @@ public class ForumWebService { /** * Creates a new thread in the forum of the course node - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author, forum or message not found + * * @param title The title for the first post in the thread * @param body The body for the first post in the thread * @param authorKey The author user key (optional) @@ -268,17 +236,14 @@ public class ForumWebService { @PUT @Path("threads") @Operation(summary = "Put threads", - description = "Creates a new thread in the forum of the course node.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok.", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "The author, forum or message not found.")} - ) + description = "Creates a new thread in the forum of the course node.") + @ApiResponse(responseCode = "200", description = "Ok.", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "The author, forum or message not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response newThreadToForum(@QueryParam("title") @Parameter(description = "The title for the first post in the thread") String title, @@ -299,12 +264,7 @@ public class ForumWebService { /** * Retrieves the messages in the thread - * @response.representation.200.qname {http://www.example.com}messageVOes - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author, forum or message not found + * * @param threadKey The key of the thread * @param start * @param limit @@ -318,17 +278,14 @@ public class ForumWebService { @GET @Path("posts/{threadKey}") @Operation(summary = "Get posts", - description = "Retrieves the messages in the thread.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok.", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "The author, forum or message not found.")} - ) + description = "Retrieves the messages in the thread.") + @ApiResponse(responseCode = "200", description = "Ok.", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = MessageVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "The author, forum or message not found.") public Response getMessages( @PathParam("threadKey") Long threadKey, @QueryParam("start") @Parameter(description = "Set the date for the earliest thread") @DefaultValue("0") Integer start, @QueryParam("limit")@Parameter(description = "Limit the amount of threads to be returned.") @DefaultValue("25") Integer limit, @QueryParam("orderBy")@Parameter(description = "orderBy (value name,creationDate)") @DefaultValue("creationDate") String orderBy, @QueryParam("asc") @Parameter(description = "Determine the type of order.") @DefaultValue("true") Boolean asc, @Context HttpServletRequest httpRequest, @Context UriInfo uriInfo, @@ -356,13 +313,7 @@ public class ForumWebService { /** * Creates a new reply in the forum of the course node - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author or message not found + * * @param messageKey The id of the reply message * @param title The title for the first post in the thread * @param body The body for the first post in the thread @@ -374,17 +325,14 @@ public class ForumWebService { @POST @Path("posts/{messageKey}") @Operation(summary = "Post posts", - description = "Creates a new reply in the forum of the course node") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The author or message not found")} - ) + description = "Creates a new reply in the forum of the course node") + @ApiResponse(responseCode = "200", description = "Ok", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The author or message not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response replyToPostPost(@PathParam("messageKey") Long messageKey, @FormParam("title") String title, @@ -395,12 +343,7 @@ public class ForumWebService { /** * Creates a new reply in the forum of the course node - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author or message not found + * * @param messageKey The id of the reply message * @param title The title for the first post in the thread * @param body The body for the first post in the thread @@ -412,17 +355,14 @@ public class ForumWebService { @PUT @Path("posts/{messageKey}") @Operation(summary = "Put posts", - description = "Creates a new reply in the forum of the course node.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok.", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "The author or message not found.")} - ) + description = "Creates a new reply in the forum of the course node.") + @ApiResponse(responseCode = "200", description = "Ok.", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "The author or message not found.") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response replyToPost(@PathParam("messageKey") Long messageKey, @QueryParam("title") @Parameter(description = "The title for the first post in the thread") String title, @@ -434,12 +374,7 @@ public class ForumWebService { /** * Creates a new reply in the forum of the course node - * @response.representation.200.qname {http://www.example.com}messageVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The root message of the thread - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_MESSAGEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The author or message not found + * * @param messageKey The id of the reply message * @param reply The reply object * @param httpRequest The HTTP request @@ -448,17 +383,14 @@ public class ForumWebService { @PUT @Path("posts/{messageKey}") @Operation(summary = "Put posts", - description = "Creates a new reply in the forum of the course node.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok.", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "The author or message not found.")} - ) + description = "Creates a new reply in the forum of the course node.") + @ApiResponse(responseCode = "200", description = "Ok.", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MessageVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MessageVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "The author or message not found.") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response replyToPost(@PathParam("messageKey") Long messageKey, ReplyVO reply, @@ -514,22 +446,16 @@ public class ForumWebService { /** * Retrieves the attachments of the message - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The links to the attachments - * @response.representation.404.doc The message not found + * * @param messageKey The key of the message * @param uriInfo The URI information * @return The attachments */ @GET @Path("posts/{messageKey}/attachments") - @Operation(summary = "Get attachments", - description = "Retrieves the attachments of the message.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok." - ), - @ApiResponse(responseCode = "404", description = "The message not found")} - ) + @Operation(summary = "Get attachments", description = "Retrieves the attachments of the message.") + @ApiResponse(responseCode = "200", description = "Ok.") + @ApiResponse(responseCode = "404", description = "The message not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getAttachments(@PathParam("messageKey") Long messageKey, @Context UriInfo uriInfo) { //load message @@ -547,23 +473,17 @@ public class ForumWebService { /** * Retrieves the attachment of the message - * @response.representation.200.mediaType application/octet-stream - * @response.representation.200.doc The portrait as image - * @response.representation.404.doc The identity or the portrait not found + * * @param messageKey The identity key of the user being searched * @param filename The name of the attachment * @param request The REST request * @return The attachment */ @GET - @Operation(summary = "Get attachment", - description = "Retrieves the attachment of the message.") + @Operation(summary = "Get attachment", description = "Retrieves the attachment of the message.") @Path("posts/{messageKey}/attachments/{filename}") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok." - ), - @ApiResponse(responseCode = "404", description = " The identity or the portrait not found")} - ) + @ApiResponse(responseCode = "200", description = "Ok.") + @ApiResponse(responseCode = "404", description = " The identity or the portrait not found") @Produces({"*/*", MediaType.APPLICATION_OCTET_STREAM}) public Response getAttachment(@PathParam("messageKey") Long messageKey, @PathParam("filename") String filename, @Context Request request) { @@ -608,22 +528,16 @@ public class ForumWebService { * Upload the attachment of a message, as parameter:<br> * filename The name of the attachment<br> * file The attachment. - * @response.representation.200.mediaType application/json, application/xml - * @response.representation.200.doc Ok - * @response.representation.404.doc The identity or the portrait not found + * * @param messageKey The key of the message * @param request The HTTP request * @return Ok */ @POST - @Operation(summary = "Post attachment", - description = "Upload the attachment of a message, as parameter.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok." - ), - @ApiResponse(responseCode = "404", description = " The identity or the portrait not found")} - ) + @Operation(summary = "Post attachment", description = "Upload the attachment of a message, as parameter.") + @ApiResponse(responseCode = "200", description = "Ok.") + @ApiResponse(responseCode = "404", description = " The identity or the portrait not found") @Path("posts/{messageKey}/attachments") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @@ -647,9 +561,7 @@ public class ForumWebService { /** * Upload the attachment of a message - * @response.representation.200.mediaType application/json, application/xml - * @response.representation.200.doc Ok - * @response.representation.404.doc The identity or the portrait not found + * * @param messageKey The key of the message * @param filename The name of the attachment * @file file64 The attachment (encoded as Base64) @@ -660,11 +572,8 @@ public class ForumWebService { @Operation(summary = "Post attachment", description = "Upload the attachment of a message.") @Path("posts/{messageKey}/attachments") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok." - ), - @ApiResponse(responseCode = "404", description = " The identity or the portrait not found")} - ) + @ApiResponse(responseCode = "200", description = "Ok.") + @ApiResponse(responseCode = "404", description = " The identity or the portrait not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response replyToPostAttachment(@PathParam("messageKey") Long messageKey, @FormParam("filename") String filename, @@ -675,13 +584,9 @@ public class ForumWebService { } @PUT - @Operation(summary = "Put attachment", - description = "Upload the attachment of a message.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Ok." - ), - @ApiResponse(responseCode = "404", description = " The identity or the portrait not found")} - ) + @Operation(summary = "Put attachment", description = "Upload the attachment of a message.") + @ApiResponse(responseCode = "200", description = "Ok.") + @ApiResponse(responseCode = "404", description = " The identity or the portrait not found") @Path("posts/{messageKey}/attachments") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) diff --git a/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java b/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java index bc121f02ff8..7d55dfdb3a2 100644 --- a/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java +++ b/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java @@ -72,7 +72,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -100,10 +99,7 @@ public class MyForumsWebService { /** * Retrieves the forum of a group - * @response.representation.200.qname {http://www.example.com}forumVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The forum - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param groupKey The key of the group * @param courseNodeId The key of the node if it's a course * @param httpRequest The HTTP request @@ -113,16 +109,13 @@ public class MyForumsWebService { @Path("group/{groupKey}") @Operation(summary = "Retrieves the forum of a group", description = "Retrieves the forum of a group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The forum", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "Not found.")} -) + @ApiResponse(responseCode = "200", description = "The forum", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "Not found.") public ForumWebService getGroupForum(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { if(groupKey == null) { throw new WebApplicationException( Response.serverError().status(Status.NOT_FOUND).build()); @@ -132,10 +125,7 @@ public class MyForumsWebService { /** * Retrieves the forum of a course building block - * @response.representation.200.qname {http://www.example.com}fileVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The files - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param courseKey The key of the course * @param courseNodeId The key of the node * @param httpRequest The HTTP request @@ -144,16 +134,13 @@ public class MyForumsWebService { */ @Path("course/{courseKey}/{courseNodeId}") @Operation(summary = "Retrieves the forum of a course building block", description = "Retrieves the forum of a course building block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")} -) + @ApiResponse(responseCode = "200", description = "The files", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public ForumWebService getCourseFolder(@PathParam("courseKey") Long courseKey, @PathParam("courseNodeId") String courseNodeId, @Context HttpServletRequest request) { return new ForumCourseNodeWebService().getForumContent(courseKey, courseNodeId, request); @@ -163,11 +150,7 @@ public class MyForumsWebService { * Retrieves a list of forums on a user base. All forums of groups * where the user is participant/tutor + all forums in course where * the user is a participant (owner, tutor or participant) - * @response.representation.200.qname {http://www.example.com}forumVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The forums - * @response.representation.200.example {@link org.olat.modules.fo.restapi.Examples#SAMPLE_FORUMVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param identityKey The key of the user (IdentityImpl) * @param httpRequest The HTTP request * @return The forums @@ -176,16 +159,13 @@ public class MyForumsWebService { @Operation(summary = "Retrieves a list of forums on a user base", description = "Retrieves a list of forums on a user base. All forums of groups \n" + "where the user is participant/tutor + all forums in course where\n" + "the user is a participant (owner, tutor or participant)") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The Forums", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ForumVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ForumVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")} -) + @ApiResponse(responseCode = "200", description = "The Forums", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ForumVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ForumVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getForums(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/modules/gotomeeting/restapi/Examples.java b/src/main/java/org/olat/modules/gotomeeting/restapi/Examples.java deleted file mode 100644 index 25b4b2ef923..00000000000 --- a/src/main/java/org/olat/modules/gotomeeting/restapi/Examples.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.gotomeeting.restapi; - -import java.util.Date; - -/** - * - * Initial date: 24.03.2016<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final GoToTrainingVO SAMPLE_GoToTrainingVO = new GoToTrainingVO(); - - static { - SAMPLE_GoToTrainingVO.setKey(4534759l); - SAMPLE_GoToTrainingVO.setName("Training"); - SAMPLE_GoToTrainingVO.setEnd(new Date()); - SAMPLE_GoToTrainingVO.setExternalId("AC-234"); - SAMPLE_GoToTrainingVO.setStart(new Date()); - } -} diff --git a/src/main/java/org/olat/modules/gotomeeting/restapi/GoToTrainingWebService.java b/src/main/java/org/olat/modules/gotomeeting/restapi/GoToTrainingWebService.java index 8a657c16b2e..8a25c3214c0 100644 --- a/src/main/java/org/olat/modules/gotomeeting/restapi/GoToTrainingWebService.java +++ b/src/main/java/org/olat/modules/gotomeeting/restapi/GoToTrainingWebService.java @@ -53,7 +53,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -79,23 +78,16 @@ public class GoToTrainingWebService { /** * returns the list of booking of the resource. * - * @response.representation.200.qname {http://www.example.com}goToTrainingVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc This is the list of all training of a resource - * @response.representation.200.example {@link org.olat.modules.gotomeeting.restapi.Examples#SAMPLE_GoToTrainingVO} * @return The list of trainings */ @GET @Path("trainings") @Operation(summary = "Returns the list of booking of the resource", description = "Returns the list of booking of the resource") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "This is the list of all training of a resource", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "This is the list of all training of a resource", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))) + }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTrainings() { try { @@ -115,23 +107,16 @@ public class GoToTrainingWebService { /** * Return the created or updated training * - * @response.representation.200.qname {http://www.example.com}goToTrainingVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Created a training - * @response.representation.200.example {@link org.olat.modules.gotomeeting.restapi.Examples#SAMPLE_GoToTrainingVO} * @return The list of vitero booking */ @PUT @Path("trainings") @Operation(summary = "Return the created or updated training", description = "Return the created or updated training") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Created a training", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "Created a training", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createTraining(GoToTrainingVO training) { @@ -141,23 +126,16 @@ public class GoToTrainingWebService { /** * Return the created or updated training * - * @response.representation.200.qname {http://www.example.com}goToTrainingVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The created booking - * @response.representation.200.example {@link org.olat.modules.gotomeeting.restapi.Examples#SAMPLE_GoToTrainingVO} * @return The list of vitero booking */ @POST @Path("trainings") @Operation(summary = "Return the created or updated training", description = "Return the created or updated training") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Created a booking", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))) - } - )} - ) + @ApiResponse(responseCode = "200", description = "Created a booking", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GoToTrainingVO.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateTraining(GoToTrainingVO training) { @@ -220,16 +198,12 @@ public class GoToTrainingWebService { /** * Delete the training * - * @response.representation.200.doc The training is deleted * @return Nothing */ @DELETE @Path("/trainings/{trainingKey}") @Operation(summary = "Delete the training", description = "Delete the training") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The training is deleted" - )} - ) + @ApiResponse(responseCode = "200", description = "The training is deleted") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response deleteTraining(@PathParam("trainingKey") Long trainingKey) { try { diff --git a/src/main/java/org/olat/modules/lecture/restapi/Examples.java b/src/main/java/org/olat/modules/lecture/restapi/Examples.java deleted file mode 100644 index bb6681e84e6..00000000000 --- a/src/main/java/org/olat/modules/lecture/restapi/Examples.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.lecture.restapi; - -import java.util.Date; - -/** - * - * - * Initial date: 20 juil. 2017<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final LectureBlockVO SAMPLE_LECTUREBLOCKVO = new LectureBlockVO(); - public static final LectureBlockRollCallVO SAMPLE_LECTUREBLOCKROLLCALLVO = new LectureBlockRollCallVO(); - public static final RepositoryEntryLectureConfigurationVO SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO = new RepositoryEntryLectureConfigurationVO(); - - static { - SAMPLE_LECTUREBLOCKVO.setKey(345l); - SAMPLE_LECTUREBLOCKVO.setTitle("Lecture"); - SAMPLE_LECTUREBLOCKVO.setDescription("A little description"); - SAMPLE_LECTUREBLOCKVO.setComment("A comment"); - SAMPLE_LECTUREBLOCKVO.setLocation("The secret location"); - SAMPLE_LECTUREBLOCKVO.setManagedFlagsString("all"); - SAMPLE_LECTUREBLOCKVO.setPreparation("Lot of"); - SAMPLE_LECTUREBLOCKVO.setPlannedLectures(4); - SAMPLE_LECTUREBLOCKVO.setExternalId("EXT-234"); - SAMPLE_LECTUREBLOCKVO.setStartDate(new Date()); - SAMPLE_LECTUREBLOCKVO.setEndDate(new Date()); - - SAMPLE_LECTUREBLOCKROLLCALLVO.setKey(23l); - SAMPLE_LECTUREBLOCKROLLCALLVO.setLecturesAbsentNumber(2); - SAMPLE_LECTUREBLOCKROLLCALLVO.setLecturesAttendedNumber(3); - SAMPLE_LECTUREBLOCKROLLCALLVO.setComment("A comment"); - SAMPLE_LECTUREBLOCKROLLCALLVO.setAbsenceReason("The reason of the absence"); - SAMPLE_LECTUREBLOCKROLLCALLVO.setAbsenceAuthorized(Boolean.TRUE); - SAMPLE_LECTUREBLOCKROLLCALLVO.setAbsenceSupervisorNotificationDate(new Date()); - SAMPLE_LECTUREBLOCKROLLCALLVO.setIdentityKey(2439873895l); - SAMPLE_LECTUREBLOCKROLLCALLVO.setLectureBlockKey(345l); - - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setCalculateAttendanceRate(Boolean.TRUE); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setLectureEnabled(Boolean.TRUE); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setCalculateAttendanceRate(Boolean.TRUE); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setOverrideModuleDefault(Boolean.TRUE); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setCourseCalendarSyncEnabled(Boolean.TRUE); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setRequiredAttendanceRate(34.0d); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setRollCallEnabled(Boolean.TRUE); - SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO.setTeacherCalendarSyncEnabled(Boolean.TRUE); - } -} diff --git a/src/main/java/org/olat/modules/lecture/restapi/LectureBlockRollCallWebService.java b/src/main/java/org/olat/modules/lecture/restapi/LectureBlockRollCallWebService.java index bca9657a428..aaee4ddbb4c 100644 --- a/src/main/java/org/olat/modules/lecture/restapi/LectureBlockRollCallWebService.java +++ b/src/main/java/org/olat/modules/lecture/restapi/LectureBlockRollCallWebService.java @@ -23,7 +23,6 @@ package org.olat.modules.lecture.restapi; import static org.olat.restapi.security.RestSecurityHelper.getRoles; - import java.util.ArrayList; import java.util.List; @@ -59,7 +58,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -77,11 +75,6 @@ public class LectureBlockRollCallWebService { /** * 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 @@ -92,16 +85,13 @@ public class LectureBlockRollCallWebService { @Path("/") @Operation(summary = "Return a list lecture block roll call", description = "Return a list lecture block roll call" + "the user is a participant (owner, tutor or participant)") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A lecture block roll call", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LectureBlockRollCallVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LectureBlockRollCallVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")} -) + @ApiResponse(responseCode = "200", description = "A lecture block roll call", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LectureBlockRollCallVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LectureBlockRollCallVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getRollCalls(@QueryParam("closed") @Parameter(description = "If true, the status of the block is done or the status of the roll call is closed or auto closed") Boolean closed, @QueryParam("hasAbsence") @Parameter(description = "If true, the roll call has an absence") Boolean hasAbsence, @QueryParam("hasSupervisorNotificationDate") @Parameter(description = "If true, the roll call has a supervisor notification date set") Boolean hasSupervisorNotificationDate, @@ -138,12 +128,6 @@ public class LectureBlockRollCallWebService { /** * 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 @@ -152,16 +136,13 @@ public class LectureBlockRollCallWebService { @Path("{rollCallKey}") @Operation(summary = "Return the lecture block roll call specified by the primary key", description = "Return the lecture block roll call specified by the primary key" + "the user is a participant (owner, tutor or participant)") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A lecture block roll call", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockRollCallVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockRollCallVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")} -) + @ApiResponse(responseCode = "200", description = "A lecture block roll call", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockRollCallVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockRollCallVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRollCall(@PathParam("rollCallKey") Long rollCallKey, @Context HttpServletRequest httpRequest) { Roles roles = getRoles(httpRequest); @@ -189,12 +170,6 @@ public class LectureBlockRollCallWebService { * supervisor notification date, the comment and the reason. The method doesn't * create a new 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 - * @response.representation.404.doc The role call was not found * @param rollCallVo The roll call to update * @param httpRequest The HTTP request * @return The updated roll call @@ -205,16 +180,13 @@ public class LectureBlockRollCallWebService { "Update a roll call. The absence are not updated by this method! Only the\n" + " supervisor notification date, the comment and the reason. The method doesn't\n" + " create a new roll call") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A lecture block roll call", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockRollCallVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockRollCallVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The role call was not found")} -) + @ApiResponse(responseCode = "200", description = "A lecture block roll call", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockRollCallVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockRollCallVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The role call was not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateRollCallPut(LectureBlockRollCallVO rollCallVo, @Context HttpServletRequest httpRequest) { @@ -226,12 +198,6 @@ public class LectureBlockRollCallWebService { * supervisor notification date, the comment and the reason. The method doesn't * create a new 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 - * @response.representation.404.doc The role call was not found * @param rollCallVo The roll call to update * @param httpRequest The HTTP request * @return The updated roll call @@ -242,16 +208,13 @@ public class LectureBlockRollCallWebService { "Update a roll call. The absence are not updated by this method! Only the\n" + " supervisor notification date, the comment and the reason. The method doesn't\n" + " create a new roll call") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A lecture block roll call", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockRollCallVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockRollCallVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The role call was not found")} -) + @ApiResponse(responseCode = "200", description = "A lecture block roll call", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockRollCallVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockRollCallVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The role call was not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateRollCall(LectureBlockRollCallVO rollCallVo, @Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/modules/lecture/restapi/LectureBlockWebService.java b/src/main/java/org/olat/modules/lecture/restapi/LectureBlockWebService.java index bb45fd9c3bd..ba7a2acb4aa 100644 --- a/src/main/java/org/olat/modules/lecture/restapi/LectureBlockWebService.java +++ b/src/main/java/org/olat/modules/lecture/restapi/LectureBlockWebService.java @@ -21,7 +21,6 @@ package org.olat.modules.lecture.restapi; import java.util.List; - import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -33,11 +32,11 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.apache.logging.log4j.Logger; import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.Group; import org.olat.core.commons.persistence.DB; import org.olat.core.id.Identity; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.modules.curriculum.CurriculumElement; import org.olat.modules.curriculum.CurriculumElementStatus; @@ -60,7 +59,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -97,22 +95,16 @@ public class LectureBlockWebService { /** * Return a specific lecture blocks. - * @response.representation.200.qname {http://www.example.com}lectureBlocksVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A lecture blocks - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @return The lecture blocks */ @GET @Operation(summary = "Return a specific lecture block", description = "Return a specific lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The lecture block", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "The lecture block", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getLectureBlock() { return Response.ok(new LectureBlockVO(lectureBlock, entry.getKey())).build(); @@ -121,12 +113,11 @@ public class LectureBlockWebService { @POST @Path("entry/{repositoryEntryKey}") @Operation(summary = "Post a specific lecture block", description = "Post a specific lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The lecture block posted", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "The lecture block posted", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response moveLectureBlock(@PathParam("repositoryEntryKey") Long repositoryEntryKey) { RepositoryEntry newEntry = repositoryService.loadByKey(repositoryEntryKey); @@ -140,17 +131,14 @@ public class LectureBlockWebService { /** * Delete a specific lecture blocks. - * @response.representation.200.doc Lecture blocks deleted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @return Nothing */ @DELETE @Operation(summary = "Delete a specific lecture block", description = "Delete a specific lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Lecture block deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient."), - @ApiResponse(responseCode = "404", description = "Not found.") }) + @ApiResponse(responseCode = "200", description = "Lecture block deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient.") + @ApiResponse(responseCode = "404", description = "Not found.") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response deleteLectureBlock() { lectureService.deleteLectureBlock(lectureBlock, null); @@ -160,22 +148,17 @@ public class LectureBlockWebService { /** * Get all teachers of the specific lecture blocks. - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of authors - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @return It returns an array of <code>UserVO</code> */ @GET @Path("teachers") @Operation(summary = "Get all teachers of the specific lecture block", description = "Get all teachers of the specific lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The array of authors", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The array of authors", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTeacher() { List<Identity> teachers = lectureService.getTeachers(lectureBlock); @@ -184,19 +167,16 @@ public class LectureBlockWebService { /** * Add a teacher to the lecture block - * @response.representation.200.doc The user is a teacher of the lecture block - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * * @param identityKey The user identifier * @return It returns 200 if the user is added as teacher of the lecture block. */ @PUT @Path("teachers/{identityKey}") @Operation(summary = "Add a teacher to the lecture block ", description = "Add a teacher to the lecture block ") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is a teacher of the lecture block"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or the user not found") }) + @ApiResponse(responseCode = "200", description = "The user is a teacher of the lecture block") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or the user not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addTeacher(@PathParam("identityKey") Long identityKey) { Identity teacher = securityManager.loadIdentityByKey(identityKey); @@ -209,19 +189,16 @@ public class LectureBlockWebService { /** * Remove a teacher of the lecture block - * @response.representation.200.doc The user was successfully removed as teacher of the lecture block - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course, the lecture block or the user not found + * * @param identityKey The user identifier * @return It returns 200 if the user is removed as teacher of the lecture block */ @DELETE @Path("teachers/{identityKey}") @Operation(summary = "Remove a teacher of the lecture block", description = "Remove a teacher of the lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user was successfully removed as teacher of the lecture block"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course, the lecture block or the user not found") }) + @ApiResponse(responseCode = "200", description = "The user was successfully removed as teacher of the lecture block") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course, the lecture block or the user not found") public Response removeTeacher(@PathParam("identityKey") Long identityKey) { Identity teacher = securityManager.loadIdentityByKey(identityKey); if(teacher == null) { @@ -234,14 +211,13 @@ public class LectureBlockWebService { /** * Add the group of the course to the lecture block participants list. - * @response.representation.200.doc Successfully added + * * @return 200 if all ok */ @PUT @Path("participants/repositoryentry") @Operation(summary = "Add group", description = "Add the group of the course to the lecture block participants list") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Successfully added")}) + @ApiResponse(responseCode = "200", description = "Successfully added") public Response addRepositoryEntryParticipantGroup() { LectureBlock reloadedBlock = lectureService.getLectureBlock(lectureBlock); Group defGroup = repositoryService.getDefaultGroup(entry); @@ -257,14 +233,13 @@ public class LectureBlockWebService { /** * Remove the group of the course from the lecture block participants. - * @response.representation.200.doc Successfully removed + * * @return 200 if all ok */ @DELETE @Path("participants/repositoryentry") @Operation(summary = "Remove group", description = "Remove the group of the course from the lecture block participants") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Successfully removed")}) + @ApiResponse(responseCode = "200", description = "Successfully removed") public Response deleteRepositoryEntryParticipantGroup() { LectureBlock reloadedBlock = lectureService.getLectureBlock(lectureBlock); Group defGroup = repositoryService.getDefaultGroup(entry); @@ -278,14 +253,13 @@ public class LectureBlockWebService { /** * Add the group of all curriculum elements to the lecture block participants list. - * @response.representation.200.doc Successfully added + * * @return 200 if all ok */ @PUT @Path("participants/curriculum") @Operation(summary = "Add group", description = "Add the group of all curriculum elements to the lecture block participants list") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Successfully added")}) + @ApiResponse(responseCode = "200", description = "Successfully added") public Response addCurriculumElementParticipantGroup() { LectureBlock reloadedBlock = lectureService.getLectureBlock(lectureBlock); List<CurriculumElement> elements = curriculumService.getCurriculumElements(entry); @@ -310,14 +284,13 @@ public class LectureBlockWebService { /** * Remove the group of all curriculum elements from the lecture block participants. - * @response.representation.200.doc Successfully removed + * * @return 200 if all ok */ @DELETE @Path("participants/curriculum") @Operation(summary = "Remove group", description = "Remove the group of all curriculum elements from the lecture block participants") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Successfully removed")}) + @ApiResponse(responseCode = "200", description = "Successfully removed") public Response deleteCurriculumElementParticipantGroup() { LectureBlock reloadedBlock = lectureService.getLectureBlock(lectureBlock); List<CurriculumElement> elements = curriculumService.getCurriculumElements(entry); @@ -343,12 +316,11 @@ public class LectureBlockWebService { @GET @Path("taxonomy/levels") @Operation(summary = "Get all levels from specific taxonomy", description = "Get all levels from specific taxonomy") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The levels", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "The levels", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTaxonomyLevels() { List<TaxonomyLevel> levels = lectureBlockToTaxonomyLevelDao.getTaxonomyLevels(lectureBlock); @@ -362,12 +334,11 @@ public class LectureBlockWebService { @PUT @Path("taxonomy/levels/{taxonomyLevelKey}") @Operation(summary = "Put level", description = "Put level to a specific taxonomy") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The level put", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "The level put", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response putTaxonomyLevel(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { List<TaxonomyLevel> levels = lectureBlockToTaxonomyLevelDao.getTaxonomyLevels(lectureBlock); for(TaxonomyLevel level:levels) { @@ -386,10 +357,9 @@ public class LectureBlockWebService { @DELETE @Path("taxonomy/levels/{taxonomyLevelKey}") @Operation(summary = "Remove level", description = "Remove level from a specific taxonomy") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Level removed successfully"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "Level removed successfully") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response deleteTaxonomyLevel(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { TaxonomyLevel level = taxonomyService.getTaxonomyLevel(new TaxonomyLevelRefImpl(taxonomyLevelKey)); if(level == null) { @@ -401,14 +371,13 @@ public class LectureBlockWebService { /** * Synchronize the calendars based on the lecture block. - * @response.representation.200.doc The calendar is successfully synchronized + * * @return 200 if all ok */ @POST @Path("sync/calendar") @Operation(summary = "Synchronize the calendars", description = "Synchronize the calendars based on the lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The calendar is successfully synchronized")}) + @ApiResponse(responseCode = "200", description = "The calendar is successfully synchronized") public Response syncCalendar() { lectureService.syncCalendars(lectureBlock); return Response.ok().build(); diff --git a/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksRootWebService.java b/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksRootWebService.java index 2b65f0227fa..76ccd364850 100644 --- a/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksRootWebService.java +++ b/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksRootWebService.java @@ -19,10 +19,9 @@ */ package org.olat.modules.lecture.restapi; +import static org.olat.restapi.security.RestSecurityHelper.getIdentity; import static org.olat.restapi.security.RestSecurityHelper.getRoles; - import static org.olat.restapi.security.RestSecurityHelper.parseDate; -import static org.olat.restapi.security.RestSecurityHelper.getIdentity; import java.util.ArrayList; import java.util.Date; @@ -50,11 +49,10 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -74,27 +72,19 @@ public class LectureBlocksRootWebService { /** * Return the lecture blocks of the specified course or repository entry. - * @response.representation.200.qname {http://www.example.com}lectureBlocksVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of lecture blocks - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param httpRequest The HTTP request * @return The lecture blocks */ @GET @Operation(summary = "Return the lecture blocks", description = "Return the lecture blocks of the specified course or repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of lecture blocks", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")} -) + @ApiResponse(responseCode = "200", description = "An array of lecture blocks", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response searchLectureBlocks(@QueryParam("date") @Parameter(description = "The date") String date, @Context HttpServletRequest httpRequest) { Roles roles = getRoles(httpRequest); diff --git a/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksWebService.java b/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksWebService.java index e34bef87fe3..9ba9e5f3fd5 100644 --- a/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksWebService.java +++ b/src/main/java/org/olat/modules/lecture/restapi/LectureBlocksWebService.java @@ -21,7 +21,6 @@ package org.olat.modules.lecture.restapi; import static org.olat.restapi.security.RestSecurityHelper.getIdentity; - import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -61,7 +60,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -88,27 +86,19 @@ public class LectureBlocksWebService { /** * Return the lecture blocks of the specified course or repository entry. - * @response.representation.200.qname {http://www.example.com}lectureBlocksVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of lecture blocks - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param httpRequest The HTTP request * @return The lecture blocks */ @GET @Operation(summary = "Return the lecture blocks", description = "Return the lecture blocks of the specified course or repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of lecture blocks", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")} -) + @ApiResponse(responseCode = "200", description = "An array of lecture blocks", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LectureBlockVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getLectureBlocks(@Context HttpServletRequest httpRequest) { if(!administrator) { @@ -126,27 +116,19 @@ public class LectureBlocksWebService { /** * Create or update a lecture block. - * @response.representation.200.qname {http://www.example.com}lectureBlocksVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The updated lecture block - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param block The lecture block * @return It returns the updated / created lecture block. */ @PUT @Operation(summary = "Create or update a lecture block", description = "Create or update a lecture block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The updated lecture block", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")} -) + @ApiResponse(responseCode = "200", description = "The updated lecture block", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putLectureBlocks(LectureBlockVO block) { @@ -162,12 +144,6 @@ public class LectureBlocksWebService { * autoclose only for newly created blocks. By update, the states of the * block and the roll call will not be updated. * - * @response.representation.200.qname {http://www.example.com}lectureBlocksVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The updated configuration - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param block The lecture block * @return It returns the updated / created lecture block. */ @@ -175,16 +151,13 @@ public class LectureBlocksWebService { @Operation(summary = "Create or update a lecture block", description = "Create or update a lecture block. The status of the blocks will be set to\n" + " autoclose only for newly created blocks. By update, the states of the\n" + " block and the roll call will not be updated") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The updated configuration", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")} -) + @ApiResponse(responseCode = "200", description = "The updated configuration", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = LectureBlockVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = LectureBlockVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postLectureBlocks(LectureBlockVO block) { @@ -274,24 +247,18 @@ public class LectureBlocksWebService { /** * Return the configuration of the specified course or repository entry. - * @response.representation.200.qname {http://www.example.com}repositoryEntryLectureConfigurationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The configuration of the lecture's feature - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param httpRequest The HTTP request * @return The configuration */ @GET @Path("configuration") @Operation(summary = "Return the configuration", description = "Return the configuration of the specified course or repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The configuration of the lecture's feature", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The configuration of the lecture's feature", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getConfiguration(@Context HttpServletRequest httpRequest) { if(!administrator) { @@ -311,23 +278,18 @@ public class LectureBlocksWebService { /** * Update the configuration of the lecture's feature of a specified * course or repository entry. - * @response.representation.200.qname {http://www.example.com}repositoryEntryLectureConfigurationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The updated configuration - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param configuration The configuration * @return It returns the updated configuration. */ @POST @Path("configuration") @Operation(summary = "Update the configuration", description = "Update the configuration of the lecture's feature of a specified") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The updated configuration", content = { + @ApiResponse(responseCode = "200", description = "The updated configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryLectureConfigurationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateConfiguration(RepositoryEntryLectureConfigurationVO configuration) { @@ -362,13 +324,14 @@ public class LectureBlocksWebService { /** * To get the web service for a specific lecture block. + * * @param lectureBlockKey The primary key of the lecture block * @param httpRequest The HTTP request * @return The web service for a single lecture block. */ @Path("{lectureBlockKey}") @Operation(summary = "Get the web service for a specific lecture block", description = "Get the web service for a specific lecture block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The web service for a single lecture block")}) + @ApiResponse(responseCode = "200", description = "The web service for a single lecture block") public LectureBlockWebService getLectureBlockWebService(@PathParam("lectureBlockKey") Long lectureBlockKey, @Context HttpServletRequest httpRequest) throws WebApplicationException { if(!administrator) { @@ -386,7 +349,7 @@ public class LectureBlocksWebService { @POST @Path("healmoved/{originEntryKey}") @Operation(summary = "Post Entry", description = "Post Entry") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "Entry has been posted")}) + @ApiResponse(responseCode = "200", description = "Entry has been posted") public Response healMoved(@PathParam("originEntryKey") Long originEntryKey) { //check the lecture summary @@ -405,13 +368,13 @@ public class LectureBlocksWebService { /** * Synchronize the calendars based on the lecture blocks. - * @response.representation.200.doc The calendar is successfully synchronized + * * @return 200 if the calendar is successfully synchronized */ @POST @Path("sync/calendar") @Operation(summary = "Synchronize the calendars based on the lecture blocks", description = "Synchronize the calendars based on the lecture blocks") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The calendar is successfully synchronized")}) + @ApiResponse(responseCode = "200", description = "The calendar is successfully synchronized") public Response syncCalendar() { lectureService.syncCalendars(entry); return Response.ok().build(); @@ -419,14 +382,14 @@ public class LectureBlocksWebService { /** * Adapt all roll call to the effective number of lectures. Use with caution! - * @response.representation.200.doc The adaptation is successful + * * @param httpRequest The HTTP request * @return 200 if the adaptation is successful */ @GET @Path("adaptation") @Operation(summary = "Adapt all roll call to the effective number of lectures", description = "Adapt all roll call to the effective number of lectures. Use with caution!") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The adaptation is successful")}) + @ApiResponse(responseCode = "200", description = "The adaptation is successful") public Response adapatation(@Context HttpServletRequest httpRequest) { if(!administrator) { return Response.serverError().status(Status.UNAUTHORIZED).build(); diff --git a/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java b/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java index 658b30b94e8..95d09566f7e 100644 --- a/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java +++ b/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java @@ -20,7 +20,6 @@ package org.olat.modules.openmeetings.restapi; import java.io.File; - import java.util.Date; import javax.ws.rs.GET; @@ -43,7 +42,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -59,9 +57,7 @@ public class OpenMeetingsWebService { /** * Retrieves the portrait of an user - * @response.representation.200.mediaType application/octet-stream - * @response.representation.200.doc The portrait as image - * @response.representation.404.doc The identity or the portrait not found + * * @param identityToken The identity key of the user being searched * @param request The REST request * @return The image @@ -69,9 +65,8 @@ public class OpenMeetingsWebService { @GET @Path("{identityToken}/portrait") @Operation(summary = "Retrieve the portrait of an user", description = "Retrieves the portrait of an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The portrait as image"), - @ApiResponse(responseCode = "404", description = "The identity or the portrait not found") }) + @ApiResponse(responseCode = "200", description = "The portrait as image") + @ApiResponse(responseCode = "404", description = "The identity or the portrait not found") @Produces({"image/jpeg","image/jpg",MediaType.APPLICATION_OCTET_STREAM}) public Response getPortrait(@PathParam("identityToken") String identityToken, @Context Request request) { OpenMeetingsModule module = CoreSpringFactory.getImpl(OpenMeetingsModule.class); diff --git a/src/main/java/org/olat/modules/qpool/restapi/QuestionPoolWebService.java b/src/main/java/org/olat/modules/qpool/restapi/QuestionPoolWebService.java index e6d9eec71ff..e92a1295b8f 100644 --- a/src/main/java/org/olat/modules/qpool/restapi/QuestionPoolWebService.java +++ b/src/main/java/org/olat/modules/qpool/restapi/QuestionPoolWebService.java @@ -40,11 +40,11 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.apache.logging.log4j.Logger; import org.olat.basesecurity.BaseSecurity; import org.olat.core.CoreSpringFactory; import org.olat.core.id.Identity; import org.olat.core.id.Roles; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.i18n.I18nManager; import org.olat.modules.qpool.QPoolService; @@ -63,7 +63,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -81,10 +80,10 @@ public class QuestionPoolWebService { @PUT @Operation(summary = "Put QuestionItem", description = "Put QuestionItem") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The QuestionItem", content = { + @ApiResponse(responseCode = "200", description = "The QuestionItem", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = QuestionItemVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = QuestionItemVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = QuestionItemVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.MULTIPART_FORM_DATA}) public Response importQuestionItemsPut(@Context HttpServletRequest request) { @@ -93,10 +92,10 @@ public class QuestionPoolWebService { @POST @Operation(summary = "Post QuestionItem", description = "Post QuestionItem") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The QuestionItem", content = { + @ApiResponse(responseCode = "200", description = "The QuestionItem", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = QuestionItemVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = QuestionItemVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = QuestionItemVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.MULTIPART_FORM_DATA}) public Response importQuestionItemsPost(@Context HttpServletRequest request) { @@ -153,9 +152,6 @@ public class QuestionPoolWebService { /** * Delete a question item by id. * - * @response.representation.200.doc Nothing - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The question item not found * @param itemKey The question item identifier * @param request The HTTP request * @return Nothing @@ -163,11 +159,9 @@ public class QuestionPoolWebService { @DELETE @Path("{itemKey}") @Operation(summary = "Delete a question item by id", description = "Delete a question item by id") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Nothing"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The question item not found")} -) + @ApiResponse(responseCode = "200", description = "Nothing") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The question item not found") public Response deleteQuestionItem(@PathParam("itemKey") Long itemKey, @Context HttpServletRequest request) { if(!isQuestionPoolManager(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -191,11 +185,6 @@ public class QuestionPoolWebService { /** * Get all authors of the question item. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of authors - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The question item not found * @param itemKey The question item identifier * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> @@ -203,11 +192,11 @@ public class QuestionPoolWebService { @GET @Path("{itemKey}/authors") @Operation(summary = "Get all authors of the question item", description = "Get all authors of the question item") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The array of authors", content = { + @ApiResponse(responseCode = "200", description = "The array of authors", content = { @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The question item not found") }) + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The question item not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getAuthors(@PathParam("itemKey") Long itemKey, @Context HttpServletRequest request) { @@ -234,11 +223,6 @@ public class QuestionPoolWebService { /** * Get this specific author of the quesiton item. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The author - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The question item not found or the user is not an author of the course * @param itemKey The question item identifier * @param identityKey The user identifier * @param httpRequest The HTTP request @@ -247,16 +231,13 @@ public class QuestionPoolWebService { @GET @Path("{itemKey}/authors/{identityKey}") @Operation(summary = "Get this specific author of the quesiton item", description = "Get this specific author of the quesiton item") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The author", - content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The question item not found")} -) + @ApiResponse(responseCode = "200", description = "The author", + content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The question item not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getAuthor(@PathParam("itemKey") Long itemKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { @@ -282,9 +263,6 @@ public class QuestionPoolWebService { /** * Add an author to the question item. * - * @response.representation.200.doc The user is an author of the question item - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The question item or the user not found * @param itemKey The question item identifier * @param identityKey The user identifier * @param httpRequest The HTTP request @@ -293,12 +271,9 @@ public class QuestionPoolWebService { @PUT @Path("{itemKey}/authors/{identityKey}") @Operation(summary = "Add an author to the question item", description = "Add an author to the question item") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is an author of the question item" - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The question item or the user not found")} -) + @ApiResponse(responseCode = "200", description = "The user is an author of the question item") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The question item or the user not found") public Response addAuthor(@PathParam("itemKey") Long itemKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { if(!isQuestionPoolManager(httpRequest)) { @@ -326,9 +301,6 @@ public class QuestionPoolWebService { /** * Remove an author to the question item. * - * @response.representation.200.doc The user was successfully removed as author of the question item - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The question item or the user not found * @param itemKey The question item identifier * @param identityKey The user identifier * @param httpRequest The HTTP request @@ -337,12 +309,9 @@ public class QuestionPoolWebService { @DELETE @Path("{itemKey}/authors/{identityKey}") @Operation(summary = "Remove an author to the question item", description = "Remove an author to the question item") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user was successfully removed as author of the question item" - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The question item or the user not found")} -) + @ApiResponse(responseCode = "200", description = "The user was successfully removed as author of the question item") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The question item or the user not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response removeAuthor(@PathParam("itemKey") Long itemKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/modules/reminder/restapi/Examples.java b/src/main/java/org/olat/modules/reminder/restapi/Examples.java deleted file mode 100644 index 9e5bef4138c..00000000000 --- a/src/main/java/org/olat/modules/reminder/restapi/Examples.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.reminder.restapi; - -/** - * - * Initial date: 25 mars 2019<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final ReminderVO SAMPLE_REMINDERVO = new ReminderVO(); - - static { - SAMPLE_REMINDERVO.setKey(231l); - SAMPLE_REMINDERVO.setRepoEntryKey(264827834l); - SAMPLE_REMINDERVO.setDescription("A nice little description"); - SAMPLE_REMINDERVO.setEmailSubject("The subject"); - SAMPLE_REMINDERVO.setEmailBody("The body"); - } - -} diff --git a/src/main/java/org/olat/modules/reminder/restapi/RemindersWebService.java b/src/main/java/org/olat/modules/reminder/restapi/RemindersWebService.java index ed6673cd7ce..9b979470957 100644 --- a/src/main/java/org/olat/modules/reminder/restapi/RemindersWebService.java +++ b/src/main/java/org/olat/modules/reminder/restapi/RemindersWebService.java @@ -52,7 +52,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -75,26 +74,18 @@ public class RemindersWebService { /** * Return the reminders of the specified course or repository entry. - * @response.representation.200.qname {http://www.example.com}reminderVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of lecture blocks - * @response.representation.200.example {@link org.olat.modules.reminder.restapi.Examples#SAMPLE_REMINDERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The resource not found + * * @return The reminders */ @GET @Operation(summary = "Return the reminders", description = "Return the reminders of the specified course or repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of lecture blocks", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ReminderVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ReminderVO.class))) - } - ), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The resource not found")} -) + @ApiResponse(responseCode = "200", description = "An array of lecture blocks", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ReminderVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ReminderVO.class))) + }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The resource not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getReminders() { if(!administrator) { @@ -113,24 +104,17 @@ public class RemindersWebService { /** * Create or update a reminder. * - * @response.representation.200.qname {http://www.example.com}reminderVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The updated reminder - * @response.representation.200.example {@link org.olat.modules.reminder.restapi.Examples#SAMPLE_REMINDERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or repository entry not found * @param reminder The reminder * @param httpRequest The HTTP request * @return It returns the updated / created reminder. */ @PUT @Operation(summary = "Create or update a reminder", description = "Create or update a reminder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The updated reminder", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ReminderVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ReminderVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or repository entry not found") }) + @ApiResponse(responseCode = "200", description = "The updated reminder", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ReminderVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ReminderVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or repository entry not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putReminder(ReminderVO reminder, @Context HttpServletRequest httpRequest) { @@ -144,24 +128,17 @@ public class RemindersWebService { /** * Create or update a reminder. * - * @response.representation.200.qname {http://www.example.com}reminderVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The updated reminder - * @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_REMINDERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or repository entry not found * @param reminder The reminder * @param httpRequest The HTTP request * @return It returns the updated / created reminder. */ @POST @Operation(summary = "Create or update a reminder", description = "Create or update a reminder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The updated reminder", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ReminderVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ReminderVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or repository entry not found") }) + @ApiResponse(responseCode = "200", description = "The updated reminder", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ReminderVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ReminderVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or repository entry not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postReminder(ReminderVO reminder, @Context HttpServletRequest httpRequest) { @@ -205,19 +182,16 @@ public class RemindersWebService { /** * Delete a specific reminder. - * @response.representation.200.doc Reminder deleted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or repository entry not found + * * @param reminderKey The reminder primary key * @return Nothing */ @DELETE @Path("{reminderKey}") @Operation(summary = "Delete a specific reminder", description = "Delete a specific reminder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Reminder deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or repository entry not found") }) + @ApiResponse(responseCode = "200", description = "Reminder deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or repository entry not found") public Response deleteReminder(@PathParam("reminderKey") Long reminderKey) { if(!administrator) { return Response.serverError().status(Status.UNAUTHORIZED).build(); diff --git a/src/main/java/org/olat/modules/taxonomy/restapi/Examples.java b/src/main/java/org/olat/modules/taxonomy/restapi/Examples.java deleted file mode 100644 index 75ad9a0d169..00000000000 --- a/src/main/java/org/olat/modules/taxonomy/restapi/Examples.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.taxonomy.restapi; - -/** - * - * Initial date: 6 Oct 2017<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final TaxonomyVO SAMPLE_TAXONOMYVO = new TaxonomyVO(); - public static final TaxonomyLevelVO SAMPLE_TAXONOMYLEVELVO = new TaxonomyLevelVO(); - public static final TaxonomyLevelTypeVO SAMPLE_TAXONOMYLEVELTYPEVO = new TaxonomyLevelTypeVO(); - public static final TaxonomyCompetenceVO SAMPLE_TAXONOMYCOMPETENCEVO = new TaxonomyCompetenceVO(); - - static { - SAMPLE_TAXONOMYVO.setKey(1l); - SAMPLE_TAXONOMYVO.setIdentifier("ID-Taxonomy"); - SAMPLE_TAXONOMYVO.setDisplayName("Taxonomy"); - SAMPLE_TAXONOMYVO.setDescription("A taxonomy"); - SAMPLE_TAXONOMYVO.setExternalId("EXT-ID-Taxonomy"); - - SAMPLE_TAXONOMYLEVELVO.setKey(2l); - SAMPLE_TAXONOMYLEVELVO.setIdentifier("ID-Level-Taxonomy"); - SAMPLE_TAXONOMYLEVELVO.setDisplayName("A taxonomy level"); - SAMPLE_TAXONOMYLEVELVO.setDescription("A taxonomy level with a parent"); - SAMPLE_TAXONOMYLEVELVO.setExternalId("EXT-ID-Level-Taxonomy"); - SAMPLE_TAXONOMYLEVELVO.setParentKey(300l); - SAMPLE_TAXONOMYLEVELVO.setTypeKey(301l); - - SAMPLE_TAXONOMYLEVELTYPEVO.setKey(3l); - SAMPLE_TAXONOMYLEVELTYPEVO.setIdentifier("ID-Taxonomy-Level-Type"); - SAMPLE_TAXONOMYLEVELTYPEVO.setDisplayName("Taxonomy level type"); - SAMPLE_TAXONOMYLEVELTYPEVO.setDescription("Settings for a taxonomy level"); - SAMPLE_TAXONOMYLEVELTYPEVO.setExternalId("EXT-ID-Taxonomy-Level-Type"); - - SAMPLE_TAXONOMYCOMPETENCEVO.setKey(4l); - SAMPLE_TAXONOMYCOMPETENCEVO.setIdentityKey(400l); - SAMPLE_TAXONOMYCOMPETENCEVO.setTaxonomyLevelKey(2l); - SAMPLE_TAXONOMYCOMPETENCEVO.setTaxonomyCompetenceType("teach"); - } - -} diff --git a/src/main/java/org/olat/modules/taxonomy/restapi/TaxonomyWebService.java b/src/main/java/org/olat/modules/taxonomy/restapi/TaxonomyWebService.java index cc18213c07a..ee931e94ba8 100644 --- a/src/main/java/org/olat/modules/taxonomy/restapi/TaxonomyWebService.java +++ b/src/main/java/org/olat/modules/taxonomy/restapi/TaxonomyWebService.java @@ -21,7 +21,6 @@ package org.olat.modules.taxonomy.restapi; import static org.olat.restapi.security.RestSecurityHelper.getIdentity; - import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -61,7 +60,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -84,23 +82,17 @@ public class TaxonomyWebService { /** * Return the taxonomy object specified by the key in path. * - * @response.representation.200.qname {http://www.example.com}taxonomyVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param taxonomyKey If true, the status of the block is done or the status of the roll call is closed or auto closed * @param httpRequest The HTTP request * @return The taxonomy */ @GET @Operation(summary = "Return the taxonomy object", description = "Return the taxonomy object specified by the key in path") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A taxonomy", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "A taxonomy", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getTaxonomy() { TaxonomyVO taxonomyVo = new TaxonomyVO(taxonomy); @@ -110,11 +102,6 @@ public class TaxonomyWebService { /** * Return the flatted levels of a taxonomy. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param taxonomyKey If true, the status of the block is done or the status of the roll call is closed or auto closed * @param httpRequest The HTTP request * @return An array of taxonomy levels @@ -122,12 +109,11 @@ public class TaxonomyWebService { @GET @Path("levels") @Operation(summary = "Return the flatted levels of a taxonomy", description = "Return the flatted levels of a taxonomy") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A taxonomy", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found") }) + @ApiResponse(responseCode = "200", description = "A taxonomy", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getFlatTaxonomyLevels() { List<TaxonomyLevel> levels = taxonomyService.getTaxonomyLevels(taxonomy); @@ -143,12 +129,6 @@ public class TaxonomyWebService { * null parent key will make the level a root one, a new parent key will move * the level. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy level - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc An existant level was not found * @param taxonomyKey The taxonomy tree where this level is * @param httpRequest The HTTP request * @param levelVo The roll call to update @@ -159,12 +139,11 @@ public class TaxonomyWebService { @Operation(summary = "Create or update a taxonomy level", description = "Create or update a taxonomy level. The method changes to tree structure, a\n" + " null parent key will make the level a root one, a new parent key will move\n" + " the level") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A taxonomy level", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "An existant level was not found") }) + @ApiResponse(responseCode = "200", description = "A taxonomy level", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "An existant level was not found") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response putTaxonomyLevel(TaxonomyLevelVO levelVo) { @@ -224,12 +203,6 @@ public class TaxonomyWebService { /** * Delete the taxonomy level definitively. * - * @response.representation.200.doc The level was successfully deleted - * @response.representation.304.doc The level cannot be deleted and was not modified - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The level was not found - * @response.representation.404.doc The level taxonomy doesn't match the taxonomy of the web service - * * @param taxonomyKey The taxonomy tree * @param taxonomyLevelKey The level of the taxonomy to delete * @return Nothing @@ -237,11 +210,10 @@ public class TaxonomyWebService { @DELETE @Path("levels/{taxonomyLevelKey}") @Operation(summary = "Delete the taxonomy level definitively", description = "Delete the taxonomy level definitively") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The level was successfully deleted"), - @ApiResponse(responseCode = "304", description = "The level cannot be deleted and was not modified"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The level was not found OR The level taxonomy doesn't match the taxonomy of the web service") }) + @ApiResponse(responseCode = "200", description = "The level was successfully deleted") + @ApiResponse(responseCode = "304", description = "The level cannot be deleted and was not modified") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The level was not found OR The level taxonomy doesn't match the taxonomy of the web service") public Response deleteTaxonomyLevel(@PathParam("taxonomyLevelKey") String taxonomyLevelKey) { TaxonomyLevel level = taxonomyService.getTaxonomyLevel(new TaxonomyLevelRefImpl(new Long(taxonomyLevelKey))); if(level == null) { @@ -261,11 +233,6 @@ public class TaxonomyWebService { /** * Return the competences of users on the taxonomy level specified in the key in path. * - * @response.representation.200.qname {http://www.example.com}taxonomyCompetenceVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of competences - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYCOMPETENCEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param taxonomyKey The taxonomy tree * @param taxonomyLevelKey The level of the taxonomy * @param httpRequest The HTTP request @@ -274,11 +241,10 @@ public class TaxonomyWebService { @GET @Path("levels/{taxonomyLevelKey}/competences") @Operation(summary = "Return the competences", description = "Return the competences of users on the taxonomy level specified in the key in path") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of competences", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "An array of competences", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getTaxonomyLevelComptences(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { @@ -298,11 +264,6 @@ public class TaxonomyWebService { /** * Return the competences of a specific user in the taxonomy tree. * - * @response.representation.200.qname {http://www.example.com}taxonomyCompetenceVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of competences - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYCOMPETENCEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param taxonomyKey The taxonomy tree * @param identityKey The user * @param httpRequest The HTTP request @@ -311,11 +272,10 @@ public class TaxonomyWebService { @GET @Path("competences/{identityKey}") @Operation(summary = "Return the competences", description = "Return the competences of a specific user in the taxonomy tree") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of competences", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "An array of competences", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getTaxonomyComptencesByIdentity(@PathParam("identityKey") Long identityKey) { @@ -336,11 +296,6 @@ public class TaxonomyWebService { * Return the competences of a specific user on the taxonomy level * specified in the key in path. * - * @response.representation.200.qname {http://www.example.com}taxonomyCompetenceVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of competences - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYCOMPETENCEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param taxonomyKey The taxonomy tree * @param taxonomyLevelKey The level of the taxonomy * @param identityKey The user @@ -351,11 +306,10 @@ public class TaxonomyWebService { @Path("levels/{taxonomyLevelKey}/competences/{identityKey}") @Operation(summary = "Return the competences", description = "Return the competences of a specific user on the taxonomy level\n" + " specified in the key in path") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of competences", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "An array of competences", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyCompetenceVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getTaxonomyLevelComptencesByIdentity(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey, @@ -380,13 +334,6 @@ public class TaxonomyWebService { /** * Add a competence on a specific level of a taxonomy tree. * - * @response.representation.200.qname {http://www.example.com}taxonomyCompetenceVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A competence - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYCOMPETENCEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy level type to update was not found - * @response.representation.409.doc The taxonomy level key of the competence doesn't match the one in URL * @param taxonomyKey The taxonomy tree * @param taxonomyLevelKey The taxonomy level * @param comptenceVo The competence to add or update @@ -396,11 +343,10 @@ public class TaxonomyWebService { @PUT @Path("levels/{taxonomyLevelKey}/competences") @Operation(summary = "Add a competence", description = "Add a competence on a specific level of a taxonomy tree") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A competence", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyCompetenceVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyCompetenceVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "A competence", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyCompetenceVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyCompetenceVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response putTaxonomyLevelComptencesByIdentity(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey, @@ -452,9 +398,6 @@ public class TaxonomyWebService { /** * Remove a competence. * - * @response.representation.200.doc The competence was removed sucessfully - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The competence was not found * @param taxonomyKey The taxonomy tree * @param taxonomyLevelKey The taxonomy level * @param competenceKey The competence to remove @@ -464,10 +407,9 @@ public class TaxonomyWebService { @DELETE @Path("levels/{taxonomyLevelKey}/competences/{competenceKey}") @Operation(summary = "Remove a competence", description = "Remove a competence") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The competence was removed sucessfully"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The competence was not found")}) + @ApiResponse(responseCode = "200", description = "The competence was removed sucessfully") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The competence was not found") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response removeTaxonomyLevelCompetence(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey, @PathParam("competenceKey") Long competenceKey, @Context HttpServletRequest httpRequest) { @@ -487,12 +429,6 @@ public class TaxonomyWebService { /** * Get the configurations for taxonomy levels for the whole taxonomy. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy level - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy was not found * @param taxonomyKey The taxonomy tree * @param httpRequest The HTTP request * @return An array of taxonomy levels types @@ -500,12 +436,11 @@ public class TaxonomyWebService { @GET @Path("types") @Operation(summary = "Get the configurations", description = "Get the configurations for taxonomy levels for the whole taxonomy") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The competence was removed sucessfully", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The taxonomy was not found")}) + @ApiResponse(responseCode = "200", description = "The competence was removed sucessfully", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The taxonomy was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getTaxonomyLevelTypes() { List<TaxonomyLevelType> types = taxonomyService.getTaxonomyLevelTypes(taxonomy); @@ -519,12 +454,6 @@ public class TaxonomyWebService { /** * Create or Update a taxonomy level's type. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy level type - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy level type to update was not found * @param taxonomyKey The taxonomy tree * @param httpRequest The HTTP request * @param typeVo The taxonomy level type to create or update @@ -533,12 +462,11 @@ public class TaxonomyWebService { @PUT @Path("types") @Operation(summary = "Create or Update a taxonomy level's type", description = "Create or Update a taxonomy level's type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A taxonomy level type", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The taxonomy level type to update was not found")}) + @ApiResponse(responseCode = "200", description = "A taxonomy level type", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The taxonomy level type to update was not found") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response putTaxonomyLevelType(TaxonomyLevelTypeVO typeVo) { @@ -606,12 +534,6 @@ public class TaxonomyWebService { /** * Get a taxonomy level's type. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A taxonomy level type - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy level type was not found * @param taxonomyKey The taxonomy tree * @param httpRequest The HTTP request * @param typeKey The primary key of the taxonomy level type to retrieve @@ -620,12 +542,11 @@ public class TaxonomyWebService { @GET @Path("types/{typeKey}") @Operation(summary = "Get a taxonomy level's type", description = "Get a taxonomy level's type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A taxonomy level type", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found")}) + @ApiResponse(responseCode = "200", description = "A taxonomy level type", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TaxonomyLevelTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getTaxonomyLevelType(@PathParam("typeKey") Long typeKey) { TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(new TaxonomyLevelTypeRefImpl(typeKey)); @@ -638,12 +559,6 @@ public class TaxonomyWebService { /** * Get the allowed sub-types of a specified taxonomy level's type. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of taxonomy level types - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy level type was not found * @param taxonomyKey The taxonomy tree * @param httpRequest The HTTP request * @param typeKey The primary key of the taxonomy level type @@ -652,12 +567,11 @@ public class TaxonomyWebService { @GET @Path("types/{typeKey}/allowedSubTypes") @Operation(summary = "Get the allowed sub-types", description = "Get the allowed sub-types of a specified taxonomy level's type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of taxonomy level types", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found")}) + @ApiResponse(responseCode = "200", description = "An array of taxonomy level types", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelTypeVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getAllowedSubTaxonomyLevelTypes(@PathParam("typeKey") Long typeKey) { TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(new TaxonomyLevelTypeRefImpl(typeKey)); @@ -676,12 +590,6 @@ public class TaxonomyWebService { /** * Add a sub-type to a specified taxonomy level's type. * - * @response.representation.200.qname {http://www.example.com}taxonomyLevelTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The sub type was added to the allowed sub types - * @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYLEVELTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy level type was not found * @param taxonomyKey The taxonomy tree * @param typeKey The type * @param subTypeKey The sub type @@ -691,10 +599,9 @@ public class TaxonomyWebService { @PUT @Path("types/{typeKey}/allowedSubTypes/{subTypeKey}") @Operation(summary = "Add a sub-type", description = "Add a sub-type to a specified taxonomy level's type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The sub type was added to the allowed sub types"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found")}) + @ApiResponse(responseCode = "200", description = "The sub type was added to the allowed sub types") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response allowSubTaxonomyLevelType(@PathParam("typeKey") Long typeKey, @PathParam("subTypeKey") Long subTypeKey) { TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(new TaxonomyLevelTypeRefImpl(typeKey)); @@ -709,9 +616,6 @@ public class TaxonomyWebService { /** * Remove a sub-type to a specified taxonomy level's type. * - * @response.representation.200.doc The sub type was removed sucessfully - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The taxonomy level type was not found * @param taxonomyKey The taxonomy tree * @param typeKey The type * @param subTypeKey The sub type to remove @@ -721,10 +625,9 @@ public class TaxonomyWebService { @DELETE @Path("types/{typeKey}/allowedSubTypes/{subTypeKey}") @Operation(summary = "Remove a sub-type", description = "Remove a sub-type to a specified taxonomy level's type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The sub type was removed sucessfully"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found")}) + @ApiResponse(responseCode = "200", description = "The sub type was removed sucessfully") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The taxonomy level type was not found") public Response disalloweSubTaxonomyLevelType(@PathParam("typeKey") Long typeKey, @PathParam("subTypeKey") Long subTypeKey) { TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(new TaxonomyLevelTypeRefImpl(typeKey)); TaxonomyLevelType subType = taxonomyService.getTaxonomyLevelType(new TaxonomyLevelTypeRefImpl(subTypeKey)); diff --git a/src/main/java/org/olat/modules/vitero/restapi/Examples.java b/src/main/java/org/olat/modules/vitero/restapi/Examples.java deleted file mode 100644 index e3c62b762ab..00000000000 --- a/src/main/java/org/olat/modules/vitero/restapi/Examples.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.vitero.restapi; - -import java.util.Date; - -/** - * - * Initial date: 15.07.2015<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Examples { - - public static final ViteroBookingVO SAMPLE_ViteroBookingVO = new ViteroBookingVO(); - public static final ViteroGroupMemberVO SAMPLE_ViteroGroupMemberVO = new ViteroGroupMemberVO(); - - static { - SAMPLE_ViteroBookingVO.setAutoSignIn(true); - SAMPLE_ViteroBookingVO.setBookingId(23); - SAMPLE_ViteroBookingVO.setEnd(new Date()); - SAMPLE_ViteroBookingVO.setEndBuffer(15); - SAMPLE_ViteroBookingVO.setEventName("New event"); - SAMPLE_ViteroBookingVO.setExternalId("AC-234"); - SAMPLE_ViteroBookingVO.setGroupId(24); - SAMPLE_ViteroBookingVO.setGroupName("NEW-EVENT_OLAT_938745983"); - SAMPLE_ViteroBookingVO.setRoomSize(22); - SAMPLE_ViteroBookingVO.setStart(new Date()); - SAMPLE_ViteroBookingVO.setStartBuffer(15); - SAMPLE_ViteroBookingVO.setTimeZoneId(""); - - SAMPLE_ViteroGroupMemberVO.setGroupRole("participant"); - SAMPLE_ViteroGroupMemberVO.setIdentityKey(23497l); - } - -} diff --git a/src/main/java/org/olat/modules/vitero/restapi/ViteroBookingWebService.java b/src/main/java/org/olat/modules/vitero/restapi/ViteroBookingWebService.java index c2375092a8f..766bf293ad5 100644 --- a/src/main/java/org/olat/modules/vitero/restapi/ViteroBookingWebService.java +++ b/src/main/java/org/olat/modules/vitero/restapi/ViteroBookingWebService.java @@ -20,7 +20,6 @@ package org.olat.modules.vitero.restapi; import java.util.ArrayList; - import java.util.Collections; import java.util.List; import java.util.Locale; @@ -37,13 +36,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.apache.logging.log4j.Logger; import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.IdentityPowerSearchQueries; import org.olat.basesecurity.SearchIdentityParams; import org.olat.core.id.Identity; import org.olat.core.id.OLATResourceable; import org.olat.core.id.UserConstants; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.Util; import org.olat.modules.vitero.ViteroModule; @@ -62,7 +61,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -94,22 +92,15 @@ public class ViteroBookingWebService { /** * returns the list of booking of the resource. * - * @response.representation.200.qname {http://www.example.com}viteroBookingVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc This is the list of all bookings of a resource - * @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroBookingVO} * @return The list of vitero booking */ @GET @Operation(summary = "returns the list of booking of the resource", description = "returns the list of booking of the resource") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "This is the list of all bookings of a resource", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "This is the list of all bookings of a resource", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))) + }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRooms() { try { @@ -129,22 +120,15 @@ public class ViteroBookingWebService { /** * Return the created or updated booking * - * @response.representation.200.qname {http://www.example.com}viteroBookingVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The created booking - * @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroBookingVO} * @return The list of vitero booking */ @PUT @Operation(summary = "Return the created or updated booking", description = "Return the created or updated booking") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The created booking", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "The created booking", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createRoom(ViteroBookingVO booking) { @@ -154,22 +138,15 @@ public class ViteroBookingWebService { /** * Return the created or updated booking * - * @response.representation.200.qname {http://www.example.com}viteroBookingVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The created booking - * @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroBookingVO} * @return The list of vitero booking */ @POST @Operation(summary = "Return the created or updated booking", description = "Return the created or updated booking") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The created booking", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "The created booking", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroBookingVO.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateRoom(ViteroBookingVO booking) { @@ -214,17 +191,14 @@ public class ViteroBookingWebService { } /** - * Delete the booking + * Delete the booking. * - * @response.representation.200.doc The booking is deleted * @return Nothing */ @DELETE @Path("{bookingId}") @Operation(summary = "Delete the booking", description = "Delete the booking") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The booking is deleted")} -) + @ApiResponse(responseCode = "200", description = "The booking is deleted") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response deleteRoom(@PathParam("bookingId") int bookingId) { try { @@ -245,24 +219,17 @@ public class ViteroBookingWebService { /** * Returns the list of members of the booking. * - * @response.representation.200.qname {http://www.example.com}viteroGroupMemberVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc This is the list of all bookings of a resource - * @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroGroupMemberVO} * @param bookingId The id of the booking * @return The list of members in the specified booking */ @GET @Path("{bookingId}/members") @Operation(summary = "Returns the list of members of the booking", description = "Returns the list of members of the booking") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "This is the list of all bookings of a resource", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "This is the list of all bookings of a resource", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))) + }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMembers(@PathParam("bookingId") int bookingId) { try { @@ -299,10 +266,6 @@ public class ViteroBookingWebService { * Update the list of members of the booking, it add and mutates the * members and delete the missing members. * - * @response.representation.200.qname {http://www.example.com}viteroGroupMemberVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc This is the list of all bookings of a resource - * @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroGroupMemberVO} * @param bookingId The id of the booking * @param members The array of members * @return Nothing @@ -311,14 +274,11 @@ public class ViteroBookingWebService { @Path("{bookingId}/members") @Operation(summary = "Update the lsit of members", description = "Update the list of members of the booking, it add and mutates the\n" + " members and delete the missing members.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "This is the list of all bookings of a resource", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))) - } - )} -) + @ApiResponse(responseCode = "200", description = "This is the list of all bookings of a resource", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ViteroGroupMemberVO.class))) + }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addMembers(@PathParam("bookingId") int bookingId, ViteroGroupMemberVO[] members) { diff --git a/src/main/java/org/olat/modules/wiki/restapi/GroupWikiWebService.java b/src/main/java/org/olat/modules/wiki/restapi/GroupWikiWebService.java index e9d4f5c9fa2..af9a2ab2372 100644 --- a/src/main/java/org/olat/modules/wiki/restapi/GroupWikiWebService.java +++ b/src/main/java/org/olat/modules/wiki/restapi/GroupWikiWebService.java @@ -20,7 +20,6 @@ package org.olat.modules.wiki.restapi; import javax.servlet.http.HttpServletRequest; - import javax.servlet.http.HttpServletResponse; import javax.ws.rs.GET; import javax.ws.rs.Produces; @@ -33,7 +32,6 @@ import org.olat.group.BusinessGroup; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -63,8 +61,7 @@ public class GroupWikiWebService { @GET @Operation(summary = "will export the wiki", description = "will export the wiki from the current group to a CP and serve as\n" + " zip-file.<br />") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "wiki expoted") }) + @ApiResponse(responseCode = "200", description = "wiki expoted") @Produces({ "application/zip", MediaType.APPLICATION_OCTET_STREAM }) public Response exportWiki(@Context HttpServletRequest request, @Context HttpServletResponse response) { if (learningGroup == null) diff --git a/src/main/java/org/olat/modules/wiki/restapi/WikisWebService.java b/src/main/java/org/olat/modules/wiki/restapi/WikisWebService.java index 743ab7ce923..f0c64279cd5 100644 --- a/src/main/java/org/olat/modules/wiki/restapi/WikisWebService.java +++ b/src/main/java/org/olat/modules/wiki/restapi/WikisWebService.java @@ -49,7 +49,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -94,10 +93,9 @@ public class WikisWebService { */ @GET @Operation(summary = "get list of repo-entry wikis", description = "get list of repo-entry wikis. Group-Wikis are not listed!") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Retrieve all the wikis", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = WikiVOes.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = WikiVOes.class))) })}) + @ApiResponse(responseCode = "200", description = "Retrieve all the wikis", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = WikiVOes.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = WikiVOes.class))) }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public Response getWikis(@Context HttpServletRequest httpRequest) { List<RepositoryEntry> res = getAccessibleWikiRepositoryEntries(httpRequest); diff --git a/src/main/java/org/olat/registration/restapi/ChangePasswordWebService.java b/src/main/java/org/olat/registration/restapi/ChangePasswordWebService.java index 4781abec0c6..05b832bf4e5 100644 --- a/src/main/java/org/olat/registration/restapi/ChangePasswordWebService.java +++ b/src/main/java/org/olat/registration/restapi/ChangePasswordWebService.java @@ -47,7 +47,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** @@ -78,9 +77,8 @@ public class ChangePasswordWebService { */ @PUT @Operation(summary = "Change password", description = "Change password") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Password has been changed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "Password has been changed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response register(@QueryParam("identityKey") Long identityKey, @Context HttpServletRequest request) { if(!isUserManagerOf(identityKey, request)) { diff --git a/src/main/java/org/olat/registration/restapi/RegistrationWebService.java b/src/main/java/org/olat/registration/restapi/RegistrationWebService.java index ef8d0c6b851..9264922fcb5 100644 --- a/src/main/java/org/olat/registration/restapi/RegistrationWebService.java +++ b/src/main/java/org/olat/registration/restapi/RegistrationWebService.java @@ -60,7 +60,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** @@ -83,35 +82,30 @@ public class RegistrationWebService { /** * Register with the specified email - * @response.representation.200.doc Registration successful - * @response.representation.304.doc Already registered, HTTP-Header location set to redirect + * * @param email The email address * @param request The HTTP Request * @return */ @POST @Operation(summary = "Register with the specified email", description = "Register with the specified email") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Registration successful"), - @ApiResponse(responseCode = "304", description = "Already registered, HTTP-Header location set to redirect") }) + @ApiResponse(responseCode = "200", description = "Registration successful") + @ApiResponse(responseCode = "304", description = "Already registered, HTTP-Header location set to redirect") public Response registerPost(@FormParam("email") String email, @Context HttpServletRequest request) { return register(email, request); } /** * Register with the specified email - * @response.representation.200.doc Registration successful - * @response.representation.304.doc Already registered, HTTP-Header location set to redirect - * @response.representation.400.doc Email address not allowed + * * @param email The email address * @param request The HTTP Request * @return */ @PUT @Operation(summary = "Register with the specified email", description = "Register with the specified email") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Registration successful"), - @ApiResponse(responseCode = "304", description = "Already registered, HTTP-Header location set to redirect") }) + @ApiResponse(responseCode = "200", description = "Registration successful") + @ApiResponse(responseCode = "304", description = "Already registered, HTTP-Header location set to redirect") public Response register(@QueryParam("email") @Parameter(description = "The email address") String email, @Context HttpServletRequest request) { if (!CoreSpringFactory.getImpl(RegistrationModule.class).isSelfRegistrationEnabled()) { return Response.serverError().status(Status.NOT_FOUND).build(); diff --git a/src/main/java/org/olat/restapi/group/LearningGroupWebService.java b/src/main/java/org/olat/restapi/group/LearningGroupWebService.java index 838d5937258..0f8f47d844d 100644 --- a/src/main/java/org/olat/restapi/group/LearningGroupWebService.java +++ b/src/main/java/org/olat/restapi/group/LearningGroupWebService.java @@ -91,7 +91,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -118,16 +117,13 @@ public class LearningGroupWebService { /** * Retrieves the version of the Group Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "Retrieves the version of the Group Web Service", description = "Retrieves the version of the Group Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service")}) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -136,10 +132,7 @@ public class LearningGroupWebService { /** * Return the list of all groups if you have group manager permission, or all * learning group that you particip with or owne. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc This is the list of all groups in OLAT system - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVOes} + * * @param externalId Search with an external ID * @param managed (true / false) Search only managed / not managed groups * @param request The HTTP Request @@ -148,10 +141,9 @@ public class LearningGroupWebService { @GET @Operation(summary = "Return the list of all groups ", description = "Return the list of all groups if you have group manager permission, or all\n" + " learning group that you particip with or owne") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "This is the list of all groups in OLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) })}) + @ApiResponse(responseCode = "200", description = "This is the list of all groups in OLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getGroupList(@QueryParam("externalId") @Parameter(description = "Search with an external ID") String externalId, @QueryParam("managed") @Parameter(description = "(true / false) Search only managed / not managed groups") Boolean managed, @Context HttpServletRequest request) { @@ -180,10 +172,7 @@ public class LearningGroupWebService { /** * Return the group specified by the key of the group. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A business group in the OLAT system - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} + * * @param groupKey The key of the group * @param request The REST request * @param httpRequest The HTTP request @@ -192,10 +181,9 @@ public class LearningGroupWebService { @GET @Path("{groupKey}") @Operation(summary = "Return the group specified by the key of the group", description = "RReturn the group specified by the key of the group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A business group in the OLAT system", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) })}) + @ApiResponse(responseCode = "200", description = "A business group in the OLAT system", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response findById(@PathParam("groupKey") Long groupKey, @Context Request request, @Context HttpServletRequest httpRequest) { @@ -220,16 +208,7 @@ public class LearningGroupWebService { /** * Create a group. - * @response.representation.qname {http://www.example.com}groupVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc A business group in the OLAT system - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The saved business group - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The key of the group * @param group The group * @param request The HTTP request @@ -237,12 +216,11 @@ public class LearningGroupWebService { */ @PUT @Operation(summary = "Create a group", description = "Create a group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The saved business group", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") }) + @ApiResponse(responseCode = "200", description = "The saved business group", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createGroup(final GroupVO group, @Context HttpServletRequest request) { @@ -271,16 +249,7 @@ public class LearningGroupWebService { /** * Updates a group. - * @response.representation.qname {http://www.example.com}groupVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc A business group in the OLAT system - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The saved business group - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The key of the group * @param group The group * @param request The HTTP request @@ -289,12 +258,11 @@ public class LearningGroupWebService { @POST @Path("{groupKey}") @Operation(summary = "Update a group", description = "Update a group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The saved business group", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") }) + @ApiResponse(responseCode = "200", description = "The saved business group", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postGroup(@PathParam("groupKey") Long groupKey, final GroupVO group, @Context HttpServletRequest request) { @@ -322,8 +290,6 @@ public class LearningGroupWebService { /** * Returns the news. * - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found or the news tool is not enabled * @param groupKey The key of the group * @param request The HTTP Request * @return @@ -331,12 +297,11 @@ public class LearningGroupWebService { @GET @Path("{groupKey}/news") @Operation(summary = "Returns the news", description = "Returns the news") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The news", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = String.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") }) + @ApiResponse(responseCode = "200", description = "The news", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = String.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") @Produces({MediaType.TEXT_PLAIN}) public Response getNews(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); @@ -367,8 +332,6 @@ public class LearningGroupWebService { /** * Update the news. * - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found or the news tool is not enabled * @param groupKey The key of the group * @param news The news * @param request The HTTP request @@ -377,12 +340,11 @@ public class LearningGroupWebService { @POST @Path("{groupKey}/news") @Operation(summary = "Update the news", description = "Update the news") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The updated news", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = String.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") }) + @ApiResponse(responseCode = "200", description = "The updated news", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = String.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response postNews(@PathParam("groupKey") Long groupKey, @FormParam("news") String news, @Context HttpServletRequest request) { BusinessGroup bg = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(groupKey); @@ -404,9 +366,7 @@ public class LearningGroupWebService { /** * Deletes the news of the group if the news tool is enabled. - * @response.representation.200.doc The news are deleted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found or hte news tool is not enabled + * * @param groupKey The key of the group * @param request The HTTP request * @return @@ -414,10 +374,9 @@ public class LearningGroupWebService { @DELETE @Path("{groupKey}/news") @Operation(summary = "Deletes the news of the group if the news tool is enabled", description = "Deletes the news of the group if the news tool is enabled") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The new are deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") }) + @ApiResponse(responseCode = "200", description = "The new are deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") public Response deleteNews(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { BusinessGroup bg = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(groupKey); if(bg == null) { @@ -439,10 +398,9 @@ public class LearningGroupWebService { @POST @Path("{groupKey}/configuration") @Operation(summary = "Post configuration", description = "Post configuration") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Configuration posted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Group not found") }) + @ApiResponse(responseCode = "200", description = "Configuration posted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Group not found") public Response postGroupConfiguration(@PathParam("groupKey") Long groupKey, final GroupConfigurationVO group, @Context HttpServletRequest request) { if(!isGroupManager(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -517,9 +475,7 @@ public class LearningGroupWebService { /** * Deletes the business group specified by the groupKey. - * @response.representation.200.doc The business group is deleted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The key of the group * @param request The HTTP request * @return @@ -527,10 +483,9 @@ public class LearningGroupWebService { @DELETE @Path("{groupKey}") @Operation(summary = "Deletes the business group specified by the groupKey", description = "Deletes the business group specified by the groupKey") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The business group is deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") }) + @ApiResponse(responseCode = "200", description = "The business group is deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found or the news tool is not enabled") public Response deleteGroup(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { if(!isGroupManager(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -547,11 +502,7 @@ public class LearningGroupWebService { /** * Returns the informations of the group specified by the groupKey. - * @response.representation.200.qname {http://www.example.com}groupInfoVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Participants of the business group - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPINFOVO} - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The key of the group * @param request The HTTP Request * @return @@ -559,11 +510,10 @@ public class LearningGroupWebService { @GET @Path("{groupKey}/infos") @Operation(summary = " Returns the informations of the group specified by the groupKey", description = " Returns the informations of the group specified by the groupKey") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The updated news", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupInfoVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupInfoVO.class)) }), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") }) + @ApiResponse(responseCode = "200", description = "The updated news", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupInfoVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupInfoVO.class)) }) + @ApiResponse(responseCode = "404", description = "The business group cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getInformations(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); @@ -720,11 +670,7 @@ public class LearningGroupWebService { /** * Returns the list of owners of the group specified by the groupKey. - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Owners of the business group - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The key of the group * @param request The HTTP Request * @return @@ -732,12 +678,10 @@ public class LearningGroupWebService { @GET @Path("{groupKey}/owners") @Operation(summary = "Returns the list of owners of the group specified by the groupKey", description = "Returns the list of owners of the group specified by the groupKey") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Owners of the business group", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") - }) + @ApiResponse(responseCode = "200", description = "Owners of the business group", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "404", description = "The business group cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTutors(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); @@ -763,11 +707,7 @@ public class LearningGroupWebService { /** * Returns the list of participants of the group specified by the groupKey. - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Participants of the business group - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The key of the group * @param request The HTTP Request * @return @@ -775,12 +715,10 @@ public class LearningGroupWebService { @GET @Path("{groupKey}/participants") @Operation(summary = "Returns the list of participants of the group specified by the groupKey", description = "Returns the list of participants of the group specified by the groupKey") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Participants of the business group", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") - }) + @ApiResponse(responseCode = "200", description = "Participants of the business group", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "404", description = "The business group cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getParticipants(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); @@ -815,9 +753,7 @@ public class LearningGroupWebService { /** * Adds an owner to the group. - * @response.representation.200.doc The user is added as owner of the group - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group or the user cannot be found + * * @param groupKey The key of the group * @param identityKey The user's id * @param request The HTTP request @@ -826,11 +762,9 @@ public class LearningGroupWebService { @PUT @Path("{groupKey}/owners/{identityKey}") @Operation(summary = "Add an owner to the group", description = "Adds an owner to the group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is added as owner of the group"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") - }) + @ApiResponse(responseCode = "200", description = "The user is added as owner of the group") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found") public Response addTutor(@PathParam("groupKey") Long groupKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { try { if(!isGroupManager(request)) { @@ -855,9 +789,7 @@ public class LearningGroupWebService { /** * Removes the owner from the group. - * @response.representation.200.doc The user is removed as owner from the group - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group or the user cannot be found + * * @param groupKey The key of the group * @param identityKey The user's id * @param request The HTTP request @@ -866,11 +798,9 @@ public class LearningGroupWebService { @DELETE @Path("{groupKey}/owners/{identityKey}") @Operation(summary = "Removes the owner from the group", description = "Removes the owner from the group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is removed as owner from the group"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group or the user cannot be found") - }) + @ApiResponse(responseCode = "200", description = "The user is removed as owner from the group") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group or the user cannot be found") public Response removeTutor(@PathParam("groupKey") Long groupKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { try { if(!isGroupManager(request)) { @@ -895,9 +825,7 @@ public class LearningGroupWebService { /** * Adds a participant to the group. - * @response.representation.200.doc The user is added as participant of the group - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group or the user cannot be found + * * @param groupKey The key of the group * @param identityKey The user's id * @param request The HTTP request @@ -906,11 +834,9 @@ public class LearningGroupWebService { @PUT @Path("{groupKey}/participants/{identityKey}") @Operation(summary = "Adds a participant to the group", description = "Adds a participant to the group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is added as participant of the group"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group or the user cannot be found") - }) + @ApiResponse(responseCode = "200", description = "The user is added as participant of the group") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group or the user cannot be found") public Response addParticipant(@PathParam("groupKey") Long groupKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { try { if(!isGroupManager(request)) { @@ -940,9 +866,7 @@ public class LearningGroupWebService { /** * Removes a participant from the group. - * @response.representation.200.doc The user is remove from the group as participant - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group or the user cannot be found + * * @param groupKey The key of the group * @param identityKey The id of the user * @param request The HTTP request @@ -951,11 +875,9 @@ public class LearningGroupWebService { @DELETE @Path("{groupKey}/participants/{identityKey}") @Operation(summary = "Removes a participant from the group", description = "Removes a participant from the group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is remove from the group as participant"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group or the user cannot be found") - }) + @ApiResponse(responseCode = "200", description = "The user is remove from the group as participant") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group or the user cannot be found") public Response removeParticipant(@PathParam("groupKey") Long groupKey, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { try { if(!isGroupManager(request)) { diff --git a/src/main/java/org/olat/restapi/group/MyGroupWebService.java b/src/main/java/org/olat/restapi/group/MyGroupWebService.java index 9b94c3abe37..496cec0758e 100644 --- a/src/main/java/org/olat/restapi/group/MyGroupWebService.java +++ b/src/main/java/org/olat/restapi/group/MyGroupWebService.java @@ -58,7 +58,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -84,11 +83,7 @@ public class MyGroupWebService { /** * Return all groups of a user where the user is coach or participant. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The groups of the user - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVOes} - * @response.representation.404.doc The identity not found + * * @param start The first result * @param limit The maximum results * @param externalId Search with an external ID @@ -99,11 +94,10 @@ public class MyGroupWebService { */ @GET @Operation(summary = "Return all groups of a user where the user is coach or participant", description = "Return all groups of a user where the user is coach or participant") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The groups of the user", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }), - @ApiResponse(responseCode = "404", description = "The identity not found") }) + @ApiResponse(responseCode = "200", description = "The groups of the user", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }) + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getUserGroupList(@QueryParam("start") @Parameter(description = "The first result") @DefaultValue("0") Integer start, @QueryParam("limit") @Parameter(description = "The maximum results") @DefaultValue("25") Integer limit, @QueryParam("externalId") @Parameter(description = "Search with an external ID") String externalId, @QueryParam("managed") @Parameter(description = "(true / false) Search only managed / not managed groups") Boolean managed, @@ -114,11 +108,7 @@ public class MyGroupWebService { /** * Return all groups of a user where the user is coach/owner. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The groups of the user - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVOes} - * @response.representation.404.doc The identity not found + * * @param start The first result * @param limit The maximum results * @param externalId Search with an external ID @@ -130,11 +120,10 @@ public class MyGroupWebService { @GET @Path("owner") @Operation(summary = "Return all groups of a user where the user is coach/owner", description = "Return all groups of a user where the user is coach/owner") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The groups of the user", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }), - @ApiResponse(responseCode = "404", description = "The identity not found") }) + @ApiResponse(responseCode = "200", description = "The groups of the user", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }) + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOwnedGroupList(@QueryParam("start") @Parameter(description = "The first result") @DefaultValue("0") Integer start, @QueryParam("limit") @Parameter(description = "The maximum results") @DefaultValue("25") Integer limit, @QueryParam("externalId") @Parameter(description = "Search with an external ID") String externalId, @QueryParam("managed") @Parameter(description = "(true / false) Search only managed / not managed groups") Boolean managed, @@ -144,11 +133,7 @@ public class MyGroupWebService { /** * Return all groups of a user where the user is participant. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The groups of the user - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVOes} - * @response.representation.404.doc The identity not found + * * @param start The first result * @param limit The maximum results * @param externalId Search with an external ID @@ -160,11 +145,10 @@ public class MyGroupWebService { @GET @Path("participant") @Operation(summary = "Return all groups of a user where the user is participant", description = "Return all groups of a user where the user is participant") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The groups of the user", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }), - @ApiResponse(responseCode = "404", description = "The identity not found") }) + @ApiResponse(responseCode = "200", description = "The groups of the user", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }) + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getParticipatingGroupList(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @QueryParam("externalId") String externalId, @QueryParam("managed") Boolean managed, @@ -214,11 +198,7 @@ public class MyGroupWebService { /** * Return all groups with information of a user. Paging is mandatory! - * @response.representation.200.qname {http://www.example.com}groupInfoVO - * @response.representation.200.mediaType application/xml;pagingspec=1.0, application/json;pagingspec=1.0 - * @response.representation.200.doc The groups of the user - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPINFOVOes} - * @response.representation.406.doc The request hasn't paging information + * * @param start The first result * @param limit The maximum results * @param externalId Search with an external ID @@ -230,11 +210,10 @@ public class MyGroupWebService { @GET @Path("infos") @Operation(summary = "Return all groups with information of a user", description = "Return all groups with information of a user. Paging is mandatory") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The groups of the user", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupInfoVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupInfoVO.class))) }), - @ApiResponse(responseCode = "406", description = "The request hasn't paging information") }) + @ApiResponse(responseCode = "200", description = "The groups of the user", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupInfoVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupInfoVO.class))) }) + @ApiResponse(responseCode = "406", description = "The request hasn't paging information") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getUserGroupInfosList(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, diff --git a/src/main/java/org/olat/restapi/i18n/I18nWebService.java b/src/main/java/org/olat/restapi/i18n/I18nWebService.java index 413cf4a83a9..f4e395f6350 100644 --- a/src/main/java/org/olat/restapi/i18n/I18nWebService.java +++ b/src/main/java/org/olat/restapi/i18n/I18nWebService.java @@ -41,7 +41,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -62,16 +61,13 @@ public class I18nWebService { /** * Retrieves the version of the i18n Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "Retrieves the version of the i18n Web Service", description = "Retrieves the version of the i18n Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Return the version number") }) + @ApiResponse(responseCode = "200", description = "Return the version number") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -80,9 +76,7 @@ public class I18nWebService { /** * Return the translation of the key. If the "locale" parameter is not specified, the method * try to use the "locale" of the user and if it hasn't, take the default locale. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The translation of the package + key - * @response.representation.200.example OK + * * @param packageName The name of the package * @param key The key to translate * @param localeKey The locale (optional) @@ -93,8 +87,7 @@ public class I18nWebService { @Path("{package}/{key}") @Operation(summary = "Return the translation of the key", description = "Return the translation of the key. If the \"locale\" parameter is not specified, the method\n" + " try to use the \"locale\" of the user and if it hasn't, take the default locale") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The translation of the package + key") }) + @ApiResponse(responseCode = "200", description = "The translation of the package + key") @Produces(MediaType.TEXT_PLAIN) public Response getTranslation(@PathParam("package") String packageName, @PathParam("key") String key, @QueryParam("locale") String localeKey, @Context HttpServletRequest request) { I18nManager i18n = CoreSpringFactory.getImpl(I18nManager.class); diff --git a/src/main/java/org/olat/restapi/repository/CatalogWebService.java b/src/main/java/org/olat/restapi/repository/CatalogWebService.java index af448e7bb09..6f0be1e1b63 100644 --- a/src/main/java/org/olat/restapi/repository/CatalogWebService.java +++ b/src/main/java/org/olat/restapi/repository/CatalogWebService.java @@ -82,7 +82,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -114,16 +113,13 @@ public class CatalogWebService { /** * Retrieves the version of the Catalog Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "Retrieves the version of the Catalog Web Service", description = "Retrieves the version of the Catalog Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") }) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -131,19 +127,14 @@ public class CatalogWebService { /** * Returns the list of root catalog entries. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of roots catalog entries - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVOes} + * * @return The response */ @GET @Operation(summary = "Returns the list of root catalog entries", description = "Returns the list of root catalog entries") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Array of results for the whole the course", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }) - }) + @ApiResponse(responseCode = "200", description = "Array of results for the whole the course", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRoots(@Context HttpServletRequest httpRequest, @Context Request request) { List<CatalogEntry> rootEntries = catalogManager.getRootCatalogEntries(); @@ -160,11 +151,7 @@ public class CatalogWebService { /** * Returns the metadata of the catalog entry. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param uriInfo The URI informations * @param httpRequest The HTTP request @@ -174,11 +161,9 @@ public class CatalogWebService { @GET @Path("{path:.*}") @Operation(summary = "Returns the metadata of the catalog entry", description = "Returns the metadata of the catalog entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCatalogEntry(@PathParam("path") List<PathSegment> path, @Context UriInfo uriInfo, @Context HttpServletRequest httpRequest, @Context Request request) { @@ -202,11 +187,7 @@ public class CatalogWebService { /** * Returns a list of catalog entries. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of catalog entries - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVOes} - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param start * @param limit @@ -217,12 +198,10 @@ public class CatalogWebService { @GET @Path("{path:.*}/children") @Operation(summary = "Returns a list of catalog entries", description = "Returns a list of catalog entries") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of catalog entries", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The list of catalog entries", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }) + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getChildren(@PathParam("path") List<PathSegment> path, @QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @Context HttpServletRequest httpRequest, @Context Request request) { @@ -266,12 +245,7 @@ public class CatalogWebService { /** * Adds a catalog entry under the path specified in the URL. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param name The name * @param description The description @@ -284,13 +258,11 @@ public class CatalogWebService { @PUT @Path("{path:.*}") @Operation(summary = "Add a catalog", description = "Adds a catalog entry under the path specified in the URL") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addCatalogEntry(@PathParam("path") List<PathSegment> path, @@ -311,16 +283,7 @@ public class CatalogWebService { /** * Adds a catalog entry under the path specified in the URL. - * @response.representation.qname {http://www.example.com}catalogEntryVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The catalog entry - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param entryVo The catalog entry * @param httpRquest The HTTP request @@ -330,13 +293,11 @@ public class CatalogWebService { @PUT @Path("{path:.*}") @Operation(summary = "Add a catalog", description = "Adds a catalog entry under the path specified in the URL") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addCatalogEntry(@PathParam("path") List<PathSegment> path, CatalogEntryVO entryVo, @@ -396,12 +357,7 @@ public class CatalogWebService { /** * Updates the catalog entry under the path specified in the URL. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param name The name * @param description The description @@ -413,13 +369,11 @@ public class CatalogWebService { @POST @Path("{path:.*}") @Operation(summary = "Update a catalog", description = "Updates the catalog entry under the path specified in the URL") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updatePostCatalogEntry(@PathParam("path") List<PathSegment> path, @@ -435,12 +389,7 @@ public class CatalogWebService { /** * Updates the catalog entry with the path specified in the URL. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param id The id of the catalog entry * @param name The name @@ -453,13 +402,11 @@ public class CatalogWebService { @POST @Path("{path:.*}") @Operation(summary = "Update a catalog", description = "Updates the catalog entry with the path specified in the URL") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateCatalogEntry(@PathParam("path") List<PathSegment> path, @QueryParam("name") String name, @QueryParam("description") String description, @@ -474,12 +421,7 @@ public class CatalogWebService { /** * Updates the catalog entry with the path specified in the URL. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param entryVo The catalog entry * @param newParentKey The parent key to move the entry (optional) @@ -490,13 +432,11 @@ public class CatalogWebService { @POST @Path("{path:.*}") @Operation(summary = "Update a catalog", description = "Updates the catalog entry with the path specified in the URL") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CatalogEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CatalogEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateCatalogEntry(@PathParam("path") List<PathSegment> path, @@ -564,12 +504,7 @@ public class CatalogWebService { /** * Deletes the catalog entry with the path specified in the URL. - * @response.representation.200.qname {http://www.example.com}catalogEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_CATALOGENTRYVO} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param httpRquest The HTTP request * @return The response @@ -577,11 +512,9 @@ public class CatalogWebService { @DELETE @Path("{path:.*}") @Operation(summary = "Delete a catalog", description = "Deletes the catalog entry with the path specified in the URL") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry"), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry") + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response deleteCatalogEntry(@PathParam("path") List<PathSegment> path, @Context HttpServletRequest httpRequest) { Long key = getCatalogEntryKeyFromPath(path); @@ -616,12 +549,7 @@ public class CatalogWebService { /** * Get the owners of the local sub tree - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param httpRquest The HTTP request * @return The response @@ -629,13 +557,11 @@ public class CatalogWebService { @GET @Path("{path:.*}/owners") @Operation(summary = "Get the owners of the local sub tree", description = "Get the owners of the local sub tree") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOwners(@PathParam("path") List<PathSegment> path, @Context HttpServletRequest httpRequest) { Long key = getCatalogEntryKeyFromPath(path); @@ -663,12 +589,7 @@ public class CatalogWebService { /** * Retrieves data of an owner of the local sub tree - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @Param identityKey The id of the user * @param httpRquest The HTTP request @@ -677,13 +598,11 @@ public class CatalogWebService { @GET @Path("{path:.*}/owners/{identityKey}") @Operation(summary = "Retrieves data of an owner of the local sub tree", description = "Retrieves data of an owner of the local sub tree") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") public Response getOwner(@PathParam("path") List<PathSegment> path, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { Long key = getCatalogEntryKeyFromPath(path); @@ -716,12 +635,7 @@ public class CatalogWebService { /** * Add an owner of the local sub tree - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * * @param path The path * @param identityKey The id of the user * @param httpRquest The HTTP request @@ -730,13 +644,11 @@ public class CatalogWebService { @PUT @Path("{path:.*}/owners/{identityKey}") @Operation(summary = "Add an owner of the local sub tree", description = "Add an owner of the local sub tree") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CatalogEntryVO.class))) }) + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") public Response addOwner(@PathParam("path") List<PathSegment> path, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { Long key = getCatalogEntryKeyFromPath(path); @@ -775,12 +687,7 @@ public class CatalogWebService { /** * Remove an owner of the local sub tree - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The catalog entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The path could not be resolved to a valid catalog entry + * @ * @param path The path * @param identityKey The id of the user * @param httpRquest The HTTP request @@ -789,11 +696,9 @@ public class CatalogWebService { @DELETE @Path("{path:.*}/owners/{identityKey}") @Operation(summary = "Remove an owner of the local sub tree", description = "Remove an owner of the local sub tree") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The catalog entry"), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") - }) + @ApiResponse(responseCode = "200", description = "The catalog entry") + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The path could not be resolved to a valid catalog entry") public Response removeOwner(@PathParam("path") List<PathSegment> path, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { Long key = getCatalogEntryKeyFromPath(path); diff --git a/src/main/java/org/olat/restapi/repository/RepositoryEntriesWebService.java b/src/main/java/org/olat/restapi/repository/RepositoryEntriesWebService.java index 15ee9a429d7..ee8632e6341 100644 --- a/src/main/java/org/olat/restapi/repository/RepositoryEntriesWebService.java +++ b/src/main/java/org/olat/restapi/repository/RepositoryEntriesWebService.java @@ -84,11 +84,10 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.info.License; +import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.servers.Server; import io.swagger.v3.oas.annotations.tags.Tag; @@ -141,20 +140,15 @@ public class RepositoryEntriesWebService { @GET @Path("version") @Operation(summary = "The version number of this web service", description = "The version number of this web service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version number of this web service" )}) - + @ApiResponse(responseCode = "200", description = "The version number of this web service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); } /** - * List all entries in the OLAT repository - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType text/plain, text/html, application/xml, application/json - * @response.representation.200.doc List all entries in the repository - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVOes} + * List all entries in the repository + * * @param start (optional) * @param limit (optional) * @param managed (optional) @@ -167,15 +161,12 @@ public class RepositoryEntriesWebService { */ @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", - description = "JVM system properties of a particular host.", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) - } - )} - ) + @ApiResponse(responseCode = "200", + description = "List all entries in the repository.", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) + }) @Operation(summary = "List all entries in the repository", description = "List all entries in the OpenOLAT repository.") public Response getEntries(@QueryParam("start") @DefaultValue("0") Integer start, @@ -228,13 +219,7 @@ public class RepositoryEntriesWebService { /** * Search for repository entries, possible search attributes are name, author and type - * @response.representation.mediaType multipart/form-data - * @response.representation.doc Search for repository entries - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Search for repository entries - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param type Filter by the file resource type of the repository entry * @param author Filter by the author's username * @param name Filter by name of repository entry @@ -245,11 +230,10 @@ public class RepositoryEntriesWebService { @GET @Path("search") @Operation(summary = "Search for repository entries", description = "Search for repository entries, possible search attributes are name, author and type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Search for repository entries", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "Search for repository entries", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response searchEntries(@QueryParam("type") String type, @QueryParam("author") @DefaultValue("*") String author, @QueryParam("name") @DefaultValue("*") String name, @QueryParam("myentries") @DefaultValue("false") boolean myEntries, @@ -301,13 +285,7 @@ public class RepositoryEntriesWebService { /** * Import a resource in the repository - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The file, its name and the resourcename - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Import the resource and return the repository entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param filename The name of the imported file * @param file The file input stream * @param resourcename The name of the resource @@ -318,11 +296,10 @@ public class RepositoryEntriesWebService { */ @PUT @Operation(summary = "Import a resource in the repository", description = "Import a resource in the repository") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Import the resource and return the repository entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "Import the resource and return the repository entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.MULTIPART_FORM_DATA}) public Response putResource(@Context HttpServletRequest request) { diff --git a/src/main/java/org/olat/restapi/repository/RepositoryEntryLifecycleWebService.java b/src/main/java/org/olat/restapi/repository/RepositoryEntryLifecycleWebService.java index f4641d58036..2fb337c50c5 100644 --- a/src/main/java/org/olat/restapi/repository/RepositoryEntryLifecycleWebService.java +++ b/src/main/java/org/olat/restapi/repository/RepositoryEntryLifecycleWebService.java @@ -46,7 +46,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -65,20 +64,16 @@ public class RepositoryEntryLifecycleWebService { /** * List all public lifecycles - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType text/plain, text/html, application/xml, application/json - * @response.representation.200.doc List all entries in the repository - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVOes} + * * @param uriInfo The URI information * @param httpRequest The HTTP request * @return */ @GET @Operation(summary = "List all public lifecycles", description = "List all public lifecycles") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "List all entries in the repository", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) })}) + @ApiResponse(responseCode = "200", description = "List all entries in the repository", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) }) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getPublicLifeCycles(@Context HttpServletRequest httpRequest) { Roles roles = getRoles(httpRequest); diff --git a/src/main/java/org/olat/restapi/repository/RepositoryEntryWebService.java b/src/main/java/org/olat/restapi/repository/RepositoryEntryWebService.java index 174afb118b5..8bb144e89c1 100644 --- a/src/main/java/org/olat/restapi/repository/RepositoryEntryWebService.java +++ b/src/main/java/org/olat/restapi/repository/RepositoryEntryWebService.java @@ -116,7 +116,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * Description:<br> @@ -164,22 +163,17 @@ public class RepositoryEntryWebService { /** * get a resource in the repository - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Get the repository resource - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.404.doc The repository entry not found + * * @param repoEntryKey The key or soft key of the repository entry * @param request The REST request * @return */ @GET @Operation(summary = "get a resource in the repository", description = "get a resource in the repository") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Get the repository resource", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryVO.class)) }), - @ApiResponse(responseCode = "404", description = "The repository entry not found") }) + @ApiResponse(responseCode = "200", description = "Get the repository resource", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryVO.class)) }) + @ApiResponse(responseCode = "404", description = "The repository entry not found") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response getById(@Context Request request) { Date lastModified = entry.getLastModified(); @@ -204,14 +198,13 @@ public class RepositoryEntryWebService { /** * To get the web service for the lecture blocks of a specific learning resource. - * @response.representation.200.doc A web service to manage the lecture blocks + * * @param repoEntryKey The primary key of the learning resource * @return The web service for lecture blocks. */ @Path("lectureblocks") @Operation(summary = "Get the web service for the lecture blocks", description = "To get the web service for the lecture blocks of a specific learning resource") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A web service to manage the lecture blocks") }) + @ApiResponse(responseCode = "200", description = "A web service to manage the lecture blocks") public LectureBlocksWebService getLectureBlocksWebService(@Context HttpServletRequest request) throws WebApplicationException { boolean administrator = isLectureManager(request); @@ -227,8 +220,7 @@ public class RepositoryEntryWebService { */ @Path("reminders") @Operation(summary = "To get the web service for the reminders of a specific course", description = "To get the web service for the reminders of a specific course") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The web service for reminders") }) + @ApiResponse(responseCode = "200", description = "The web service for reminders") public RemindersWebService getRemindersWebService(@Context HttpServletRequest request) { boolean administrator = isAuthorEditor(request); RemindersWebService service = new RemindersWebService(entry, administrator); @@ -239,10 +231,9 @@ public class RepositoryEntryWebService { @GET @Path("curriculum/elements") @Operation(summary = "Get elements", description = "Get elements") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The elements", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))) }) }) + @ApiResponse(responseCode = "200", description = "The elements", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCurriculumElements() { List<CurriculumElement> curriculumElements = curriculumService.getCurriculumElements(entry); @@ -255,11 +246,7 @@ public class RepositoryEntryWebService { /** * Returns the list of owners of the repository entry specified by the groupKey. - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Owners of the repository entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.404.doc The repository entry cannot be found + * * @param repoEntryKey The key of the repository entry * @param request The HTTP Request * @return @@ -267,11 +254,10 @@ public class RepositoryEntryWebService { @GET @Path("owners") @Operation(summary = "Returns the list of owners", description = "Returns the list of owners of the repository entry specified by the groupKey") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Owners of the repository entry", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "Owners of the repository entry", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOwners(@Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -282,9 +268,7 @@ public class RepositoryEntryWebService { /** * Adds an owner to the repository entry. - * @response.representation.200.doc The user is added as owner of the repository entry - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry or the user cannot be found + * * @param repoEntryKey The key of the repository entry * @param identityKey The user's id * @param request The HTTP request @@ -293,10 +277,9 @@ public class RepositoryEntryWebService { @PUT @Path("owners/{identityKey}") @Operation(summary = "Adds an owner to the repository entry", description = "Adds an owner to the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is added as owner of the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The user is added as owner of the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") public Response addOwner(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -316,10 +299,9 @@ public class RepositoryEntryWebService { @PUT @Path("owners") @Operation(summary = "Add owners to the repository entry", description = "Add owners to the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The owners are added to the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The owners are added to the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addOwners(UserVO[] owners, @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -335,9 +317,7 @@ public class RepositoryEntryWebService { /** * Removes the owner from the repository entry. - * @response.representation.200.doc The user is removed as owner from the repository entry - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry or the user cannot be found + * * @param repoEntryKey The key of the repository entry * @param identityKey The user's id * @param request The HTTP request @@ -346,10 +326,9 @@ public class RepositoryEntryWebService { @DELETE @Path("owners/{identityKey}") @Operation(summary = "Removes the owner from the repository entry", description = "Removes the owner from the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is removed as owner from the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The user is removed as owner from the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") public Response removeOwner(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { try { if (!isAuthorEditor(request)) { @@ -372,11 +351,7 @@ public class RepositoryEntryWebService { /** * Returns the list of coaches of the repository entry. - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Coaches of the repository entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.404.doc The repository entry cannot be found + * * @param repoEntryKey The key of the repository entry * @param request The HTTP Request * @return @@ -384,11 +359,10 @@ public class RepositoryEntryWebService { @GET @Path("coaches") @Operation(summary = "Returns the list of coaches of the repository entry", description = "Returns the list of coaches of the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Coaches of the repository entry", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") }) + @ApiResponse(responseCode = "200", description = "Coaches of the repository entry", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCoaches(@Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -399,9 +373,7 @@ public class RepositoryEntryWebService { /** * Adds a coach to the repository entry. - * @response.representation.200.doc The user is added as coach of the repository entry - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry or the user cannot be found + * * @param repoEntryKey The key of the repository entry * @param identityKey The user's id * @param request The HTTP request @@ -410,9 +382,8 @@ public class RepositoryEntryWebService { @PUT @Path("coaches/{identityKey}") @Operation(summary = "Adds a coach to the repository entry", description = "Adds a coach to the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is added as coach of the repository entry"), - @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") }) + @ApiResponse(responseCode = "200", description = "The user is added as coach of the repository entry") + @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") public Response addCoach(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -433,9 +404,8 @@ public class RepositoryEntryWebService { @PUT @Path("coaches") @Operation(summary = "Adds coaches to the repository entry", description = "Adds coaches to the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The coaches are added to the repository entry"), - @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") }) + @ApiResponse(responseCode = "200", description = "The coaches are added to the repository entry") + @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addCoach(UserVO[] coaches, @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -451,9 +421,7 @@ public class RepositoryEntryWebService { /** * Removes the coach from the repository entry. - * @response.representation.200.doc The user is removed as coach from the repository entry - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry or the user cannot be found + * * @param repoEntryKey The key of the repository entry * @param identityKey The user's id * @param request The HTTP request @@ -462,10 +430,9 @@ public class RepositoryEntryWebService { @DELETE @Path("coaches/{identityKey}") @Operation(summary = "Removes the coach from the repository entry", description = "Removes the coach from the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is removed as owner from the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The user is removed as owner from the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") public Response removeCoach(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { if (!isAuthorEditor(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -483,11 +450,7 @@ public class RepositoryEntryWebService { /** * Returns the list of participants of the repository entry. - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Coaches of the repository entry - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.404.doc The repository entry cannot be found + * * @param repoEntryKey The key of the repository entry * @param request The HTTP Request * @return @@ -495,11 +458,10 @@ public class RepositoryEntryWebService { @GET @Path("participants") @Operation(summary = "Returns the list of participants of the repository entry", description = "Returns the list of participants of the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Participants of the repository entry", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") }) + @ApiResponse(responseCode = "200", description = "Participants of the repository entry", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getParticipants( @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -510,9 +472,7 @@ public class RepositoryEntryWebService { /** * Adds a participant to the repository entry. - * @response.representation.200.doc The user is added as participant of the repository entry - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry or the user cannot be found + * * @param repoEntryKey The key of the repository entry * @param identityKey The user's id * @param request The HTTP request @@ -521,10 +481,9 @@ public class RepositoryEntryWebService { @PUT @Path("participants/{identityKey}") @Operation(summary = "Adds a participant to the repository entry", description = "Adds a participant to the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is added as participant of the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The user is added as participant of the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") public Response addParticipant(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -544,10 +503,9 @@ public class RepositoryEntryWebService { @PUT @Path("participants") @Operation(summary = "Adds participants to the repository entry", description = "Adds participants to the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The participants are added to the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The participants are added to the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addParticipants(UserVO[] participants, @Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -571,9 +529,7 @@ public class RepositoryEntryWebService { /** * Removes the participant from the repository entry. - * @response.representation.200.doc The user is removed as participant from the repository entry - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry or the user cannot be found + * * @param repoEntryKey The key of the repository entry * @param identityKey The user's id * @param request The HTTP request @@ -582,10 +538,9 @@ public class RepositoryEntryWebService { @DELETE @Path("participants/{identityKey}") @Operation(summary = "Removes the participant from the repository entry", description = "Removes the participant from the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is removed as participant from the repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") }) + @ApiResponse(responseCode = "200", description = "The user is removed as participant from the repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry or the user cannot be found") public Response removeParticipant(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { if (!isAuthorEditor(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -603,15 +558,7 @@ public class RepositoryEntryWebService { /** * Download the export zip file of a repository entry. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc Download the resource file - * @response.representation.200.mediaType application/zip - * @response.representation.200.doc Download the repository entry as export zip file - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The resource could not found - * @response.representation.406.doc Download of this resource is not possible - * @response.representation.409.doc The resource is locked + * * @param repoEntryKey * @param request The HTTP request * @return @@ -619,12 +566,11 @@ public class RepositoryEntryWebService { @GET @Path("file") @Operation(summary = "Download the export zip file of a repository entry", description = "Download the export zip file of a repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Download the repository entry as export zip file"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The repository entry cannot be found"), - @ApiResponse(responseCode = "406", description = "Download of this resource is not possible"), - @ApiResponse(responseCode = "409", description = "The resource is locked")}) + @ApiResponse(responseCode = "200", description = "Download the repository entry as export zip file") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The repository entry cannot be found") + @ApiResponse(responseCode = "406", description = "Download of this resource is not possible") + @ApiResponse(responseCode = "409", description = "The resource is locked") @Produces({ "application/zip", MediaType.APPLICATION_OCTET_STREAM }) public Response getRepoFileById(@Context HttpServletRequest request, @Context HttpServletResponse response) { RepositoryHandler typeToDownload = repositoryHandlerFactory.getRepositoryHandler(entry); @@ -725,13 +671,7 @@ public class RepositoryEntryWebService { /** * Replace a resource in the repository and update its display name. The implementation is * limited to CP. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc Import the resource file - * @response.representation.200.qname {http://www.example.com}repositoryEntryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Replace the resource and return the updated repository entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOENTRYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param repoEntryKey The key or soft key of the repository entry * @param filename The name of the file * @param file The file input stream @@ -742,9 +682,8 @@ public class RepositoryEntryWebService { @POST @Operation(summary = "Replace a resource in the repository", description = "Replace a resource in the repository and update its display name. The implementation is\n" + " limited to CP") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Replace the resource and return the updated repository entry"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "Replace the resource and return the updated repository entry") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.MULTIPART_FORM_DATA }) public Response replaceResource(@Context HttpServletRequest request) { @@ -815,20 +754,17 @@ public class RepositoryEntryWebService { } frm.unzipFileResource(re.getOlatResource()); } - log.info(Tracing.M_AUDIT, "Resource: " + re.getOlatResource() + " replaced by " + identity.getKey()); + log.info(Tracing.M_AUDIT, "Resource: {} replaced by {}", re.getOlatResource(), identity.getKey()); return re; } - log.debug("Cannot replace a resource of the type: " + typeName); + log.debug("Cannot replace a resource of the type: {}", typeName); return null; } /** * Delete a resource by id * - * @response.representation.200.doc The metadatas of the deleted resource - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param courseId The course resourceable's id * @param request The HTTP request * @return It returns the XML representation of the <code>Structure</code> @@ -836,10 +772,9 @@ public class RepositoryEntryWebService { */ @DELETE @Operation(summary = "Delete a resource by id", description = "Delete a resource by id") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The metadatas of the deleted resource"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")}) + @ApiResponse(responseCode = "200", description = "The metadatas of the deleted resource") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response deleteCourse(@Context HttpServletRequest request) { if(!isAuthor(request)) { @@ -869,9 +804,6 @@ public class RepositoryEntryWebService { * <li>restored</li> * </ul> * - * @response.representation.200.doc The metadatas of the deleted course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param request The HTTP request * @return It returns the XML representation of the <code>Structure</code> * object representing the course. @@ -885,10 +817,9 @@ public class RepositoryEntryWebService { " * <li>deleted</li>\n" + " * <li>restored</li>\n" + " * </ul>") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The metadatas of the deleted resource"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")}) + @ApiResponse(responseCode = "200", description = "The metadatas of the deleted resource") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Path("status") public Response postStatus(@FormParam("newStatus") String newStatus, @Context HttpServletRequest request) { @@ -898,23 +829,23 @@ public class RepositoryEntryWebService { if("closed".equals(newStatus)) { repositoryService.closeRepositoryEntry(entry, null, false); - log.info(Tracing.M_AUDIT, "REST closing course: " + entry.getDisplayname() + " [" + entry.getKey() + "]"); + log.info(Tracing.M_AUDIT, "REST closing course: {} [{}]", entry.getDisplayname(), entry.getKey()); ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_CLOSE, getClass(), LoggingResourceable.wrap(entry, OlatResourceableType.genRepoEntry)); } else if("unclosed".equals(newStatus)) { repositoryService.uncloseRepositoryEntry(entry); - log.info(Tracing.M_AUDIT, "REST unclosing course: " + entry.getDisplayname() + " [" + entry.getKey() + "]"); + log.info(Tracing.M_AUDIT, "REST unclosing course: {} [{}]", entry.getDisplayname(), entry.getKey()); ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_UPDATE, getClass(), LoggingResourceable.wrap(entry, OlatResourceableType.genRepoEntry)); } else if("deleted".equals(newStatus)) { Identity identity = getIdentity(request); repositoryService.deleteSoftly(entry, identity, true, false); - log.info(Tracing.M_AUDIT, "REST deleting (soft) course: " + entry.getDisplayname() + " [" + entry.getKey() + "]"); + log.info(Tracing.M_AUDIT, "REST deleting (soft) course: {} [{}]", entry.getDisplayname(), entry.getKey()); ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_TRASH, getClass(), LoggingResourceable.wrap(entry, OlatResourceableType.genRepoEntry)); } else if("restored".equals(newStatus)) { repositoryService.restoreRepositoryEntry(entry); - log.info(Tracing.M_AUDIT, "REST restoring course: " + entry.getDisplayname() + " [" + entry.getKey() + "]"); + log.info(Tracing.M_AUDIT, "REST restoring course: {} [{}]", entry.getDisplayname(), entry.getKey()); ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_RESTORE, getClass(), LoggingResourceable.wrap(entry, OlatResourceableType.genRepoEntry)); } @@ -924,23 +855,16 @@ public class RepositoryEntryWebService { /** * Get the access configuration of the repository entry. * - * @response.representation.200.qname {http://www.example.com}repositoryEntryAccessVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The access configuration of the repository entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOACCESS} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry not found * @return It returns the <code>RepositoryEntryAccessVO</code> object representing the access configuration of the repository entry. */ @GET @Path("access") @Operation(summary = "Get the access configuration of the repository entry", description = "Get the access configuration of the repository entry") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The access configuration of the repository entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryAccessVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryAccessVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")}) + @ApiResponse(responseCode = "200", description = "The access configuration of the repository entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryAccessVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryAccessVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getAccess(@Context HttpServletRequest request) { if(!isAuthor(request) && !isAuthorEditor(request)) { @@ -955,13 +879,6 @@ public class RepositoryEntryWebService { * a low level method which only change the status without the stuff * done by the change status methods. Use it only if you know what you do. * - * @response.representation.200.qname {http://www.example.com}repositoryEntryAccessVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The access configuration of the repository entry - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOACCESS} - * @response.representation.400.doc The acces object doesn't match the url used to change it - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The repository entry not found * @return It returns the <code>RepositoryEntryAccessVO</code> object representing the access configuration of the repository entry. */ @POST @@ -969,12 +886,11 @@ public class RepositoryEntryWebService { @Operation(summary = "Update the access configuration of the repository entry", description = "Update the access configuration of the repository entry. Attention! It's\n" + " a low level method which only change the status without the stuff\n" + " done by the change status methods. Use it only if you know what you do") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The access configuration of the repository entry", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryAccessVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryAccessVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found")}) + @ApiResponse(responseCode = "200", description = "The access configuration of the repository entry", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryEntryAccessVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryEntryAccessVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateAccess(RepositoryEntryAccessVO accessVo, @Context HttpServletRequest request) { @@ -995,12 +911,11 @@ public class RepositoryEntryWebService { @GET @Path("organisations") @Operation(summary = "Get organisations", description = "Get organisations") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of organisations", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")}) + @ApiResponse(responseCode = "200", description = "The list of organisations", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response getOrganisations(@Context HttpServletRequest httpRequest) { if (!isAuthorEditor(httpRequest)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -1017,10 +932,9 @@ public class RepositoryEntryWebService { @PUT @Path("organisations/{organisationKey}") @Operation(summary = "Put organisation", description = "Put organisation") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Organisation was put"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")}) + @ApiResponse(responseCode = "200", description = "Organisation was put") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response addOrganisation(@PathParam("organisationKey") Long organisationKey, @Context HttpServletRequest httpRequest) { Organisation organisationToAdd = organisationService.getOrganisation(new OrganisationRefImpl(organisationKey)); if (!isAuthorEditor(httpRequest) && !isManager(organisationToAdd, httpRequest)) { @@ -1043,10 +957,9 @@ public class RepositoryEntryWebService { @DELETE @Path("organisations/{organisationKey}") @Operation(summary = "Remove organisation", description = "Remove organisation") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Organisation was deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")}) + @ApiResponse(responseCode = "200", description = "Organisation was deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response removeOrganisation(@PathParam("organisationKey") Long organisationKey, @Context HttpServletRequest httpRequest) { Organisation organisationToRemove = organisationService.getOrganisation(new OrganisationRefImpl(organisationKey)); if (!isAuthorEditor(httpRequest) && !isManager(organisationToRemove, httpRequest)) { @@ -1061,12 +974,11 @@ public class RepositoryEntryWebService { @GET @Path("taxonomy/levels") @Operation(summary = "Get levels", description = "Get levels") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of levels", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")}) + @ApiResponse(responseCode = "200", description = "The list of levels", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = TaxonomyLevelVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTaxonomyLevels(@Context HttpServletRequest request) { if(!isAuthorEditor(request)) { @@ -1084,10 +996,9 @@ public class RepositoryEntryWebService { @PUT @Path("taxonomy/levels/{taxonomyLevelKey}") @Operation(summary = "Get level", description = "Get level") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The level put"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")}) + @ApiResponse(responseCode = "200", description = "The level put") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response putTaxonomyLevel(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { List<TaxonomyLevel> levels = repositoryEntryToTaxonomyLevelDao.getTaxonomyLevels(entry); for(TaxonomyLevel level:levels) { @@ -1106,10 +1017,9 @@ public class RepositoryEntryWebService { @DELETE @Path("taxonomy/levels/{taxonomyLevelKey}") @Operation(summary = "Remove level", description = "Remove level") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The level was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Not found")}) + @ApiResponse(responseCode = "200", description = "The level was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Not found") public Response deleteTaxonomyLevel(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey) { TaxonomyLevel level = taxonomyService.getTaxonomyLevel(new TaxonomyLevelRefImpl(taxonomyLevelKey)); if(level == null) { diff --git a/src/main/java/org/olat/restapi/repository/SharedFolderWebService.java b/src/main/java/org/olat/restapi/repository/SharedFolderWebService.java index cef12540e9c..16c0d9453a8 100644 --- a/src/main/java/org/olat/restapi/repository/SharedFolderWebService.java +++ b/src/main/java/org/olat/restapi/repository/SharedFolderWebService.java @@ -61,7 +61,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -88,16 +87,13 @@ public class SharedFolderWebService { /** * Retrieves the version of the Catalog Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "Retrieves the version of the Catalog Web Service", description = "Retrieves the version of the Catalog Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Return the version number") }) + @ApiResponse(responseCode = "200", description = "Return the version number") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -105,9 +101,7 @@ public class SharedFolderWebService { /** * This retrieves the files in the shared folder - * @response.representation.200.doc The list of files - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The shared folder is not found + * * @param repoEntryKey The course resourceable's id * @param uri The uri infos * @param httpRequest The HTTP request @@ -117,12 +111,11 @@ public class SharedFolderWebService { @GET @Path("{repoEntryKey}") @Operation(summary = "This retrieves the files in the shared folder", description = "This retrieves the files in the shared folder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The shared folder is not found")}) + @ApiResponse(responseCode = "200", description = "The files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The shared folder is not found") public Response getSharedFiles(@PathParam("repoEntryKey") Long repoEntryKey, @Context UriInfo uriInfo, @Context HttpServletRequest httpRequest, @Context Request request) { return getFiles(repoEntryKey, Collections.<PathSegment>emptyList(), uriInfo, httpRequest, request); @@ -132,9 +125,6 @@ public class SharedFolderWebService { * This retrieves the files in the shared folder and give full access to * the folder, read, write, delete. * - * @response.representation.200.doc The list of files - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the file not found * @param repoEntryKey The course resourceable's id * @param httpRequest The HTTP request * @return @@ -142,12 +132,11 @@ public class SharedFolderWebService { @Path("{repoEntryKey}/files") @Operation(summary = "This retrieves the files in the shared folder", description = "This retrieves the files in the shared folder and give full access to\n" + " the folder, read, write, delete.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The shared folder is not found")}) + @ApiResponse(responseCode = "200", description = "The files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The shared folder is not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML, MediaType.APPLICATION_OCTET_STREAM}) public VFSWebservice getVFSWebservice(@PathParam("repoEntryKey") Long repoEntryKey, @Context HttpServletRequest httpRequest) { RepositoryEntry re = repositoryManager.lookupRepositoryEntry(repoEntryKey); diff --git a/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java index f65ff783b25..20f104d8049 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java @@ -93,7 +93,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -128,18 +127,13 @@ public class CourseAssessmentWebService { /** * Retireves the version of the Course Assessment Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "Retireves the version of the Course Assessment Web Service", description = "Retireves the version of the Course Assessment Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service" - )} -) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -147,12 +141,7 @@ public class CourseAssessmentWebService { /** * Returns the results of the course. - * @response.representation.200.qname {http://www.example.com}assessableResultsVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Array of results for the whole the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ASSESSABLERESULTSVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param courseId The course resourceable's id * @param httpRequest The HTTP request * @param request The REST request @@ -160,12 +149,11 @@ public class CourseAssessmentWebService { */ @GET @Operation(summary = "Returns the results of the course", description = "Returns the results of the course") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Array of results for the whole the course", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = AssessableResultsVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = AssessableResultsVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "Array of results for the whole the course", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = AssessableResultsVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = AssessableResultsVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseResults(@PathParam("courseId") Long courseId, @Context HttpServletRequest httpRequest, @Context Request request) { ICourse course = CoursesWebService.loadCourse(courseId); @@ -201,27 +189,21 @@ public class CourseAssessmentWebService { /** * Returns the results of the course. - * @response.representation.200.qname {http://www.example.com}assessableResultsVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The result of the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ASSESSABLERESULTSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the course not found + * * @param courseId The course resourceable's id * @param identityKey The id of the user * @param httpRequest The HTTP request * @param request The REST request * @return */ - @GET @Path("users/{identityKey}") @Operation(summary = "Returns the results of the course", description = "Returns the results of the course") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The result of the course", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The result of the course", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseResultsOf(@PathParam("courseId") Long courseId, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest, @Context Request request) { ICourse course = CoursesWebService.loadCourse(courseId); @@ -254,12 +236,7 @@ public class CourseAssessmentWebService { /** * Exports results for an assessable course node for all students. - * @response.representation.200.qname {http://www.example.com}assessableResultsVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Export all results of all user of the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ASSESSABLERESULTSVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param courseId The course resourceable's id * @param nodeId The id of the course building block * @param httpRequest The HTTP request @@ -269,11 +246,11 @@ public class CourseAssessmentWebService { @GET @Path("{nodeId}") @Operation(summary = "Export results", description = "Exports results for an assessable course node for all students") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "Export all results of all user of the course", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "Export all results of all user of the course", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response getAssessableResults(@PathParam("courseId") Long courseId, @PathParam("nodeId") Long nodeId, @Context HttpServletRequest httpRequest, @Context Request request) { @@ -310,13 +287,7 @@ public class CourseAssessmentWebService { /** * Imports results for an assessable course node for the authenticated student. - * @response.representation.qname {http://www.example.com}assessableResultsVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc A result to import - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ASSESSABLERESULTSVO} - * @response.representation.200.doc Import successful - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param courseId The resourceable id of the course * @param nodeId The id of the course building block * @param resultsVO The results @@ -326,11 +297,11 @@ public class CourseAssessmentWebService { @POST @Path("{nodeId}") @Operation(summary = "Import results", description = "Imports results for an assessable course node for the authenticated student") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "A result to import", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "A result to import", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Consumes( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response postAssessableResults(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, AssessableResultsVO resultsVO, @Context HttpServletRequest request) { @@ -489,12 +460,7 @@ public class CourseAssessmentWebService { /** * Returns the results of a student at a specific assessable node - * @response.representation.200.qname {http://www.example.com}assessableResultsVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The result of a user at a specific node - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ASSESSABLERESULTSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the course not found + * * @param courseId The course resourceable's id * @param nodeId The ident of the course building block * @param identityKey The id of the user @@ -505,11 +471,11 @@ public class CourseAssessmentWebService { @GET @Path("{nodeId}/users/{identityKey}") @Operation(summary = "Return results", description = "Returns the results of a student at a specific assessable node") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The result of a user at a specific node", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The result of a user at a specific node", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = AssessableResultsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = AssessableResultsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseNodeResultsForNode(@PathParam("courseId") Long courseId, @PathParam("nodeId") Long nodeId, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest, @Context Request request) { diff --git a/src/main/java/org/olat/restapi/repository/course/CourseElementWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseElementWebService.java index 61b7d959874..881e255d5a1 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseElementWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseElementWebService.java @@ -86,7 +86,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; @@ -106,18 +105,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * The version of the Course Elements Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "The version of the Course Elements Web Service", description = "The version of the Course Elements Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service" - )} -) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -126,12 +120,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Retrieves metadata of the course node - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id * @param request The HTTP request @@ -140,11 +129,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @GET @Path("{nodeId}") @Operation(summary = "Retrieves metadata of the course node", description = "Retrieves metadata of the course node") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseNode(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest request) { @@ -167,14 +156,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This updates a Structure Element onto a given course. - * @response.representation.mediaType application/x-www-form-urlencoded, multipart/form-data - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id of this structure * @param shortTitle The node short title @@ -192,11 +174,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("structure/{nodeId}") @Operation(summary = "Update structure element", description = "This updates a Structure Element onto a given course") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.MULTIPART_FORM_DATA}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateStructure(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -230,14 +212,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Structure Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this * structure @@ -254,11 +229,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("structure") @Operation(summary = "Attach structure element to course", description = "This attaches a Structure Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachStructurePostMultiparts(@PathParam("courseId") Long courseId, @@ -294,14 +269,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Structure Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this * structure @@ -318,11 +286,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("structure") @Operation(summary = "Attach structure element to course", description = "This attaches a Structure Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachStructure(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -331,21 +299,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @QueryParam("visibilityExpertRules") String visibilityExpertRules, @QueryParam("accessExpertRules") String accessExpertRules, @QueryParam("displayType") @DefaultValue(STCourseNodeEditController.CONFIG_VALUE_DISPLAY_TOC) String displayType, @Context HttpServletRequest request) { - //fxdiff FXOLAT-122: course management CustomConfigDelegate config = new StructureFullConfig(displayType, null, null); return attach(courseId, parentNodeId, "st", position, shortTitle, longTitle, objectives, visibilityExpertRules, accessExpertRules, config, request); } /** * This updates a Single Page Element onto a given course. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The content of the single page - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc the course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id of this single page * @param position The node's position relative to its sibling nodes (optional) @@ -362,11 +322,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("singlepage/{nodeId}") @Operation(summary = "Update a Single Page Element on course", description = "This updates a Single Page Element onto a given course") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateSinglePage(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -397,14 +357,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Single Page Element onto a given course. The element will * be inserted underneath the supplied parentNodeId. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The content of the single page - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this single * page @@ -423,11 +376,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("singlepage") @Operation(summary = "Attach a Single Page Element on course", description = "This attaches a Single Page Element onto a given course. The element will\n" + " be inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSinglePagePost(@PathParam("courseId") Long courseId, @Context HttpServletRequest request) { @@ -437,14 +390,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Single Page Element onto a given course. The element will * be inserted underneath the supplied parentNodeId. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The content of the single page - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc the course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this single * page @@ -463,11 +409,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("singlepage") @Operation(summary = "Attach a Single Page Element on course", description = "This attaches a Single Page Element onto a given course. The element will\n" + " be inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSinglePage(@PathParam("courseId") Long courseId, @Context HttpServletRequest request) { @@ -499,14 +445,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { * This attaches a Single Page Element onto a given course. The element will * be inserted underneath the supplied parentNodeId. The page is found in the * resource folder of the course. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The content of the single page - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc the course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this single * page @@ -525,11 +464,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("singlepage") @Operation(summary = "Attach a Single Page Element on course", description = "This attaches a Single Page Element onto a given course. The element will\n" + " be inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSinglePagePost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -544,14 +483,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { * This attaches a Single Page Element onto a given course. The element will * be inserted underneath the supplied parentNodeId. The page is found in the * resource folder of the course. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The content of the single page - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc the course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this single * page @@ -571,11 +503,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Operation(summary = "Attach a Single Page Element on course", description = "This attaches a Single Page Element onto a given course. The element will\n" + " be inserted underneath the supplied parentNodeId. The page is found in the\n" + " resource folder of the course.") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The content of the single page", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The content of the single page", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSinglePage(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -589,14 +521,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This updates a Task Element onto a given course. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param nodeId The node's id of this task * @param shortTitle The node short title @@ -612,14 +537,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("task/{nodeId}") @Operation(summary = "Update a Task Element onto a given course", description = "This updates a Task Element onto a given course") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - //fxdiff FXOLAT-122: course management public Response updateTask(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @FormParam("shortTitle") @DefaultValue("undefined") String shortTitle, @FormParam("longTitle") @DefaultValue("undefined") String longTitle, @FormParam("objectives") @DefaultValue("undefined") String objectives, @@ -633,14 +557,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Task Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this task * @param position The node's position relative to its sibling nodes (optional) @@ -658,11 +575,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("task") @Operation(summary = "Attach Task Element on course", description = "This attaches a Task Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId.") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachTaskPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -677,14 +594,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Task Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this task * @param position The node's position relative to its sibling nodes (optional) @@ -702,11 +612,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("task") @Operation(summary = "Attach Task Element on course", description = "This attaches a Task Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId.") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachTask(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -721,14 +631,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This updates a Test Element onto a given course. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The test node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course, parentNode or test not found + * * @param courseId The course resourceable id * @param nodeId The node's id of this test * @param testResourceableId The test node's id which is retorned in the @@ -746,14 +649,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("test/{nodeId}") @Operation(summary = "Update a Test Element onto a given course", description = "This updates a Test Element onto a given course") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The test node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - //fxdiff FXOLAT-122: course management public Response updateTest(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @FormParam("shortTitle") @DefaultValue("undefined") String shortTitle, @FormParam("longTitle") @DefaultValue("undefined") String longTitle, @FormParam("objectives") @DefaultValue("undefined") String objectives, @@ -771,14 +673,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Test Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The test node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course, parentNode or test not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this test * @param testResourceableId The test node's id which is retorned in the @@ -796,11 +691,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("test") @Operation(summary = "Update a Test Element onto a given course", description = "This attaches a Test Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The test node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "course, parentNode or test not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "course, parentNode or test not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachTestPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -814,14 +709,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Test Element onto a given course. The element will be * inserted underneath the supplied parentNodeId. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc the course node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc the test node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc course, parentNode or test not found + * * @param courseId The course resourceable id * @param parentNodeId The node's id which will be the parent of this test * @param testResourceableId The test node's id which is retorned in the @@ -839,11 +727,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Path("test") @Operation(summary = "Update a Test Element onto a given course", description = "This attaches a Test Element onto a given course. The element will be\n" + " inserted underneath the supplied parentNodeId") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The test node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "course, parentNode or test not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "course, parentNode or test not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachTest(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -863,14 +751,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Updates an assessment building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id of this assessment * @param shortTitle The node short title @@ -884,14 +765,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("assessment/{nodeId}") @Operation(summary = "Update an assessment building block", description = "Updates an assessment building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - //fxdiff FXOLAT-122: course management public Response updateAssessment(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @FormParam("shortTitle") @DefaultValue("undefined") String shortTitle, @FormParam("longTitle") @DefaultValue("undefined") String longTitle, @FormParam("objectives") @DefaultValue("undefined") String objectives, @@ -903,14 +783,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an assessment building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -925,11 +798,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("assessment") @Operation(summary = "Attaches an assessment building block", description = "Attaches an assessment building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The assessment node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The assessment node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachAssessmentPost(@PathParam("courseId") Long courseId, @FormParam("parentNodeId") String parentNodeId, @@ -942,14 +815,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an assessment building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -964,11 +830,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("assessment") @Operation(summary = "Attaches an assessment building block", description = "Attaches an assessment building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachAssessment(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -982,14 +848,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an wiki building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id which of this wiki * @param shortTitle The node short title @@ -1004,14 +863,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("wiki/{nodeId}") @Operation(summary = "Attaches an wiki building block", description = "Attaches an wiki building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - //fxdiff FXOLAT-122: course management public Response updateWiki(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @FormParam("shortTitle") @DefaultValue("undefined") String shortTitle, @FormParam("longTitle") @DefaultValue("undefined") String longTitle, @FormParam("objectives") @DefaultValue("undefined") String objectives, @@ -1031,14 +889,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an wiki building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1053,11 +904,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("wiki") @Operation(summary = "Attaches an wiki building block", description = "Attaches an wiki building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachWikiPost(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1070,14 +921,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an wiki building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1092,11 +936,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("wiki") @Operation(summary = "Attaches an wiki building block", description = "Attaches an wiki building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachWiki(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1115,14 +959,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Update an blog building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id of this blog * @param shortTitle The node short title @@ -1137,14 +974,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("blog/{nodeId}") @Operation(summary = "Update an blog building block", description = "Update an blog building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - //fxdiff FXOLAT-122: course management public Response updateBlog(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @FormParam("shortTitle") @DefaultValue("undefined") String shortTitle, @FormParam("longTitle") @DefaultValue("undefined") String longTitle, @FormParam("objectives") @DefaultValue("undefined") String objectives, @@ -1164,14 +1000,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an blog building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1187,11 +1016,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("blog") @Operation(summary = "Attaches an blog building block", description = "Attaches an blog building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachBlogPost(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1204,14 +1033,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an blog building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1227,11 +1049,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("blog") @Operation(summary = "Attaches an blog building block", description = "Attaches an blog building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachBlog(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1251,14 +1073,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an survey building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1273,11 +1088,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("survey/{nodeId}") @Operation(summary = "Attaches an survey building block", description = "Attaches an survey building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSurveyPost(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1297,14 +1112,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an survey building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1319,11 +1127,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("survey") @Operation(summary = "Attaches an survey building block", description = "Attaches an survey building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSurveyPost(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1336,14 +1144,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an survey building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The assessment node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1358,11 +1159,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("survey") @Operation(summary = "Attaches an survey building block", description = "Attaches an survey building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachSurvey(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1382,14 +1183,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Update an external page building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The external page node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param nodeId The node's id of this external page * @param shortTitle The node short title @@ -1404,14 +1198,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("externalpage/{nodeId}") @Operation(summary = "Update an external page building block", description = "Update an external page building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - //fxdiff FXOLAT-122: course management public Response updateExternalPage(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @FormParam("shortTitle") @DefaultValue("undefined") String shortTitle, @FormParam("longTitle") @DefaultValue("undefined") String longTitle, @FormParam("objectives") @DefaultValue("undefined") String objectives, @@ -1431,14 +1224,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an external page building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The external page node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1454,11 +1240,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("externalpage") @Operation(summary = "Update an external page building block", description = "Update an external page building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachExternalPagePost(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1471,15 +1257,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Attaches an external page building block. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The external page node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found - * @response.representation.409.doc The given URL is not valid + * * @param courseId The course resourceable's id * @param parentNodeId The node's id which will be the parent of this assessment * @param position The node's position relative to its sibling nodes (optional) @@ -1495,11 +1273,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("externalpage") @Operation(summary = "Attaches an external page building block", description = "Attaches an external page building block") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The course node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachExternalPage(@PathParam("courseId") Long courseId, @QueryParam("parentNodeId") String parentNodeId, @@ -1520,14 +1298,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Task file onto a given task element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found + * * @param courseId The course resourceable id * @param nodeId The node's id which will be the parent of this task file * @param request The HTTP request @@ -1536,11 +1307,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("task/{nodeId}/file") @Operation(summary = "This attaches a Task file onto a given task element", description = "This attaches a Task file onto a given task element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The task node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The task node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachTaskFilePost(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1550,15 +1321,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches a Task file onto a given task element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node metadatas - * @response.representation.200.qname {http://www.example.com}courseNodeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node metadatas - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or parentNode not found - * @response.representation.406.doc The course node is not of type task + * * @param courseId The course resourceable id * @param nodeId The node's id which will be the parent of this task file * @param request The HTTP request @@ -1567,11 +1330,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("task/{nodeId}/file") @Operation(summary = "This attaches a Task file onto a given task element", description = "This attaches a Task file onto a given task element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The task node metadatas", content = { + @ApiResponse(responseCode = "200", description = "The task node metadatas", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseNodeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or parentNode not found") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseNodeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or parentNode not found") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response attachTaskFile(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1623,16 +1386,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches the run-time configuration onto a given task element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node configuration - * @response.representation.200.qname {http://www.example.com}surveyConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The task node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or task node not found - * @response.representation.406.doc The call is not applicable to task course node - * @response.representation.409.doc The configuration is not valid + * * @param courseId * @param nodeId * @param enableAssignment @@ -1666,13 +1420,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("task/{nodeId}/configuration") @Operation(summary = "This attaches the run-time configuration", description = "This attaches the run-time configuration onto a given task element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The task node configuration", content = { + @ApiResponse(responseCode = "200", description = "The task node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found"), - @ApiResponse(responseCode = "406", description = "The call is not applicable to task course node"), - @ApiResponse(responseCode = "409", description = "The configuration is not valid ") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") + @ApiResponse(responseCode = "406", description = "The call is not applicable to task course node") + @ApiResponse(responseCode = "409", description = "The configuration is not valid ") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addTaskConfigurationPost(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1712,16 +1466,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches the run-time configuration onto a given task element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The task node configuration - * @response.representation.200.qname {http://www.example.com}surveyConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The task node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or task node not found - * @response.representation.406.doc The call is not applicable to task course node - * @response.representation.409.doc The configuration is not valid + * * @param courseId * @param nodeId * @param enableAssignment @@ -1755,13 +1500,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("task/{nodeId}/configuration") @Operation(summary = "This attaches the run-time configuration", description = "This attaches the run-time configuration onto a given task element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The task node configuration", content = { + @ApiResponse(responseCode = "200", description = "The task node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found"), - @ApiResponse(responseCode = "406", description = "The call is not applicable to task course node"), - @ApiResponse(responseCode = "409", description = "The configuration is not valid ") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") + @ApiResponse(responseCode = "406", description = "The call is not applicable to task course node") + @ApiResponse(responseCode = "409", description = "The configuration is not valid ") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addTaskConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1803,12 +1548,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Retrieves configuration of the task course node - * @response.representation.200.qname {http://www.example.com}surveyConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or task node not found + * * @param courseId * @param nodeId * @return the task course node configuration @@ -1816,11 +1556,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @GET @Path("task/{nodeId}/configuration") @Operation(summary = "Retrieve configuration", description = "Retrieves configuration of the task course node") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node configuration", content = { + @ApiResponse(responseCode = "200", description = "The course node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTaskConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) { @@ -1898,16 +1638,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches the run-time configuration onto a given survey element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The test node configuration - * @response.representation.200.qname {http://www.example.com}surveyConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The survey node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or survey node not found - * @response.representation.406.doc The call is not applicable to survey course node - * @response.representation.409.doc The configuration is not valid + * * @param courseId * @param nodeId * @param allowCancel @@ -1923,13 +1654,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("survey/{nodeId}/configuration") @Operation(summary = "Attach the run-time configuration", description = "This attaches the run-time configuration onto a given survey element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node configuration", content = { + @ApiResponse(responseCode = "200", description = "The test node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found"), - @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node"), - @ApiResponse(responseCode = "409", description = "The configuration is not valid")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") + @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node") + @ApiResponse(responseCode = "409", description = "The configuration is not valid") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addSurveyConfigurationPost(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1947,16 +1678,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches the run-time configuration onto a given survey element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The test node configuration - * @response.representation.200.qname {http://www.example.com}surveyConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The survey node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or survey node not found - * @response.representation.406.doc The call is not applicable to survey course node - * @response.representation.409.doc The configuration is not valid + * * @param courseId * @param nodeId * @param allowCancel @@ -1972,13 +1694,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("survey/{nodeId}/configuration") @Operation(summary = "Attach the run-time configuration", description = "This attaches the run-time configuration onto a given survey element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node configuration", content = { + @ApiResponse(responseCode = "200", description = "The test node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found"), - @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node"), - @ApiResponse(responseCode = "409", description = "The configuration is not valid")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") + @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node") + @ApiResponse(responseCode = "409", description = "The configuration is not valid") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addSurveyConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -1999,12 +1721,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Retrieves configuration of the survey course node - * @response.representation.200.qname {http://www.example.com}surveyConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or survey node not found + * * @param courseId * @param nodeId * @return survey course node configuration @@ -2012,11 +1729,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @GET @Path("survey/{nodeId}/configuration") @Operation(summary = "Retrieve configuration", description = "Retrieves configuration of the survey course node") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node configuration", content = { + @ApiResponse(responseCode = "200", description = "The course node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getSurveyConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) { @@ -2051,16 +1768,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches the run-time configuration onto a given test element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The test node configuration - * @response.representation.200.qname {http://www.example.com}testConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The test node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or test node not found - * @response.representation.406.doc The call is not applicable to test course node - * @response.representation.409.doc The configuration is not valid + * * @param courseId * @param nodeId * @param allowCancel @@ -2086,13 +1794,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @POST @Path("test/{nodeId}/configuration") @Operation(summary = "Attach the run-time configuration", description = "This attaches the run-time configuration onto a given survey element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node configuration", content = { + @ApiResponse(responseCode = "200", description = "The test node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found"), - @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node"), - @ApiResponse(responseCode = "409", description = "The configuration is not valid")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") + @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node") + @ApiResponse(responseCode = "409", description = "The configuration is not valid") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addTestConfigurationPost(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -2118,16 +1826,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * This attaches the run-time configuration onto a given test element. - * @response.representation.mediaType application/x-www-form-urlencoded - * @response.representation.doc The test node configuration - * @response.representation.200.qname {http://www.example.com}testConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The test node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or test node not found - * @response.representation.406.doc The call is not applicable to test course node - * @response.representation.409.doc The configuration is not valid + * * @param courseId * @param nodeId * @param allowCancel @@ -2153,13 +1852,13 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @PUT @Path("test/{nodeId}/configuration") @Operation(summary = "Attach the run-time configuration", description = "This attaches the run-time configuration onto a given survey element") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The test node configuration", content = { + @ApiResponse(responseCode = "200", description = "The test node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found"), - @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node"), - @ApiResponse(responseCode = "409", description = "The configuration is not valid")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") + @ApiResponse(responseCode = "406", description = "The call is not applicable to survey course node") + @ApiResponse(responseCode = "409", description = "The configuration is not valid") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response addTestConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @@ -2190,12 +1889,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { /** * Retrieves configuration of the test course node - * @response.representation.200.qname {http://www.example.com}testConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The course node configuration - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or test node not found + * * @param courseId * @param nodeId * @return test course node configuration @@ -2203,11 +1897,11 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @GET @Path("test/{nodeId}/configuration") @Operation(summary = "Retrieve configuration", description = "Retrieves configuration of the survey course node") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The course node configuration", content = { + @ApiResponse(responseCode = "200", description = "The course node configuration", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = SurveyConfigVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or task node not found")}) + @Content(mediaType = "application/xml", schema = @Schema(implementation = SurveyConfigVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or task node not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTestConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId) { @@ -2268,7 +1962,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Override public void configure(ICourse course, CourseNode newNode, ModuleConfiguration moduleConfig) { moduleConfig.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.FALSE.booleanValue()); - //fxdiff FXOLAT-122: course management + if(url != null) { moduleConfig.setConfigurationVersion(2); moduleConfig.set(TUConfigForm.CONFIGKEY_PROTO, url.getProtocol()); @@ -2276,7 +1970,7 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { moduleConfig.set(TUConfigForm.CONFIGKEY_URI, url.getPath()); moduleConfig.set(TUConfigForm.CONFIGKEY_QUERY, url.getQuery()); int port = url.getPort(); - moduleConfig.set(TUConfigForm.CONFIGKEY_PORT, new Integer(port != -1 ? port : url.getDefaultPort())); + moduleConfig.set(TUConfigForm.CONFIGKEY_PORT, Integer.valueOf(port != -1 ? port : url.getDefaultPort())); moduleConfig.setBooleanEntry(TUConfigForm.CONFIG_IFRAME, true); } } @@ -2485,7 +2179,6 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { } } - //fxdiff FXOLAT-122: course management public class StructureFullConfig implements FullConfigDelegate { private final String displayType; @@ -2689,7 +2382,6 @@ public class CourseElementWebService extends AbstractCourseNodeWebService { @Override public void configure(ICourse course, CourseNode newNode, ModuleConfiguration moduleConfig) { newNode.updateModuleConfigDefaults(true, null); - //fxdiff FXOLAT-122: course management if(text != null) { moduleConfig.set(TACourseNode.CONF_TASK_TEXT, text); } diff --git a/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java index ca5744cff3b..e7e1de4a759 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java @@ -21,7 +21,6 @@ package org.olat.restapi.repository.course; import static org.olat.restapi.security.RestSecurityHelper.isGroupManager; - import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -73,7 +72,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -100,18 +98,13 @@ public class CourseGroupWebService { /** * Retrieves the version of the Course Group Web Service. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "Retrieves the version of the Course Group Web Service", description = "Retrieves the version of the Course Group Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service" - )} -) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -185,25 +178,18 @@ public class CourseGroupWebService { /** * Lists all learn groups of the specified course. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all learning group of the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVOes} - * @response.representation.404.doc The context of the group not found + * * @param request The HTTP request * @return */ @GET @Operation(summary = "Lists all learn groups", description = "Lists all learn groups of the specified course") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all learning group of the course", - content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) - } - ), - @ApiResponse(responseCode = "404", description = "The context of the group not found")} -) + @ApiResponse(responseCode = "200", description = "The list of all learning group of the course", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) + }) + @ApiResponse(responseCode = "404", description = "The context of the group not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getGroupList() { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); @@ -220,26 +206,17 @@ public class CourseGroupWebService { /** * Creates a new group for the course. - * @response.representation.qname {http://www.example.com}groupVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc A group to save - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted group - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param group The group's metadatas * @param request The HTTP request * @return */ @PUT @Operation(summary = "Create a new group", description = "Creates a new group for the course") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A group to save", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "A group to save", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putNewGroup(GroupVO group, @Context HttpServletRequest request) { @@ -251,7 +228,7 @@ public class CourseGroupWebService { } UserRequest ureq = RestSecurityHelper.getUserRequest(request); - BusinessGroupService bgm = CoreSpringFactory.getImpl(BusinessGroupService.class); + BusinessGroupService bgm = CoreSpringFactory.getImpl(BusinessGroupService.class); RepositoryEntry courseRe = RepositoryManager.getInstance().lookupRepositoryEntry(course, false); BusinessGroup bg; @@ -271,24 +248,20 @@ public class CourseGroupWebService { /** * Retrieves the metadata of the specified group. - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc This is the list of all groups in OLAT system - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.404.doc The business group cannot be found - * @param groupKey The group's id - * @param request The REST request - * @param httpRequest The HTTP request + * + * @param groupKey The group's id + * @param request The REST request + * @param httpRequest The HTTP request * @return */ @GET @Path("{groupKey}") @Operation(summary = "Retrieves the metadata of the specified group", description = "Retrieves the metadata of the specified group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "This is the list of all groups in OLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) }), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") }) + @ApiResponse(responseCode = "200", description = "This is the list of all groups in OLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = GroupVO.class))) + }) + @ApiResponse(responseCode = "404", description = "The business group cannot be found") public Response getGroup(@PathParam("groupKey") Long groupKey, @Context Request request, @Context HttpServletRequest httpRequest) { //further security check: group is in the course return new LearningGroupWebService().findById(groupKey, request, httpRequest); @@ -296,30 +269,20 @@ public class CourseGroupWebService { /** * Updates the metadata for the specified group. - * @response.representation.qname {http://www.example.com}groupVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The group to update - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.200.qname {http://www.example.com}groupVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The saved group - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_GROUPVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found - * @param groupKey The group's id - * @param group The group metadatas - * @param request The HTTP request + * + * @param groupKey The group's id + * @param group The group metadatas + * @param request The HTTP request * @return */ @POST @Path("{groupKey}") @Operation(summary = "Updates the metadata for the specified group", description = "Updates the metadata for the specified group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The saved group", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") }) + @ApiResponse(responseCode = "200", description = "The saved group", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = GroupVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = GroupVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found") public Response updateGroup(@PathParam("groupKey") Long groupKey, GroupVO group, @Context HttpServletRequest request) { if(!isGroupManager(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -329,9 +292,7 @@ public class CourseGroupWebService { /** * Deletes the business group specified by the key of the group. - * @response.representation.200.doc The business group is deleted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The business group cannot be found + * * @param groupKey The group id * @param request The HTTP request * @return @@ -339,10 +300,9 @@ public class CourseGroupWebService { @DELETE @Path("{groupKey}") @Operation(summary = "Deletes the business group", description = "Deletes the business group specified by the key of the group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The business group is deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The business group cannot be found") }) + @ApiResponse(responseCode = "200", description = "The business group is deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The business group cannot be found") public Response deleteGroup(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { if(!isGroupManager(request)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); @@ -355,7 +315,6 @@ public class CourseGroupWebService { * @return value bigger or equal than 0 */ private int normalize(Integer integer) { - //fxdiff FXOLAT-122: course management if(integer == null) return -1; if(integer.intValue() < 0) return -1; return integer.intValue(); diff --git a/src/main/java/org/olat/restapi/repository/course/CourseResourceFolderWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseResourceFolderWebService.java index af122e72ca7..b36e96f52f3 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseResourceFolderWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseResourceFolderWebService.java @@ -84,7 +84,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -123,16 +122,13 @@ public class CourseResourceFolderWebService { /** * The version of the resources folders Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "The version of the resources folders Web Service", description = "The version of the resources folders Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") }) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -140,9 +136,7 @@ public class CourseResourceFolderWebService { /** * This retrieves the files in the shared folder - * @response.representation.200.doc The list of files - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the shared folder not found + * * @param courseId The course resourceable's id * @param uri The uri infos * @param httpRequest The HTTP request @@ -152,12 +146,11 @@ public class CourseResourceFolderWebService { @GET @Path("sharedfolder") @Operation(summary = "This retrieves the files in the shared folder", description = "This retrieves the files in the shared folder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") }) + @ApiResponse(responseCode = "200", description = "The list of files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") public Response getSharedFiles(@PathParam("courseId") Long courseId, @Context UriInfo uriInfo, @Context HttpServletRequest httpRequest, @Context Request request) { return getFiles(courseId, Collections.<PathSegment>emptyList(), FolderType.SHARED_FOLDER, uriInfo, httpRequest, request); @@ -165,10 +158,7 @@ public class CourseResourceFolderWebService { /** * This retrieves the files in the shared folder - * @response.representation.200.doc The list of files - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the file not found - * @response.representation.406.doc The course node is not acceptable to copy a file + * * @param courseId The course resourceable's id * @param path The path of the file or directory * @param uri The uri infos @@ -179,13 +169,12 @@ public class CourseResourceFolderWebService { @GET @Path("sharedfolder/{path:.*}") @Operation(summary = "This retrieves the files in the shared folder", description = "This retrieves the files in the shared folder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or the shared folder not found"), - @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file")}) + @ApiResponse(responseCode = "200", description = "The list of files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") + @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML, MediaType.APPLICATION_OCTET_STREAM}) public Response getSharedFiles(@PathParam("courseId") Long courseId, @PathParam("path") List<PathSegment> path, @Context UriInfo uriInfo, @Context HttpServletRequest httpRequest, @Context Request request) { @@ -195,9 +184,7 @@ public class CourseResourceFolderWebService { /** * This retrieves the files in the course folder - * @response.representation.200.doc The list of files - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * * @param courseId The course resourceable's id * @param uri The uri infos * @param httpRequest The HTTP request @@ -207,12 +194,11 @@ public class CourseResourceFolderWebService { @GET @Path("coursefolder") @Operation(summary = "This retrieves the files in the course folder", description = "This retrieves the files in the course folder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") }) + @ApiResponse(responseCode = "200", description = "The list of files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") public Response getCourseFiles(@PathParam("courseId") Long courseId, @Context UriInfo uriInfo, @Context HttpServletRequest httpRequest, @Context Request request) { return getFiles(courseId, Collections.<PathSegment>emptyList(), FolderType.COURSE_FOLDER, uriInfo, httpRequest, request); @@ -220,10 +206,7 @@ public class CourseResourceFolderWebService { /** * This retrieves the files in the course folder - * @response.representation.200.doc The list of files - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the file not found - * @response.representation.406.doc The course node is not acceptable to copy a file + * * @param courseId The course resourceable's id * @param path The path of the file or directory * @param uri The uri infos @@ -234,13 +217,12 @@ public class CourseResourceFolderWebService { @GET @Path("coursefolder/{path:.*}") @Operation(summary = "This retrieves the files in the course folder", description = "This retrieves the files in the course folder") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") , - @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file")}) + @ApiResponse(responseCode = "200", description = "The list of files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = LinkVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or the shared folder not found") + @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML, MediaType.APPLICATION_OCTET_STREAM}) public Response getCourseFiles(@PathParam("courseId") Long courseId, @PathParam("path") List<PathSegment> path, @Context UriInfo uriInfo, @Context HttpServletRequest httpRequest, @Context Request request) { @@ -249,12 +231,7 @@ public class CourseResourceFolderWebService { /** * This attaches the uploaded file(s) to the supplied folder id. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The file - * @response.representation.200.doc The file is correctly saved - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or course node not found - * @response.representation.406.doc The course node is not acceptable to copy a file + * * @param courseId The course resourceable's id * @param filename The filename * @param file The file resource to upload @@ -264,11 +241,10 @@ public class CourseResourceFolderWebService { @POST @Path("coursefolder") @Operation(summary = "This attaches the uploaded file(s) to the supplied folder id", description = "This attaches the uploaded file(s) to the supplied folder id") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The file is correctly saved"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or course node not found") , - @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file")}) + @ApiResponse(responseCode = "200", description = "The file is correctly saved") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or course node not found") + @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response attachFileToFolderPost(@PathParam("courseId") Long courseId, @Context HttpServletRequest request) { @@ -277,12 +253,7 @@ public class CourseResourceFolderWebService { /** * This attaches the uploaded file(s) to the supplied folder id at the specified path. - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The file - * @response.representation.200.doc The file is correctly saved - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or course node not found - * @response.representation.406.doc The course node is not acceptable to copy a file + * * @param courseId The course resourceable's id * @param path The path of the file * @param filename The filename @@ -293,11 +264,10 @@ public class CourseResourceFolderWebService { @POST @Path("coursefolder/{path:.*}") @Operation(summary = "Attach the uploaded file(s) to the supplied folder id at the specified path", description = "This attaches the uploaded file(s) to the supplied folder id at the specified path") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The file is correctly saved"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or course node not found") , - @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file")}) + @ApiResponse(responseCode = "200", description = "The file is correctly saved") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or course node not found") + @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response attachFileToFolderPost(@PathParam("courseId") Long courseId, @PathParam("path") List<PathSegment> path, @Context HttpServletRequest request) { @@ -306,12 +276,7 @@ public class CourseResourceFolderWebService { /** * This attaches the uploaded file(s) to the supplied folder id at the root level - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The file - * @response.representation.200.doc The file is correctly saved - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or course node not found - * @response.representation.406.doc The course node is not acceptable to copy a file + * * @param courseId The course resourceable's id * @param nodeId The id for the folder that will contain the file(s) * @param filename The filename @@ -322,11 +287,10 @@ public class CourseResourceFolderWebService { @PUT @Path("coursefolder") @Operation(summary = "Attach the uploaded file(s) to the supplied folder id at the root level", description = "This attaches the uploaded file(s) to the supplied folder id at the root level") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The file is correctly saved"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or course node not found") , - @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file")}) + @ApiResponse(responseCode = "200", description = "The file is correctly saved") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or course node not found") + @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response attachFileToFolder(@PathParam("courseId") Long courseId, @Context HttpServletRequest request) { @@ -335,12 +299,7 @@ public class CourseResourceFolderWebService { /** * This attaches the uploaded file(s) to the supplied folder id at the specified path - * @response.representation.mediaType multipart/form-data - * @response.representation.doc The file - * @response.representation.200.doc The file is correctly saved - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or course node not found - * @response.representation.406.doc The course node is not acceptable to copy a file + * * @param courseId The course resourceable's id * @param nodeId The id for the folder that will contain the file(s) * @param filename The filename @@ -351,11 +310,10 @@ public class CourseResourceFolderWebService { @PUT @Path("coursefolder/{path:.*}") @Operation(summary = "Attach the uploaded file(s) to the supplied folder id at the specified path", description = "This attaches the uploaded file(s) to the supplied folder id at the specified path") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The file is correctly saved"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course or course node not found") , - @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file")}) + @ApiResponse(responseCode = "200", description = "The file is correctly saved") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course or course node not found") + @ApiResponse(responseCode = "406", description = "The course node is not acceptable to copy a file") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response attachFileToFolder(@PathParam("courseId") Long courseId, @PathParam("path") List<PathSegment> path, @Context HttpServletRequest request) { diff --git a/src/main/java/org/olat/restapi/repository/course/CourseWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseWebService.java index 6e2f6fe16e7..05bf708cbfc 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseWebService.java @@ -265,12 +265,6 @@ public class CourseWebService { /** * Publish the course. * - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the created course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param locale The course locale * @param request The HTTP request * @return It returns the metadatas of the published course. @@ -315,12 +309,6 @@ public class CourseWebService { /** * Get the access configuration of the course by id. * - * @response.representation.200.qname {http://www.example.com}repositoryEntryAccessVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The access configuration of the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_REPOACCESS} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param request The HTTP request * @return It returns the <code>RepositoryEntryAccessVO</code> object representing the access configuration of the course. */ @@ -343,13 +331,8 @@ public class CourseWebService { } /** - * Get the metadatas of the course by id - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the created course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get the metadatas of the course by id. + * * @param request The HTTP request * @return It returns the <code>CourseVO</code> object representing the course. */ @@ -373,12 +356,6 @@ public class CourseWebService { /** * Get the OLAT resource of the course specified by its id. * - * @response.representation.200.qname {http://www.example.com}olatResourceVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The OLAT resource of the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_OLATRESOURCEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param request The HTTP request * @return It returns the <code>CourseVO</code> object representing the course. */ @@ -400,11 +377,8 @@ public class CourseWebService { } /** - * Export the course - * @response.representation.200.mediaType application/zip - * @response.representation.200.doc The course as a ZIP file - * @response.representation.401.doc Not authorized to export the course - * @response.representation.404.doc The course not found + * Export the course. + * * @param request The HTTP request * @return It returns the <code>CourseVO</code> object representing the course. */ @@ -472,9 +446,6 @@ public class CourseWebService { /** * Delete a course by id. * - * @response.representation.200.doc The metadatas of the deleted course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param request The HTTP request * @return It returns the XML representation of the <code>Structure</code> * object representing the course. @@ -511,9 +482,6 @@ public class CourseWebService { * <li>restored</li> * </ul> * - * @response.representation.200.doc The metadatas of the deleted course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found * @param request The HTTP request * @return It returns the XML representation of the <code>Structure</code> * object representing the course. @@ -565,13 +533,8 @@ public class CourseWebService { } /** - * Get the configuration of the course - * @response.representation.200.qname {http://www.example.com}courseConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The configuration of the course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSECONFIGVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get the configuration of the course. + * * @param request The HTTP request * @return It returns the XML representation of the <code>Structure</code> * object representing the course. @@ -594,13 +557,8 @@ public class CourseWebService { } /** - * Update the course configuration - * @response.representation.200.qname {http://www.example.com}courseConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the created course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSECONFIGVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Update the course configuration. + * * @param courseId The course resourceable's id * @param calendar Enable/disable the calendar (value: true/false) (optional) * @param chat Enable/disable the chat (value: true/false) (optional) @@ -661,13 +619,8 @@ public class CourseWebService { } /** - * Update the course configuration - * @response.representation.200.qname {http://www.example.com}courseConfigVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the created course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSECONFIGVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Update the course configuration. + * * @param courseId The course resourceable's id * @param configuration The new configuration (null elements are ignored) * @param request The HTTP request @@ -720,11 +673,8 @@ public class CourseWebService { } /** - * Get the runstructure of the course by id - * @response.representation.200.mediaType application/xml - * @response.representation.200.doc The run structure of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get the runstructure of the course by id. + * * @param httpRequest The HTTP request * @param request The REST request * @return It returns the XML representation of the <code>Structure</code> @@ -752,11 +702,8 @@ public class CourseWebService { } /** - * Get the editor tree model of the course by id - * @response.representation.200.mediaType application/xml - * @response.representation.200.doc The editor tree model of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get the editor tree model of the course by id. + * * @param httpRequest The HTTP request * @param request The REST request * @return It returns the XML representation of the <code>Editor model</code> @@ -851,12 +798,8 @@ public class CourseWebService { } /** - * Get all owners and authors of the course - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of authors - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get all owners and authors of the course. + * * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @@ -886,12 +829,8 @@ public class CourseWebService { } /** - * Get all coaches of the course (don't follow the groups) - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of coaches - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get all coaches of the course (don't follow the groups). + * * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @@ -921,12 +860,8 @@ public class CourseWebService { } /** - * Get all participants of the course (don't follow the groups) - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of participants - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found + * Get all participants of the course (don't follow the groups). + * * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @@ -956,12 +891,8 @@ public class CourseWebService { } /** - * Get this specific author and owner of the course - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The author - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course not found or the user is not an onwer or author of the course + * Get this specific author and owner of the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns an <code>UserVO</code> @@ -992,10 +923,8 @@ public class CourseWebService { } /** - * Add an owner and author to the course - * @response.representation.200.doc The user is an author and owner of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Add an owner and author to the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is added as owner and author of the course @@ -1068,10 +997,8 @@ public class CourseWebService { } /** - * Remove an owner and author to the course - * @response.representation.200.doc The user was successfully removed as owner of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Remove an owner and author to the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is removed as owner of the course @@ -1103,10 +1030,8 @@ public class CourseWebService { } /** - * Add a coach to the course - * @response.representation.200.doc The user is a coach of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Add a coach to the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is added as coach of the course @@ -1163,10 +1088,8 @@ public class CourseWebService { } /** - * Remove a coach from the course - * @response.representation.200.doc The user was successfully removed as coach of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Remove a coach from the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is removed as coach of the course @@ -1198,10 +1121,8 @@ public class CourseWebService { } /** - * Add an participant to the course - * @response.representation.200.doc The user is a participant of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Add an participant to the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is added as owner and author of the course @@ -1235,10 +1156,8 @@ public class CourseWebService { } /** - * Add an participant to the course - * @response.representation.200.doc The user is a participant of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Add an participant to the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is added as owner and author of the course @@ -1268,10 +1187,8 @@ public class CourseWebService { } /** - * Remove a participant from the course - * @response.representation.200.doc The user was successfully removed as participant of the course - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The course or the user not found + * Remove a participant from the course. + * * @param identityKey The user identifier * @param httpRequest The HTTP request * @return It returns 200 if the user is removed as participant of the course diff --git a/src/main/java/org/olat/restapi/repository/course/CoursesInfosWebService.java b/src/main/java/org/olat/restapi/repository/course/CoursesInfosWebService.java index 9204ea054c9..47bb7218a23 100644 --- a/src/main/java/org/olat/restapi/repository/course/CoursesInfosWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CoursesInfosWebService.java @@ -79,7 +79,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -101,10 +100,7 @@ public class CoursesInfosWebService { /** * Get courses informations viewable by the authenticated user - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json, application/json;pagingspec=1.0 - * @response.representation.200.doc List of visible courses - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEINFOVOes} + * * @param start * @param limit * @param httpRequest The HTTP request @@ -113,9 +109,9 @@ public class CoursesInfosWebService { */ @GET @Operation(summary = "Get course informations", description = "Get course informations viewable by the authenticated user") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "List of visible courses", content = { + @ApiResponse(responseCode = "200", description = "List of visible courses", content = { @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) }) + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseInfoList(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @Context HttpServletRequest httpRequest, @@ -154,10 +150,7 @@ public class CoursesInfosWebService { /** * Get course informations viewable by the authenticated user - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Course informations - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEINFOVO} + * * @param courseId The course id * @param httpRequest The HTTP request * @return @@ -165,9 +158,9 @@ public class CoursesInfosWebService { @GET @Path("{courseId}") @Operation(summary = "Get course informations", description = "Get course informations viewable by the authenticated user") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "Course informations", content = { + @ApiResponse(responseCode = "200", description = "Course informations", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }) }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseInfo(@PathParam("courseId") Long courseId, @Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java b/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java index 00d58443308..2c5b520af69 100644 --- a/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java @@ -98,7 +98,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -137,18 +136,13 @@ public class CoursesWebService { /** * The version of the Course Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "The version of the Course Web Service", description = "The version of the Course Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service" - )} -) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -156,10 +150,7 @@ public class CoursesWebService { /** * Get all courses viewable by the authenticated user - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json, application/json;pagingspec=1.0 - * @response.representation.200.doc List of visible courses - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVOes} + * * @param start * @param limit * @param externalId Search with an external ID @@ -171,9 +162,9 @@ public class CoursesWebService { */ @GET @Operation(summary = "Get all courses", description = "Get all courses viewable by the authenticated user") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "List of visible courses", content = { + @ApiResponse(responseCode = "200", description = "List of visible courses", content = { @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) }) + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCourseList(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") Integer limit, @QueryParam("managed") Boolean managed, @@ -252,11 +243,7 @@ public class CoursesWebService { /** * Creates an empty course, or a copy from a course if the parameter copyFrom is set. - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the created course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param shortTitle The short title * @param title The title * @param sharedFolderSoftKey The repository entry key of a shared folder (optional) @@ -268,10 +255,10 @@ public class CoursesWebService { */ @PUT @Operation(summary = "Creates an empty course", description = "Creates an empty course, or a copy from a course if the parameter copyFrom is set") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The metadatas of the created course", content = { + @ApiResponse(responseCode = "200", description = "The metadatas of the created course", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createEmptyCourse(@QueryParam("shortTitle") String shortTitle, @QueryParam("title") String title, @@ -345,21 +332,17 @@ public class CoursesWebService { /** * Creates an empty course - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the created course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param courseVo The course * @param request The HTTP request * @return It returns the newly created course */ @PUT @Operation(summary = "Creates an empty course", description = "Creates an empty course") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The metadatas of the created course", content = { + @ApiResponse(responseCode = "200", description = "The metadatas of the created course", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createEmptyCourse(CourseVO courseVo, @Context HttpServletRequest request) { @@ -381,21 +364,17 @@ public class CoursesWebService { /** * Imports a course from a course archive zip file - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The metadatas of the imported course - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param ownerUsername set the owner of the imported course to the user of this username. * @param request The HTTP request * @return It returns the imported course */ @POST @Operation(summary = "Imports a course from a course archive zip file", description = "Imports a course from a course archive zip file") - @ApiResponses({ @ApiResponse(responseCode = "200", description = "The metadatas of the created course", content = { + @ApiResponse(responseCode = "200", description = "The metadatas of the created course", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = CourseVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @Content(mediaType = "application/xml", schema = @Schema(implementation = CourseVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.MULTIPART_FORM_DATA}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response importCourse(@QueryParam("ownerUsername") String ownerUsername, @Context HttpServletRequest request) { diff --git a/src/main/java/org/olat/restapi/security/AuthenticationWebService.java b/src/main/java/org/olat/restapi/security/AuthenticationWebService.java index 76f9f2fb966..051b8ea5dac 100644 --- a/src/main/java/org/olat/restapi/security/AuthenticationWebService.java +++ b/src/main/java/org/olat/restapi/security/AuthenticationWebService.java @@ -43,7 +43,6 @@ import org.springframework.stereotype.Component; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -71,9 +70,7 @@ public class AuthenticationWebService { /** * Retrieves the version of the User Authentication Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @@ -99,19 +96,9 @@ public class AuthenticationWebService { * When using the REST API, best-practice is to use basic authentication and * activate cookies in your HTTP client for automatic session management. * - * @response.representation.200.mediaType text/plain, application/xml - * @response.representation.200.doc Say hello to the authenticated user, and - * give it a security - * token @response.representation.200.example - * <hello>Hello john</hello> - * @response.representation.401.doc The authentication has failed - * @response.representation.404.doc The identity not found - * @param username - * The username - * @param password - * The password (the password is in clear text, not encrypted) - * @param httpRequest - * The HTTP request + * @param username The username + * @param password The password (the password is in clear text, not encrypted) + * @param httpRequest The HTTP request * @return */ @GET @@ -127,13 +114,11 @@ public class AuthenticationWebService { " \n" + " When using the REST API, best-practice is to use basic authentication and\n" + " activate cookies in your HTTP client for automatic session management.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Say hello to the authenticated user, and\n" + - " * give it a security\n" + - " * token @response.representation.200.example\n" + - " * <hello>Hello john</hello>"), - @ApiResponse(responseCode = "401", description = "The authentication has failed"), - @ApiResponse(responseCode = "404", description = "The identity not found") }) + @ApiResponse(responseCode = "200", description = "Say hello to the authenticated user, and\n" + + " * give it a security token\n" + + " * <hello>Hello john</hello>") + @ApiResponse(responseCode = "401", description = "The authentication has failed") + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML}) public Response login(@PathParam("username") String username, @QueryParam("password") String password, diff --git a/src/main/java/org/olat/restapi/support/Ping.java b/src/main/java/org/olat/restapi/support/Ping.java index c8649d6a805..cff3c223403 100644 --- a/src/main/java/org/olat/restapi/support/Ping.java +++ b/src/main/java/org/olat/restapi/support/Ping.java @@ -29,7 +29,6 @@ import javax.ws.rs.core.Response; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -49,16 +48,13 @@ public class Ping { /** * The version of the Ping Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return */ @GET @Path("version") @Operation(summary = "The version of the Ping Web Service", description = "The version of the Ping Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Return the version number") }) + @ApiResponse(responseCode = "200", description = "Return the version number") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -66,15 +62,12 @@ public class Ping { /** * Return a string - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc Return a small string - * @response.representation.200.example Ping + * * @return */ @GET @Operation(summary = "Return a string", description = "Return a string") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Ping") }) + @ApiResponse(responseCode = "200", description = "Ping") @Produces(MediaType.TEXT_PLAIN) public Response ping() { return Response.ok("Ping").build(); @@ -82,18 +75,14 @@ public class Ping { /** * Return a concatenation of the string as parameter and Ping - * @response.representation.doc Send a small string over the connection - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc Return a small string - * @response.representation.200.example Ping hello + * * @param name a name * @return */ @POST @Path("{name}") @Operation(summary = "Return a concatenation of the string as parameter and Ping", description = "Return a concatenation of the string as parameter and Ping") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Return a small string") }) + @ApiResponse(responseCode = "200", description = "Return a small string") @Produces(MediaType.TEXT_PLAIN) public Response ping(@PathParam("name") String name) { return Response.ok("Ping " + name).build(); diff --git a/src/main/java/org/olat/restapi/support/vo/Examples.java b/src/main/java/org/olat/restapi/support/vo/Examples.java deleted file mode 100644 index af8cd2bf708..00000000000 --- a/src/main/java/org/olat/restapi/support/vo/Examples.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ - -package org.olat.restapi.support.vo; - -import java.util.Calendar; - -import org.olat.repository.CatalogEntry; -import org.olat.repository.RepositoryEntryStatusEnum; -import org.olat.restapi.support.ObjectFactory; - - -public class Examples { - - public static final GroupVO SAMPLE_GROUPVO = new GroupVO(); - public static final GroupVOes SAMPLE_GROUPVOes = new GroupVOes(); - public static final GroupInfoVO SAMPLE_GROUPINFOVO = new GroupInfoVO(); - public static final GroupInfoVOes SAMPLE_GROUPINFOVOes = new GroupInfoVOes(); - - public static final RepositoryEntryLifecycleVO SAMPLE_LIFECYCLE = new RepositoryEntryLifecycleVO(); - - public static final ErrorVO SAMPLE_ERRORVO = new ErrorVO(); - public static final ErrorVOes SAMPLE_ERRORVOes = new ErrorVOes(); - - public static final OlatResourceVO SAMPLE_OLATRESOURCEVO = new OlatResourceVO(); - - public static final RepositoryEntryVO SAMPLE_REPOENTRYVO = new RepositoryEntryVO(); - public static final RepositoryEntryVOes SAMPLE_REPOENTRYVOes = new RepositoryEntryVOes(); - public static final RepositoryEntryAccessVO SAMPLE_REPOACCESS = new RepositoryEntryAccessVO(); - - public static final AuthenticationVO SAMPLE_AUTHVO = new AuthenticationVO(); - public static final AuthenticationVOes SAMPLE_AUTHVOes = new AuthenticationVOes(); - - public static final AssessableResultsVO SAMPLE_ASSESSABLERESULTSVO = new AssessableResultsVO(); - public static final AssessableResultsVOes SAMPLE_ASSESSABLERESULTSVOes = new AssessableResultsVOes(); - - public static final KeyValuePair SAMPLE_KEYVALUEVO = new KeyValuePair(); - public static final KeyValuePairVOes SAMPLE_KEYVALUEVOes = new KeyValuePairVOes(); - - public static final CourseVO SAMPLE_COURSEVO = new CourseVO(); - public static final CourseVOes SAMPLE_COURSEVOes = new CourseVOes(); - - public static final CourseInfoVO SAMPLE_COURSEINFOVO = new CourseInfoVO(); - public static final CourseInfoVOes SAMPLE_COURSEINFOVOes = new CourseInfoVOes(); - - public static final CourseNodeVO SAMPLE_COURSENODEVO = new CourseNodeVO(); - public static final CourseNodeVOes SAMPLE_COURSENODEVOes = new CourseNodeVOes(); - - public static final CourseConfigVO SAMPLE_COURSECONFIGVO = new CourseConfigVO(); - - public static final FileVO SAMPLE_FILE = new FileVO(); - - public static final FileMetadataVO SAMPLE_FILE_METADATA = new FileMetadataVO(); - - public static final FolderVO SAMPLE_FOLDERVO = new FolderVO(); - public static final FolderVOes SAMPLE_FOLDERVOes = new FolderVOes(); - - public static final CatalogEntryVO SAMPLE_CATALOGENTRYVO = new CatalogEntryVO(); - public static final CatalogEntryVOes SAMPLE_CATALOGENTRYVOes = new CatalogEntryVOes(); - - static { - SAMPLE_GROUPVO.setKey(123467l); - SAMPLE_GROUPVO.setName("My group"); - SAMPLE_GROUPVO.setDescription("My group description"); - SAMPLE_GROUPVO.setExternalId("External Identifier"); - SAMPLE_GROUPVO.setManagedFlags("title,description"); - SAMPLE_GROUPVO.setMinParticipants(0); - SAMPLE_GROUPVO.setMaxParticipants(0); - SAMPLE_GROUPVOes.setGroups(new GroupVO[]{SAMPLE_GROUPVO}); - - SAMPLE_GROUPINFOVO.setKey(123467l); - SAMPLE_GROUPINFOVO.setName("My group"); - SAMPLE_GROUPINFOVO.setDescription("My group description"); - SAMPLE_GROUPINFOVO.setExternalId("External identifier"); - SAMPLE_GROUPINFOVO.setMinParticipants(0); - SAMPLE_GROUPINFOVO.setMaxParticipants(0); - SAMPLE_GROUPINFOVO.setNews("<p>Hello world</p>"); - SAMPLE_GROUPINFOVO.setForumKey(374589l); - SAMPLE_GROUPINFOVOes.setGroups(new GroupInfoVO[]{SAMPLE_GROUPINFOVO}); - - SAMPLE_ERRORVO.setCode("org.olat.restapi:error"); - SAMPLE_ERRORVO.setTranslation("Hello world, there is an error"); - SAMPLE_ERRORVOes.getErrors().add(SAMPLE_ERRORVO); - - SAMPLE_OLATRESOURCEVO.setKey(264278l); - SAMPLE_OLATRESOURCEVO.setResourceableId(66365742l); - SAMPLE_OLATRESOURCEVO.setResourceableTypeName("CourseModule"); - - SAMPLE_REPOENTRYVO.setKey(479286l); - SAMPLE_REPOENTRYVO.setSoftkey("internal_cp"); - SAMPLE_REPOENTRYVO.setDisplayname("CP-demo"); - SAMPLE_REPOENTRYVO.setResourcename("fdhasl"); - SAMPLE_REPOENTRYVO.setResourceableId(4368567l); - SAMPLE_REPOENTRYVO.setResourceableTypeName("CourseModule"); - SAMPLE_REPOENTRYVO.setExternalId("External identifier"); - SAMPLE_REPOENTRYVO.setExternalRef("External reference"); - SAMPLE_REPOENTRYVO.setManagedFlags("title.description"); - SAMPLE_REPOENTRYVOes.setRepositoryEntries(new RepositoryEntryVO[]{SAMPLE_REPOENTRYVO}); - SAMPLE_REPOENTRYVOes.setTotalCount(1); - - SAMPLE_REPOACCESS.setRepoEntryKey(479286l); - SAMPLE_REPOACCESS.setStatus(RepositoryEntryStatusEnum.published.name()); - SAMPLE_REPOACCESS.setAllUsers(true); - SAMPLE_REPOACCESS.setGuests(false); - - Calendar cal = Calendar.getInstance(); - SAMPLE_LIFECYCLE.setKey(2873423876l); - SAMPLE_LIFECYCLE.setLabel("Semester 13"); - SAMPLE_LIFECYCLE.setSoftkey("st_13"); - SAMPLE_LIFECYCLE.setValidFrom(ObjectFactory.formatDate(cal.getTime())); - cal.add(Calendar.DATE, 5); - SAMPLE_LIFECYCLE.setValidTo(ObjectFactory.formatDate(cal.getTime())); - - SAMPLE_AUTHVO.setKey(38759l); - SAMPLE_AUTHVO.setAuthUsername("john"); - SAMPLE_AUTHVO.setProvider("OLAT"); - SAMPLE_AUTHVO.setIdentityKey(345l); - SAMPLE_AUTHVOes.getAuthentications().add(SAMPLE_AUTHVO); - - SAMPLE_ASSESSABLERESULTSVO.setPassed(Boolean.TRUE); - SAMPLE_ASSESSABLERESULTSVO.setScore(34.0f); - SAMPLE_ASSESSABLERESULTSVO.setIdentityKey(345l); - SAMPLE_ASSESSABLERESULTSVOes.getResults().add(SAMPLE_ASSESSABLERESULTSVO); - - SAMPLE_KEYVALUEVO.setKey("Prefered color"); - SAMPLE_KEYVALUEVO.setValue("Green"); - SAMPLE_KEYVALUEVOes.getPairs().add(SAMPLE_KEYVALUEVO); - - SAMPLE_COURSEVO.setKey(777l); - SAMPLE_COURSEVO.setRepoEntryKey(27684l); - SAMPLE_COURSEVO.setSoftKey("internal_fx_cp"); - SAMPLE_COURSEVO.setDisplayName("Demo course"); - SAMPLE_COURSEVO.setTitle("Demo course"); - SAMPLE_COURSEVO.setExternalId("External identifier"); - SAMPLE_COURSEVO.setExternalRef("External reference"); - SAMPLE_COURSEVO.setManagedFlags("title,description"); - SAMPLE_COURSEVOes.setTotalCount(0); - SAMPLE_COURSEVOes.setCourses(new CourseVO[]{SAMPLE_COURSEVO}); - - SAMPLE_COURSENODEVO.setId("id"); - SAMPLE_COURSENODEVOes.getNodes().add(SAMPLE_COURSENODEVO); - - SAMPLE_COURSEINFOVO.setKey(777l); - SAMPLE_COURSEINFOVO.setDisplayName("Demo course"); - SAMPLE_COURSEINFOVO.setTitle("Demo course"); - SAMPLE_COURSEINFOVO.setRepoEntryKey(456l); - SAMPLE_COURSEINFOVO.setSoftKey("oo_98237498"); - SAMPLE_COURSEINFOVOes.setTotalCount(1); - SAMPLE_COURSEINFOVOes.setInfos(new CourseInfoVO[]{SAMPLE_COURSEINFOVO}); - - SAMPLE_COURSECONFIGVO.setSharedFolderSoftKey("head_1_olat_43985684395"); - - SAMPLE_FILE.setHref("href"); - SAMPLE_FILE.setRel("rel"); - SAMPLE_FILE.setSize(8200l); - SAMPLE_FILE.setTitle("portrait.jpg"); - - SAMPLE_FILE_METADATA.setFileName("portrait.jpg"); - SAMPLE_FILE_METADATA.setHref("http://www.openolat.org/"); - SAMPLE_FILE_METADATA.setLastModified(8945783984l); - SAMPLE_FILE_METADATA.setMimeType("image/jpg"); - SAMPLE_FILE_METADATA.setSize(37638l); - - SAMPLE_FOLDERVO.setCourseKey(375397l); - SAMPLE_FOLDERVO.setCourseNodeId("438950850389"); - SAMPLE_FOLDERVO.setName("Course folder"); - SAMPLE_FOLDERVO.setSubscribed(true); - - SAMPLE_FOLDERVOes.setFolders(new FolderVO[]{SAMPLE_FOLDERVO}); - SAMPLE_FOLDERVOes.setTotalCount(1); - - SAMPLE_CATALOGENTRYVO.setKey(new Long(478l)); - SAMPLE_CATALOGENTRYVO.setName("Category"); - SAMPLE_CATALOGENTRYVO.setDescription("Description of the category"); - SAMPLE_CATALOGENTRYVO.setType(CatalogEntry.TYPE_NODE); - - SAMPLE_CATALOGENTRYVOes.setCatalogEntries(new CatalogEntryVO[]{SAMPLE_CATALOGENTRYVO}); - SAMPLE_CATALOGENTRYVOes.setTotalCount(0); - } -} diff --git a/src/main/java/org/olat/restapi/system/DatabaseWebService.java b/src/main/java/org/olat/restapi/system/DatabaseWebService.java index e99973c028e..8b4c82effc8 100644 --- a/src/main/java/org/olat/restapi/system/DatabaseWebService.java +++ b/src/main/java/org/olat/restapi/system/DatabaseWebService.java @@ -37,7 +37,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -48,21 +47,15 @@ public class DatabaseWebService { /** * Return the statistics about database and hibernate * - * @response.representation.200.qname {http://www.example.com}runtimeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The version of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_DATABASEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param request The HTTP request * @return The informations about runtime, uptime, classes loaded, memory summary... */ @GET @Operation(summary = "Return the statistics about database and hibernate", description = "Return the statistics about database and hibernate") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = DatabaseVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = DatabaseVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = DatabaseVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = DatabaseVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getDatabaseStatistics() { DatabaseConnectionVO connections = CoreSpringFactory.getImpl(DatabaseStatsManager.class) diff --git a/src/main/java/org/olat/restapi/system/IndexerWebService.java b/src/main/java/org/olat/restapi/system/IndexerWebService.java index 1f745c243c3..95053c83221 100644 --- a/src/main/java/org/olat/restapi/system/IndexerWebService.java +++ b/src/main/java/org/olat/restapi/system/IndexerWebService.java @@ -38,7 +38,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -48,20 +47,15 @@ public class IndexerWebService { /** * Return the statistics about the indexer - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc Statistics about the indexer - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_OO_INDEXERSTATSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The statistics about the indexer */ @GET @Operation(summary = "Return the statistics about the indexer", description = "Return the statistics about the indexer") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Statistics about the indexer", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = IndexerStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = IndexerStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "Statistics about the indexer", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = IndexerStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = IndexerStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getStatistics() { IndexerStatisticsVO stats = getIndexerStatistics(); @@ -70,17 +64,14 @@ public class IndexerWebService { /** * Return the status of the indexer: running, stopped - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The status of the indexer - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The status of the indexer */ @GET @Path("status") @Operation(summary = "Return the status of the indexer", description = "Return the status of the indexer: running, stopped") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "he status of the indexer"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "he status of the indexer") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getStatus() { String status; @@ -95,17 +86,14 @@ public class IndexerWebService { /** * Return the status of the indexer: running, stopped - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The status of the indexer - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The status of the indexer */ @GET @Path("status") @Operation(summary = "Return the status of the indexer", description = "Return the status of the indexer: running, stopped") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The status of the indexer"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The status of the indexer") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.TEXT_PLAIN}) public Response getPlainTextStatus() { String status; @@ -121,17 +109,15 @@ public class IndexerWebService { /** * Update the status of the indexer: running, stopped. * Running start the indexer, stopped, stop it. - * @response.representation.200.doc The status has changed - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The status of the indexer */ @POST @Path("status") @Operation(summary = "Update the status of the indexer", description = "Update the status of the indexer: running, stopped.\n" + " Running start the indexer, stopped, stop it.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The status has changed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The status has changed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response setStatus(@FormParam("status") String status) { if(FullIndexerStatus.STATUS_RUNNING.equals(status)) { SearchServiceFactory.getService().startIndexing(); diff --git a/src/main/java/org/olat/restapi/system/LogWebService.java b/src/main/java/org/olat/restapi/system/LogWebService.java index aab8e91f2e3..d851adf4496 100644 --- a/src/main/java/org/olat/restapi/system/LogWebService.java +++ b/src/main/java/org/olat/restapi/system/LogWebService.java @@ -40,7 +40,6 @@ import org.olat.core.util.vfs.VFSLeaf; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * Description:<br> @@ -63,16 +62,12 @@ public class LogWebService { /** * The version of the Log Web Service * - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 * @return */ @GET @Path("version") @Operation(summary = "The version of the Log Web Service", description = "The version of the Log Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Return the version number") }) + @ApiResponse(responseCode = "200", description = "Return the version number") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -81,8 +76,7 @@ public class LogWebService { @GET @Path("{date}") @Operation(summary = "Get old version", description = "Get the version from a specific date") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Return the version number") }) + @ApiResponse(responseCode = "200", description = "Return the version number") @Produces({ "text/plain", MediaType.APPLICATION_OCTET_STREAM }) public Response getLogFileByDate(@PathParam("date") String dateString) { VFSLeaf logFile; @@ -115,8 +109,7 @@ public class LogWebService { " \n" + " will return null if the given String is not valid or the resulting\n" + " logfile is not found") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "the requested LogFile as VFSLeaf or null") }) + @ApiResponse(responseCode = "200", description = "the requested LogFile as VFSLeaf or null") @Produces({ "text/plain", MediaType.APPLICATION_OCTET_STREAM }) public Response getCurrentLogFile() { return getLogFileByDate(null); diff --git a/src/main/java/org/olat/restapi/system/MemoryWebService.java b/src/main/java/org/olat/restapi/system/MemoryWebService.java index 1a81e02d7ac..2cbd7e7a7c8 100644 --- a/src/main/java/org/olat/restapi/system/MemoryWebService.java +++ b/src/main/java/org/olat/restapi/system/MemoryWebService.java @@ -46,7 +46,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** @@ -90,17 +89,14 @@ public class MemoryWebService implements Sampler { /** * Return informations about memory. - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc Informations about memory - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The informations about the memory */ @GET @Operation(summary = "Return informations about memory", description = "Return informations about memory") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Informations about memory"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "Informations about memory") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces(MediaType.TEXT_PLAIN) public Response getMemory() { MemoryVO vo = createMemoryVO(); @@ -109,21 +105,16 @@ public class MemoryWebService implements Sampler { /** * Return some informations about memory. - * @response.representation.200.qname {http://www.example.com}memoryVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A short summary of the number of classes - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_MEMORYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @param request The HTTP request + * + * @param request The HTTP request * @return The informations about the memory */ @GET @Operation(summary = "Return some informations about memory", description = "Return some informations about memory") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A short summary of the number of classes", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MemoryVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MemoryVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "A short summary of the number of classes", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MemoryVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MemoryVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMemoryXml() { MemoryVO vo = createMemoryVO(); @@ -137,16 +128,14 @@ public class MemoryWebService implements Sampler { long totalUsed = (totalMem - r.freeMemory()) / 1000000; // Max available memory in VM in megabytes long maxAvailable = r.maxMemory() / 1000000; - MemoryVO vo = new MemoryVO(totalMem/1000000, totalUsed, maxAvailable); - return vo; + return new MemoryVO(totalMem/1000000, totalUsed, maxAvailable); } @GET @Path("pools") @Operation(summary = "Get pools", description = "Get the pools") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The pools"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The pools") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces(MediaType.TEXT_PLAIN) public Response getMemoryPools() { MemoryPoolVO[] voes = createMemoryPools(); @@ -160,9 +149,8 @@ public class MemoryWebService implements Sampler { @GET @Path("pools") @Operation(summary = "Get pools", description = "Get the pools") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The pools"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The pools") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMemoryPoolsXml() { MemoryPoolVO[] voes = createMemoryPools(); @@ -172,9 +160,8 @@ public class MemoryWebService implements Sampler { @GET @Path("samples") @Operation(summary = "Get samples", description = "Get the samples") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The samples"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The samples") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getSamplesXml(@QueryParam("from") String from, @QueryParam("to") String to, @QueryParam("lastSamples") Integer maxResults) { List<MemorySampleVO> samples = new ArrayList<>(memorySamples); diff --git a/src/main/java/org/olat/restapi/system/MonitoringWebService.java b/src/main/java/org/olat/restapi/system/MonitoringWebService.java index a2e68786554..6cff96611e4 100644 --- a/src/main/java/org/olat/restapi/system/MonitoringWebService.java +++ b/src/main/java/org/olat/restapi/system/MonitoringWebService.java @@ -40,7 +40,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -98,11 +97,6 @@ public class MonitoringWebService { * Return the configuration of the monitoring, which probes are available, * which dependency... * - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The verison of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_MONITORINGCONFIGVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param request The HTTP request * @return The informations about the memory */ @@ -110,12 +104,11 @@ public class MonitoringWebService { @Path("configuration") @Operation(summary = "Return the configuration of the monitoring", description = "Return the configuration of the monitoring, which probes are available,\n" + " which dependency...") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "he version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MonitoringInfosVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MonitoringInfosVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "he version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MonitoringInfosVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MonitoringInfosVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getImplementedProbes() { MonitoringInfosVO vo = new MonitoringInfosVO(); diff --git a/src/main/java/org/olat/restapi/system/NotificationsAdminWebService.java b/src/main/java/org/olat/restapi/system/NotificationsAdminWebService.java index 1acf2010cfa..009f422cb78 100644 --- a/src/main/java/org/olat/restapi/system/NotificationsAdminWebService.java +++ b/src/main/java/org/olat/restapi/system/NotificationsAdminWebService.java @@ -29,8 +29,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.olat.core.CoreSpringFactory; import org.apache.logging.log4j.Logger; +import org.olat.core.CoreSpringFactory; import org.olat.core.logging.Tracing; import org.olat.restapi.system.vo.NotificationsStatus; import org.quartz.JobExecutionContext; @@ -40,7 +40,6 @@ import org.quartz.SchedulerException; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -54,17 +53,14 @@ public class NotificationsAdminWebService { /** * Return the status of the notifications job: running, stopped - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The status of the notifications job - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The status of the notifications job */ @GET @Path("status") @Operation(summary = "Return the status", description = "Return the status of the notifications job: running, stopped") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The status of the notifications job"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The status of the notifications job") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getStatus() { return Response.ok(new NotificationsStatus(getJobStatus())).build(); @@ -72,17 +68,14 @@ public class NotificationsAdminWebService { /** * Return the status of the notifications job: running, stopped - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The status of the notifications job - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The status of the notifications job */ @GET @Path("status") @Operation(summary = "Return the status", description = "Return the status of the notifications job: running, stopped") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The status of the notifications job"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The status of the notifications job") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.TEXT_PLAIN}) public Response getPlainTextStatus() { return Response.ok(getJobStatus()).build(); @@ -107,16 +100,14 @@ public class NotificationsAdminWebService { /** * Update the status of the notifications job: running, stopped. * Running start the indexer, stopped, stop it. - * @response.representation.200.doc The status has changed - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @return The status of the notification */ @POST @Path("status") @Operation(summary = "Update the status", description = "Update the status of the notifications job: running, stopped. Running start the indexer, stopped, stop it") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The status of the notifications job"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The status of the notifications job") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response setStatus(@FormParam("status") String status) { if("running".equals(status)) { try { diff --git a/src/main/java/org/olat/restapi/system/OpenOLATStatisticsWebService.java b/src/main/java/org/olat/restapi/system/OpenOLATStatisticsWebService.java index abf3bf67e8a..22189d545c8 100644 --- a/src/main/java/org/olat/restapi/system/OpenOLATStatisticsWebService.java +++ b/src/main/java/org/olat/restapi/system/OpenOLATStatisticsWebService.java @@ -54,7 +54,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -67,21 +66,16 @@ public class OpenOLATStatisticsWebService implements Sampler { /** * Return the statistics about OpenOLAT, users count, courses count... - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The verison of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_OO_STATSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The statistics about OpenOLAT */ @GET @Operation(summary = "Return the statistics about OpenOLAT", description = "Return the statistics about OpenOLAT, users count, courses count...") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OpenOLATStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OpenOLATStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OpenOLATStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OpenOLATStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getStatistics() { OpenOLATStatisticsVO stats = new OpenOLATStatisticsVO(); @@ -94,11 +88,7 @@ public class OpenOLATStatisticsWebService implements Sampler { /** * Return the statistics about OpenOLAT users - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The verison of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_OO_USERSSTATSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The statistics about OpenOLAT users */ @@ -106,11 +96,10 @@ public class OpenOLATStatisticsWebService implements Sampler { @GET @Path("users") @Operation(summary = "Return the statistics about OpenOLAT users", description = "Return the statistics about OpenOLAT users") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = UserStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = UserStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = UserStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = UserStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getUserStatistics() { UserStatisticsVO stats = getUserStatisticsVO(); @@ -119,11 +108,7 @@ public class OpenOLATStatisticsWebService implements Sampler { /** * Return the statistics about the repository, courses count, published courses... - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The verison of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_OO_REPOSTATSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The statistics about the repository */ @@ -131,11 +116,10 @@ public class OpenOLATStatisticsWebService implements Sampler { @GET @Path("repository") @Operation(summary = "Return the statistics about the repository", description = "Return the statistics about the repository, courses count, published courses... ") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RepositoryStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RepositoryStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRepositoryStatistics() { RepositoryStatisticsVO stats = getRepositoryStatisticsVO(); @@ -144,43 +128,33 @@ public class OpenOLATStatisticsWebService implements Sampler { /** * Return the statistics about the indexer - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The verison of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_OO_INDEXERSTATSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The statistics about the indexer */ @Path("indexer") @Operation(summary = "Return the statistics about the repository", description = "Return the statistics about the repository, courses count, published courses... ") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = IndexerStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = IndexerStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = IndexerStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = IndexerStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public IndexerWebService getIndexerStatistics() { return indexerWebService; } /** * Return some statistics about session. - * @response.representation.200.qname {http://www.example.com}sessionVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A short summary about sessions - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_SESSIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The statistics about sessions */ @GET @Path("sessions") @Operation(summary = "Return some statistics about session", description = "Return some statistics about session") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = SessionsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = SessionsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = SessionsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = SessionsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getSessions() { SessionsVO vo = getSessionsVO(); @@ -189,22 +163,17 @@ public class OpenOLATStatisticsWebService implements Sampler { /** * Return some statistics about long running tasks. - * @response.representation.200.qname {http://www.example.com}taskVOes - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A short summary about sessions - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_SESSIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The statistics about sessions */ @GET @Path("tasks") @Operation(summary = "Return some statistics about long running tasks", description = "Return some statistics about long running tasks") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A short summary about sessions", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = TasksVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = TasksVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "A short summary about sessions", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TasksVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = TasksVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTasks() { TasksVO vo = getTasksVO(); diff --git a/src/main/java/org/olat/restapi/system/RuntimeWebService.java b/src/main/java/org/olat/restapi/system/RuntimeWebService.java index 78b870730a9..1b9e2a71d3e 100644 --- a/src/main/java/org/olat/restapi/system/RuntimeWebService.java +++ b/src/main/java/org/olat/restapi/system/RuntimeWebService.java @@ -44,7 +44,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -62,23 +61,17 @@ public class RuntimeWebService { * Return the statistics about runtime: uptime, classes loaded, memory * summary, threads count... * - * @response.representation.200.qname {http://www.example.com}runtimeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The version of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIMEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param request The HTTP request * @return The informations about runtime, uptime, classes loaded, memory summary... */ @GET @Operation(summary = "Return the statistics about runtime", description = "Return the statistics about runtime: uptime, classes loaded, memory\n" + " summary, threads count...") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RuntimeStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RuntimeStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RuntimeStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RuntimeStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getSystemSummaryVO() { RuntimeStatisticsVO stats = new RuntimeStatisticsVO(); @@ -98,23 +91,17 @@ public class RuntimeWebService { /** * Return the statistics about memory * - * @response.representation.200.qname {http://www.example.com}runtimeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The version of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIME_MEMORYVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param request The HTTP request * @return The informations about runtime, uptime, classes loaded, memory summary... */ @GET @Path("memory") @Operation(summary = "Return the statistics about memory", description = "Return the statistics about memory") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MemoryStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MemoryStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MemoryStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MemoryStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMemoryStatistics() { MemoryStatisticsVO stats = getMemoryStatisticsVO(); @@ -124,23 +111,17 @@ public class RuntimeWebService { /** * Return the statistics about threads * - * @response.representation.200.qname {http://www.example.com}runtimeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The version of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIME_THREADSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param request The HTTP request * @return The informations about threads count */ @GET @Path("threads") @Operation(summary = "Return the statistics about threads", description = "Return the statistics about threads") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ThreadStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ThreadStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ThreadStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ThreadStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getThreadStatistics() { ThreadStatisticsVO stats = getThreadStatisticsVO(); @@ -149,23 +130,18 @@ public class RuntimeWebService { /** * Return some informations about the number of Java classes... - * @response.representation.200.qname {http://www.example.com}classesVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A short summary of the number of classes - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIME_CLASSESVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The information about the classes */ @GET @Path("classes") @Operation(summary = "Return some informations about the number of Java classes", description = "Return some informations about the number of Java classes...") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A short summary of the number of classes", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ClasseStatisticsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ClasseStatisticsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The course not found") }) + @ApiResponse(responseCode = "200", description = "A short summary of the number of classes", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ClasseStatisticsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ClasseStatisticsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The course not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getCompilationXml() { ClasseStatisticsVO stats = getClasseStatisticsVO(); diff --git a/src/main/java/org/olat/restapi/system/StatusWebservice.java b/src/main/java/org/olat/restapi/system/StatusWebservice.java index 0b94e434de6..1b393508bd4 100644 --- a/src/main/java/org/olat/restapi/system/StatusWebservice.java +++ b/src/main/java/org/olat/restapi/system/StatusWebservice.java @@ -30,12 +30,12 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.apache.logging.log4j.Logger; import org.olat.admin.sysinfo.manager.SessionStatsManager; import org.olat.core.CoreSpringFactory; import org.olat.core.commons.persistence.DBFactory; import org.olat.core.id.Identity; import org.olat.core.id.OLATResourceable; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.CodeHelper; import org.olat.core.util.FileUtils; @@ -54,7 +54,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** @@ -74,22 +73,16 @@ public class StatusWebservice { * Return the statistics about runtime: uptime, classes loaded, memory * summary, threads count... * - * @response.representation.200.qname {http://www.example.com}runtimeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The version of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIMEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param request The HTTP request * @return The informations about runtime, uptime, classes loaded, memory summary... */ @GET @Operation(summary = "Return the statistics about runtime", description = "Return the statistics about runtime: uptime, classes loaded, memory\n" + " summary, threads count...") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = StatusVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = StatusVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = StatusVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = StatusVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getSystemSummaryVO() { StatusVO stats = new StatusVO(); diff --git a/src/main/java/org/olat/restapi/system/SystemWebService.java b/src/main/java/org/olat/restapi/system/SystemWebService.java index 35bdd87bce0..e265cd75f10 100644 --- a/src/main/java/org/olat/restapi/system/SystemWebService.java +++ b/src/main/java/org/olat/restapi/system/SystemWebService.java @@ -49,7 +49,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -74,22 +73,17 @@ public class SystemWebService { /** * Return some informations about the environment. - * @response.representation.200.qname {http://www.example.com}environmentVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc A short summary of the number of classes - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_ENVVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The informations about the environment */ @GET @Path("environment") @Operation(summary = "Return some informations about the environment", description = "Return some informations about the environment") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "A short summary of the number of classes", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = EnvironmentInformationsVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = EnvironmentInformationsVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "A short summary of the number of classes", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = EnvironmentInformationsVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = EnvironmentInformationsVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getEnvironnementXml(@Context HttpServletRequest request) { if(!isAdminOrSystemAdmin(request)) { @@ -103,22 +97,17 @@ public class SystemWebService { /** * Return the version of the instance. - * @response.representation.200.qname {http://www.example.com}releaseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The verison of the instance - * @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RELEASEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param request The HTTP request * @return The informations about the memory */ @GET @Path("release") @Operation(summary = "Return the version of the instance", description = "Return the version of the instance") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = ReleaseInfosVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = ReleaseInfosVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ReleaseInfosVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = ReleaseInfosVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getReleaseInfos(@Context HttpServletRequest request) { if(!isAdminOrSystemAdmin(request)) { @@ -141,11 +130,10 @@ public class SystemWebService { @Path("monitoring") @Operation(summary = "Return the version of the instance", description = "Return the version of the instance") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = MonitoringWebService.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = MonitoringWebService.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MonitoringWebService.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = MonitoringWebService.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public MonitoringWebService getImplementedProbes(@Context HttpServletRequest request) { if(!isMonitoringEnabled() && !isAdminOrSystemAdmin(request)) { return null; @@ -155,11 +143,10 @@ public class SystemWebService { @Path("indexer") @Operation(summary = "Return the version of the instance", description = "Return the version of the instance") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = IndexerWebService.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = IndexerWebService.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = IndexerWebService.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = IndexerWebService.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public IndexerWebService getIndexer(@Context HttpServletRequest request) { if(!isAdminOrSystemAdmin(request)) { return null; @@ -169,11 +156,10 @@ public class SystemWebService { @Path("notifications") @Operation(summary = "Return the version of the instance", description = "Return the version of the instance") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of the instance", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = NotificationsAdminWebService.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = NotificationsAdminWebService.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The version of the instance", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = NotificationsAdminWebService.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = NotificationsAdminWebService.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public NotificationsAdminWebService getNotifications(@Context HttpServletRequest request) { if(!isAdminOrSystemAdmin(request)) { return null; diff --git a/src/main/java/org/olat/restapi/system/ThreadsWebService.java b/src/main/java/org/olat/restapi/system/ThreadsWebService.java index 05888505786..9ba7e7d5804 100644 --- a/src/main/java/org/olat/restapi/system/ThreadsWebService.java +++ b/src/main/java/org/olat/restapi/system/ThreadsWebService.java @@ -43,11 +43,8 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** - * - * <h3>Description:</h3> * * Initial Date: 21 juin 2010 <br> * @author srosse, stephane.rosse@frentix.com, www.frentix.com @@ -73,10 +70,9 @@ public class ThreadsWebService implements Sampler { @GET @Path("cpu") @Operation(summary = "Retrieve cpu info", description = "Retrieve cpu info") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The infos", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ThreadVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ThreadVO.class))) }) }) + @ApiResponse(responseCode = "200", description = "The infos", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ThreadVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ThreadVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public synchronized Response getThreadsCpu() { List<ThreadView> threadViews = CoreSpringFactory.getImpl(ThreadInfosManager.class).getThreadViews(); diff --git a/src/main/java/org/olat/restapi/system/vo/Examples.java b/src/main/java/org/olat/restapi/system/vo/Examples.java deleted file mode 100644 index 85d6c9a8db9..00000000000 --- a/src/main/java/org/olat/restapi/system/vo/Examples.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.restapi.system.vo; - -import java.util.Date; - -import org.olat.admin.sysinfo.model.DatabaseConnectionVO; - -/** - * - * Description:<br> - * Examples for the REST API documentation - * - * <P> - * Initial Date: 20 déc. 2011 <br> - * - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - */ -public class Examples { - - public static final SystemInfosVO SAMPLE_SYSTEMSUMMARYVO = new SystemInfosVO(); - public static final ClasseStatisticsVO SAMPLE_CLASSESVO = new ClasseStatisticsVO(); - public static final EnvironmentInformationsVO SAMPLE_ENVVO = new EnvironmentInformationsVO(); - public static final RuntimeStatisticsVO SAMPLE_RUNTIMEVO = new RuntimeStatisticsVO(); - public static final ClasseStatisticsVO SAMPLE_RUNTIME_CLASSESVO = new ClasseStatisticsVO(); - public static final ThreadStatisticsVO SAMPLE_RUNTIME_THREADSVO = new ThreadStatisticsVO(); - public static final MemoryStatisticsVO SAMPLE_RUNTIME_MEMORYVO = new MemoryStatisticsVO(); - - public static final DatabaseConnectionVO SAMPLE_DATABASE_CONNECTIONSVO = new DatabaseConnectionVO(); - public static final HibernateStatisticsVO SAMPLE_DATABASE_HIBERNATEVO = new HibernateStatisticsVO(); - public static final DatabaseVO SAMPLE_DATABASEVO = new DatabaseVO(); - - public static final OpenOLATStatisticsVO SAMPLE_OO_STATSVO = new OpenOLATStatisticsVO(); - public static final IndexerStatisticsVO SAMPLE_OO_INDEXERSTATSVO = new IndexerStatisticsVO(); - public static final RepositoryStatisticsVO SAMPLE_OO_REPOSTATSVO = new RepositoryStatisticsVO(); - public static final UserStatisticsVO SAMPLE_OO_USERSSTATSVO = new UserStatisticsVO(); - public static final SessionsVO SAMPLE_SESSIONVO = new SessionsVO(); - - public static final MonitoringInfosVO SAMPLE_MONITORINGCONFIGVO = new MonitoringInfosVO(); - - public static final MemoryVO SAMPLE_MEMORYVO = new MemoryVO(); - public static final ReleaseInfosVO SAMPLE_RELEASEVO = new ReleaseInfosVO(); - - static { - - SAMPLE_CLASSESVO.setLoadedClassCount(2345); - SAMPLE_CLASSESVO.setTotalLoadedClassCount(3947); - SAMPLE_CLASSESVO.setUnloadedClassCount(2939); - - SAMPLE_ENVVO.setArch("x86_64"); - SAMPLE_ENVVO.setAvailableProcessors(4); - SAMPLE_ENVVO.setOsName("Mac OS X"); - SAMPLE_ENVVO.setOsVersion("10.7.2"); - SAMPLE_ENVVO.setRuntimeName("15261@agam.local"); - SAMPLE_ENVVO.setVmName("Java HotSpot(TM) 64-Bit Server VM"); - SAMPLE_ENVVO.setVmVendor("Apple Inc."); - SAMPLE_ENVVO.setVmVersion("20.4-b02-402"); - - SAMPLE_RUNTIME_CLASSESVO.setLoadedClassCount(7000); - SAMPLE_RUNTIME_CLASSESVO.setTotalLoadedClassCount(8500); - SAMPLE_RUNTIME_CLASSESVO.setUnloadedClassCount(1500); - - SAMPLE_RUNTIME_THREADSVO.setDaemonCount(45); - SAMPLE_RUNTIME_THREADSVO.setPeakThreadCount(123); - SAMPLE_RUNTIME_THREADSVO.setThreadCount(102); - - SAMPLE_RUNTIME_MEMORYVO.setFreeMemory(45); - SAMPLE_RUNTIME_MEMORYVO.setTotalMemory(56); - SAMPLE_RUNTIME_MEMORYVO.setUsedMemory(12); - - SAMPLE_RUNTIMEVO.setStartTime(new Date()); - SAMPLE_RUNTIMEVO.setSystemLoadAverage(1.16748046875d); - SAMPLE_RUNTIMEVO.setUpTime(21248); - SAMPLE_RUNTIMEVO.setClasses(SAMPLE_RUNTIME_CLASSESVO); - SAMPLE_RUNTIMEVO.setMemory(SAMPLE_RUNTIME_MEMORYVO); - SAMPLE_RUNTIMEVO.setThreads(SAMPLE_RUNTIME_THREADSVO); - - SAMPLE_DATABASE_CONNECTIONSVO.setActiveConnectionCount(10); - SAMPLE_DATABASE_CONNECTIONSVO.setCurrentConnectionCount(25); - - SAMPLE_DATABASE_HIBERNATEVO.setFailedTransactionsCount(2); - SAMPLE_DATABASE_HIBERNATEVO.setOpenSessionsCount(12); - SAMPLE_DATABASE_HIBERNATEVO.setOptimisticFailureCount(23); - SAMPLE_DATABASE_HIBERNATEVO.setQueryExecutionCount(1237); - SAMPLE_DATABASE_HIBERNATEVO.setQueryExecutionMaxTime(12000); - SAMPLE_DATABASE_HIBERNATEVO.setQueryExecutionMaxTimeQueryString("select * from PLock"); - SAMPLE_DATABASE_HIBERNATEVO.setSuccessfulTransactionCount(13980); - SAMPLE_DATABASE_HIBERNATEVO.setTransactionsCount(13900); - - SAMPLE_DATABASEVO.setConnectionInfos(SAMPLE_DATABASE_CONNECTIONSVO); - SAMPLE_DATABASEVO.setHibernateStatistics(SAMPLE_DATABASE_HIBERNATEVO); - - SAMPLE_MEMORYVO.setDate(new Date()); - SAMPLE_MEMORYVO.setMaxAvailable(2000); - SAMPLE_MEMORYVO.setTotalMem(230); - SAMPLE_MEMORYVO.setTotalUsed(546); - - SAMPLE_SESSIONVO.setAuthenticatedCount(234); - SAMPLE_SESSIONVO.setCount(234); - SAMPLE_SESSIONVO.setInstantMessagingCount(123); - SAMPLE_SESSIONVO.setSecureAuthenticatedCount(234); - SAMPLE_SESSIONVO.setSecureWebdavCount(12); - SAMPLE_SESSIONVO.setWebdavCount(23); - - SAMPLE_MONITORINGCONFIGVO.setDescription("this is an OpenOLAT instance"); - SAMPLE_MONITORINGCONFIGVO.setType("openolat"); - SAMPLE_MONITORINGCONFIGVO.setProbes(new String[]{"Environment", "System", "Runtime", "Memory"}); - - MonitoringDependencyVO dep1 = new MonitoringDependencyVO(); - dep1.setType("openfire"); - dep1.setUrl("localhost"); - MonitoringDependencyVO dep2 = new MonitoringDependencyVO(); - dep2.setType("mysql"); - dep2.setUrl("192.168.1.120"); - SAMPLE_MONITORINGCONFIGVO.setDependencies(new MonitoringDependencyVO[] {dep1, dep2}); - - SAMPLE_RELEASEVO.setBuildVersion(""); - SAMPLE_RELEASEVO.setOlatVersion(""); - SAMPLE_RELEASEVO.setRepoRevision(""); - } -} diff --git a/src/main/java/org/olat/user/restapi/ContactsWebService.java b/src/main/java/org/olat/user/restapi/ContactsWebService.java index 2554e02f747..3adfe84b291 100644 --- a/src/main/java/org/olat/user/restapi/ContactsWebService.java +++ b/src/main/java/org/olat/user/restapi/ContactsWebService.java @@ -44,13 +44,9 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * - * Description:<br> - * - * <P> * Initial Date: 21 oct. 2011 <br> * * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com @@ -61,7 +57,7 @@ public class ContactsWebService { /** * Retrieve the contacts of the logged in identity. - * @response.representation.200.doc The list of contacts + * * @param start * @param limit * @param httpRequest The HTTP request @@ -69,10 +65,9 @@ public class ContactsWebService { */ @GET @Operation(summary = "Retrieve the contacts of the logged in identity", description = "Retrieve the contacts of the logged in identity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of contacts", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ContactVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ContactVO.class))) }) }) + @ApiResponse(responseCode = "200", description = "The list of contacts", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ContactVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ContactVO.class))) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMyContacts(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, diff --git a/src/main/java/org/olat/user/restapi/Examples.java b/src/main/java/org/olat/user/restapi/Examples.java deleted file mode 100644 index 79bae53c184..00000000000 --- a/src/main/java/org/olat/user/restapi/Examples.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ - -package org.olat.user.restapi; - -import java.util.Collections; - -/** - * - * Description:<br> - * - * <P> - * Initial Date: 26 oct. 2011 <br> - * - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - */ -public class Examples { - - public static final UserVO SAMPLE_USERVO = new UserVO(); - public static final UserVOes SAMPLE_USERVOes = new UserVOes(); - public static final RolesVO SAMPLE_ROLESVO = new RolesVO(); - public static final StatusVO SAMPLE_STATUSVO = new StatusVO(); - public static final PreferencesVO SAMPLE_PREFERENCESVO = new PreferencesVO(); - - public static final OrganisationVO SAMPLE_ORGANISATIONVO = new OrganisationVO(); - - public static final OrganisationTypeVO SAMPLE_ORGANISATIONTYPEVO = new OrganisationTypeVO(); - - public static final RelationRoleVO SAMPLE_RELATIONROLEVO = new RelationRoleVO(); - public static final IdentityToIdentityRelationVO SAMPLE_IDENTITYTOIDENTITYRELATIONVO = new IdentityToIdentityRelationVO(); - - static { - SAMPLE_USERVO.setKey(345l); - SAMPLE_USERVO.setFirstName("John"); - SAMPLE_USERVO.setLastName("Smith"); - SAMPLE_USERVO.setLogin("john"); - SAMPLE_USERVO.setEmail("john.smith@frentix.com"); - SAMPLE_USERVO.setPassword(""); - SAMPLE_USERVO.putProperty("telPrivate", "238456782"); - SAMPLE_USERVO.putProperty("telMobile", "238456782"); - SAMPLE_USERVOes.setUsers(new UserVO[]{SAMPLE_USERVO}); - - SAMPLE_ROLESVO.setAuthor(true); - - SAMPLE_STATUSVO.setStatus(Integer.valueOf(2)); - - SAMPLE_PREFERENCESVO.setLanguage("de"); - - SAMPLE_ORGANISATIONVO.setKey(4587L); - SAMPLE_ORGANISATIONVO.setIdentifier("HEROL-2"); - SAMPLE_ORGANISATIONVO.setDisplayName("Herol 2"); - SAMPLE_ORGANISATIONVO.setCssClass("o_icon_beautiful"); - SAMPLE_ORGANISATIONVO.setDescription("An organisation description"); - SAMPLE_ORGANISATIONVO.setExternalId("IDEXT78"); - SAMPLE_ORGANISATIONVO.setManagedFlagsString("all"); - SAMPLE_ORGANISATIONVO.setOrganisationTypeKey(38l); - SAMPLE_ORGANISATIONVO.setParentOrganisationKey(3l); - SAMPLE_ORGANISATIONVO.setRootOrganisationKey(1l); - - SAMPLE_ORGANISATIONTYPEVO.setKey(38l); - SAMPLE_ORGANISATIONTYPEVO.setIdentifier("OWL-1"); - SAMPLE_ORGANISATIONTYPEVO.setCssClass("o_icon_owl"); - SAMPLE_ORGANISATIONTYPEVO.setDescription("An organization type"); - SAMPLE_ORGANISATIONTYPEVO.setDisplayName("Organization type"); - SAMPLE_ORGANISATIONTYPEVO.setExternalId("OWL-1-ext"); - SAMPLE_ORGANISATIONTYPEVO.setManagedFlagsString("externalId"); - - SAMPLE_RELATIONROLEVO.setKey(56l); - SAMPLE_RELATIONROLEVO.setExternalId("RO-1"); - SAMPLE_RELATIONROLEVO.setExternalRef("ROR-2"); - SAMPLE_RELATIONROLEVO.setManagedFlags("delete"); - SAMPLE_RELATIONROLEVO.setRights(Collections.singletonList("myRight")); - - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setKey(234l); - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setExternalId("ID-2-ID-256"); - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setIdentitySourceKey(34019l); - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setIdentityTargetKey(23100l); - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setRelationRole("Supervisor"); - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setRelationRoleKey(23l); - SAMPLE_IDENTITYTOIDENTITYRELATIONVO.setManagedFlagsString("all"); - - } -} diff --git a/src/main/java/org/olat/user/restapi/IdentityToIdentityRelationsWebService.java b/src/main/java/org/olat/user/restapi/IdentityToIdentityRelationsWebService.java index 11f0d4b317d..b81d057bcae 100644 --- a/src/main/java/org/olat/user/restapi/IdentityToIdentityRelationsWebService.java +++ b/src/main/java/org/olat/user/restapi/IdentityToIdentityRelationsWebService.java @@ -49,7 +49,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * The access permission is done by UserWebService. @@ -76,22 +75,16 @@ public class IdentityToIdentityRelationsWebService { /** * List of relations from the specified user to others. * - * @response.representation.200.qname {http://www.example.com}identityToIdentityRelationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of relation from the specified user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_IDENTITYTOIDENTITYRELATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of relations */ @GET @Path("source") @Operation(summary = "List of relations from the specified user to others", description = "List of relations from the specified user to others") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of relation from the specified user", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The list of relation from the specified user", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRelationsAsSource() { List<IdentityToIdentityRelation> relations = identityRelationshipService.getRelationsAsSource(identity); @@ -102,22 +95,16 @@ public class IdentityToIdentityRelationsWebService { /** * List of relations to the specified user from others. * - * @response.representation.200.qname {http://www.example.com}identityToIdentityRelationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of relation to the specified user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_IDENTITYTOIDENTITYRELATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of relations */ @GET @Path("target") @Operation(summary = "List of relations to the specified user from others", description = "List of relations to the specified user from others") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of relation to the specified user", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The list of relation to the specified user", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = IdentityToIdentityRelationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRelationsAsTarget() { RelationSearchParams searchParams = new RelationSearchParams(); @@ -129,25 +116,16 @@ public class IdentityToIdentityRelationsWebService { /** * Creates and persists a new relation entity. * - * @response.representation.qname {http://www.example.com}identityToIdentityRelationVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The relation to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_IDENTITYTOIDENTITYRELATIONVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted relation - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_IDENTITYTOIDENTITYRELATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param relationRoleVo The relation to persist * @param request The HTTP request * @return The new persisted <code>relation</code> */ @PUT @Operation(summary = "Creates and persists a new relation entity", description = "Creates and persists a new relation entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The persisted relation", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The persisted relation", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putRelation(IdentityToIdentityRelationVO relationRoleVo) { @@ -157,25 +135,16 @@ public class IdentityToIdentityRelationsWebService { /** * Creates and persists a new relation entity. * - * @response.representation.qname {http://www.example.com}identityToIdentityRelationVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The relation to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_IDENTITYTOIDENTITYRELATIONVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted relation - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_IDENTITYTOIDENTITYRELATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param relationRoleVo The relation to persist * @param request The HTTP request * @return The new persisted <code>relation</code> */ @POST @Operation(summary = "Creates and persists a new relation entity", description = "Creates and persists a new relation entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The persisted relation", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The persisted relation", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = IdentityToIdentityRelationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postRelation(IdentityToIdentityRelationVO relationRoleVo) { @@ -189,17 +158,14 @@ public class IdentityToIdentityRelationsWebService { /** * Deletes a relation entity. * - * @response.representation.200.doc The relation - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param relationKey The relation to delete * @return Ok if the relation was deleted */ @DELETE @Path("{relationKey}") @Operation(summary = "Delete a relation entity", description = "Deletes a relation entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The relation"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The relation") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response deleteRelation(@PathParam("relationKey") Long relationKey) { IdentityToIdentityRelation relation = identityRelationshipService.getRelation(relationKey); if(relation == null) { diff --git a/src/main/java/org/olat/user/restapi/OrganisationTypesWebService.java b/src/main/java/org/olat/user/restapi/OrganisationTypesWebService.java index c23f95b95a2..4c0a44e2ce0 100644 --- a/src/main/java/org/olat/user/restapi/OrganisationTypesWebService.java +++ b/src/main/java/org/olat/user/restapi/OrganisationTypesWebService.java @@ -21,7 +21,6 @@ package org.olat.user.restapi; import static org.olat.restapi.security.RestSecurityHelper.getRoles; - import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -54,7 +53,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -72,21 +70,15 @@ public class OrganisationTypesWebService { /** * List of organizations types. * - * @response.representation.200.qname {http://www.example.com}organisationTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all organization types in the OpenOLAT system - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of organization types */ @GET @Operation(summary = "List of organizations types", description = "List of organizations types") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all organization types in the OpenOLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationTypeVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationTypeVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The list of all organization types in the OpenOLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationTypeVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationTypeVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOrganisations(@Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { @@ -101,27 +93,17 @@ public class OrganisationTypesWebService { /** * Creates and persists a new organization type entity. * - * @response.representation.qname {http://www.example.com}organisationTypeVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The organization type to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted organization type - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param organisationType The organization type to persist * @param request The HTTP request * @return The new persisted <code>organization type</code> */ @PUT @Operation(summary = "Creates and persists a new organization type entity", description = "Creates and persists a new organization type entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "Creates and persists a new organization type entity", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "Creates and persists a new organization type entity", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putOrganisationType(OrganisationTypeVO organisationType, @Context HttpServletRequest httpRequest) { @@ -135,27 +117,17 @@ public class OrganisationTypesWebService { /** * Updates a new organization type entity. * - * @response.representation.qname {http://www.example.com}organisationTypeVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The organization type to update - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged organization type - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param organisationType The organization type to merge * @param request The HTTP request * @return The merged <code>organization type</code> */ @POST @Operation(summary = "Updates a new organization type entity", description = "Updates a new organization type entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged organization type", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "The merged organization type", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postOrganisationType(OrganisationTypeVO organisationType, @Context HttpServletRequest httpRequest) { @@ -170,15 +142,6 @@ public class OrganisationTypesWebService { * Updates a new organization type entity. The primary key is taken from * the URL. The organization type object can be "primary key free". * - * @response.representation.qname {http://www.example.com}organisationTypeVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The organization type to update - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged type organization - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param organisationTypeKey The organization type primary key * @param organisationType The organization type to merge * @param request The HTTP request @@ -188,12 +151,11 @@ public class OrganisationTypesWebService { @Path("{organisationTypeKey}") @Operation(summary = "Updates a new organization type entity", description = "Updates a new organization type entity. The primary key is taken from\n" + " the URL. The organization type object can be \"primary key free\"") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged type organization", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "The merged type organization", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postOrganisation(@PathParam("organisationTypeKey") Long organisationTypeKey, OrganisationTypeVO organisationType, @@ -232,11 +194,6 @@ public class OrganisationTypesWebService { /** * Get a specific organization type. * - * @response.representation.200.qname {http://www.example.com}organisationTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The organization type - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param organisationTypeKey The organization type primary key * @param httpRequest The HTTP request * @return The organization @@ -244,11 +201,10 @@ public class OrganisationTypesWebService { @GET @Path("{organisationTypeKey}") @Operation(summary = "Get a specific organization type", description = "Get a specific organization type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The organization type", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The organization type", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOrganisations(@PathParam("organisationTypeKey") Long organisationTypeKey, @Context HttpServletRequest httpRequest) { @@ -267,24 +223,17 @@ public class OrganisationTypesWebService { /** * Get the allowed sub-types of a specified organization type. * - * @response.representation.200.qname {http://www.example.com}organisationTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc An array of organization types - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The organization type was not found * @param organisationTypeKey The organization type primary key * @param httpRequest The HTTP request * @return An array of organization types */ @GET @Operation(summary = "Get the allowed sub-types of a specified organization type", description = "Get the allowed sub-types of a specified organization type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "An array of organization types", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "401", description = "The organization type was not found")}) + @ApiResponse(responseCode = "200", description = "An array of organization types", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "401", description = "The organization type was not found") @Path("{organisationTypeKey}/allowedSubTypes") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getAllowedSubTypes(@PathParam("organisationTypeKey") Long organisationTypeKey, @Context HttpServletRequest httpRequest) { @@ -308,12 +257,6 @@ public class OrganisationTypesWebService { /** * Add a sub-type to a specified organization type. * - * @response.representation.200.qname {http://www.example.com}organisationTypeVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The sub type was added to the allowed sub types - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONTYPEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The organization type was not found * @param organisationTypeKey The type * @param subTypeKey The sub type * @param httpRequest The HTTP request @@ -322,12 +265,11 @@ public class OrganisationTypesWebService { @PUT @Path("{organisationTypeKey}/allowedSubTypes/{subTypeKey}") @Operation(summary = "Add a sub-type", description = "Add a sub-type to a specified organization type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The sub type was added to the allowed sub types", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "401", description = "The organization type was not found")}) + @ApiResponse(responseCode = "200", description = "The sub type was added to the allowed sub types", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationTypeVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationTypeVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "401", description = "The organization type was not found") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response allowSubTaxonomyLevelType(@PathParam("organisationTypeKey") Long organisationTypeKey, @PathParam("subTypeKey") Long subTypeKey, @Context HttpServletRequest httpRequest) { @@ -348,9 +290,6 @@ public class OrganisationTypesWebService { /** * Remove a sub-type to a specified organization type. * - * @response.representation.200.doc The sub type was removed successfully - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The organization type was not found * @param organisationTypeKey The type * @param subTypeKey The sub type to remove * @param httpRequest The HTTP request @@ -359,10 +298,9 @@ public class OrganisationTypesWebService { @DELETE @Path("{organisationTypeKey}/allowedSubTypes/{subTypeKey}") @Operation(summary = "Remove a sub-type", description = "Remove a sub-type to a specified organization type") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The sub type was removed successfully"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "401", description = "The organization type was not found")}) + @ApiResponse(responseCode = "200", description = "The sub type was removed successfully") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "401", description = "The organization type was not found") public Response disalloweSubTaxonomyLevelType(@PathParam("organisationTypeKey") Long organisationTypeKey, @PathParam("subTypeKey") Long subTypeKey, @Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { diff --git a/src/main/java/org/olat/user/restapi/OrganisationsWebService.java b/src/main/java/org/olat/user/restapi/OrganisationsWebService.java index 444d807a416..6e675e7b321 100644 --- a/src/main/java/org/olat/user/restapi/OrganisationsWebService.java +++ b/src/main/java/org/olat/user/restapi/OrganisationsWebService.java @@ -66,7 +66,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** * @@ -92,16 +91,13 @@ public class OrganisationsWebService { /** * The version of the User Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return The version number */ @GET @Path("version") @Operation(summary = "The version of the User Web Service", description = "The version of the User Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") }) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -111,21 +107,15 @@ public class OrganisationsWebService { /** * List of organizations flat. * - * @response.representation.200.qname {http://www.example.com}organisationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all organization in the OpenOLAT system - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of organizations */ @GET @Operation(summary = "List of organizations flat", description = "List of organizations flat") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all organization in the OpenOLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The list of all organization in the OpenOLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOrganisations(@Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { @@ -140,26 +130,16 @@ public class OrganisationsWebService { /** * Creates and persists a new organization entity. * - * @response.representation.qname {http://www.example.com}organisationVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The organization to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted organization - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param organisation The organization to persist * @param request The HTTP request * @return The new persisted <code>organization</code> */ @PUT @Operation(summary = "Creates and persists a new organization entity", description = "Creates and persists a new organization entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The persisted organization", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The persisted organization", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putOrganisation(OrganisationVO organisation, @Context HttpServletRequest httpRequest) { @@ -173,27 +153,17 @@ public class OrganisationsWebService { /** * Updates a new organization entity. * - * @response.representation.qname {http://www.example.com}organisationVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The organization to update - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged organization - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param organisation The organization to merge * @param request The HTTP request * @return The merged <code>organization</code> */ @POST @Operation(summary = "Updates a new organization entity", description = "Updates a new organization entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged organization", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "The merged organization", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postOrganisation(OrganisationVO organisation, @Context HttpServletRequest httpRequest) { @@ -207,11 +177,6 @@ public class OrganisationsWebService { /** * Get the organizations where the specified user has the role. * - * @response.representation.200.qname {http://www.example.com}organisationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of organizations - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param role The role in organizations * @param identityKey The user * @param withInheritance With or without inheritance in the organization structure (default with) @@ -221,11 +186,10 @@ public class OrganisationsWebService { @GET @Path("membership/{role}/{identityKey}") @Operation(summary = "Get the organizations", description = "Get the organizations where the specified user has the role") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of organizations", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The list of organizations", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMemberships(@PathParam("role") String role, @PathParam("identityKey") Long identityKey, @QueryParam("withInheritance") Boolean withInheritance, @Context HttpServletRequest httpRequest) { @@ -250,11 +214,6 @@ public class OrganisationsWebService { /** * Get a specific organization. * - * @response.representation.200.qname {http://www.example.com}organisationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all organization in the OpenOLAT system - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param organisationKey The organization primary key * @param httpRequest The HTTP request * @return The organization @@ -262,11 +221,10 @@ public class OrganisationsWebService { @GET @Path("{organisationKey}") @Operation(summary = "Get a specific organization", description = "Get a specific organization") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all organizations in the OpenOLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The list of all organizations in the OpenOLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = OrganisationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getOrganisation(@PathParam("organisationKey") Long organisationKey, @Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { @@ -281,11 +239,10 @@ public class OrganisationsWebService { @GET @Path("{organisationKey}/entries") @Operation(summary = "Get entries", description = "Get entries of a specific organization") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all entries in the organization system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The list of all entries in the organization system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RepositoryEntryVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRepositoryEntriesInOrganisation(@PathParam("organisationKey") Long organisationKey, @Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { @@ -304,15 +261,6 @@ public class OrganisationsWebService { * Updates a new organization entity. the primary key is taken from * the url. The organization object can be "primary key free". * - * @response.representation.qname {http://www.example.com}organisationVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The organization to update - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged organization - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ORGANISATIONVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param organisationKey The organization primary key * @param organisation The organization to merge * @param request The HTTP request @@ -322,11 +270,10 @@ public class OrganisationsWebService { @Path("{organisationKey}") @Operation(summary = "Updates a new organization entity", description = "Updates a new organization entity. the primary key is taken from\n" + " the url. The organization object can be \"primary key free\"") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged organization", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The merged organization", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postOrganisation(@PathParam("organisationKey") Long organisationKey, OrganisationVO organisation, @@ -395,13 +342,6 @@ public class OrganisationsWebService { /** * Get all members of the specified organisation with the specified role. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The array of members - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The organisation was not found - * @response.representation.409.doc The rolle is not valid * @param httpRequest The HTTP request * @return It returns an array of <code>UserVO</code> */ @@ -409,11 +349,10 @@ public class OrganisationsWebService { @Path("{organisationKey}/{role}") @Operation(summary = "Updates a new organization entity", description = "Updates a new organization entity. the primary key is taken from\n" + " the url. The organization object can be \"primary key free\"") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged organization", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The merged organization", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OrganisationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = OrganisationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public Response getMembers(@PathParam("organisationKey") Long organisationKey, @PathParam("role") String role, @Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { @@ -443,9 +382,6 @@ public class OrganisationsWebService { * Make the specified user a member of the specified organization * with the specified role. * - * @response.representation.200.doc The membership was added - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The organization or the identity was not found * @param organisationKey The organization primary key * @param role The role * @param identityKey The member to make a coach of @@ -456,10 +392,9 @@ public class OrganisationsWebService { @Path("{organisationKey}/{role}/{identityKey}") @Operation(summary = "Make the specified user a member of the specified organization", description = "Make the specified user a member of the specified organization\n" + " with the specified role") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The membership was added"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The organization or the identity was not found") }) + @ApiResponse(responseCode = "200", description = "The membership was added") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The organization or the identity was not found") public Response putMember(@PathParam("organisationKey") Long organisationKey, @PathParam("role") String role, @PathParam("identityKey") Long identityKey, @QueryParam("inheritanceMode") String inheritanceMode, @Context HttpServletRequest httpRequest) { @@ -494,14 +429,6 @@ public class OrganisationsWebService { /** * Add a membership to the specified curriculum element. * - * @response.representation.qname {http://www.example.com}curriculumElementMemberVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The curriculum element membership to persist - * @response.representation.example {@link org.olat.modules.curriculum.restapi.Examples#SAMPLE_CURRICULUMELEMENTMEMBERVO} - * @response.representation.200.doc The membership was persisted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The curriculum element or the identity was not found - * @response.representation.409.doc The role is not allowed * @param organisationKey The curriculum element primary key * @param role The membership informations * @return Nothing @@ -509,11 +436,10 @@ public class OrganisationsWebService { @PUT @Path("{organisationKey}/{role}") @Operation(summary = "Add a membership to the specified curriculum element", description = "Add a membership to the specified curriculum element") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The membership was persisted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found"), - @ApiResponse(responseCode = "409", description = "The role is not allowed")}) + @ApiResponse(responseCode = "200", description = "The membership was persisted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") + @ApiResponse(responseCode = "409", description = "The role is not allowed") public Response putMembers(@PathParam("organisationKey") Long organisationKey, @PathParam("role") String role, @QueryParam("inheritanceMode") String inheritanceMode, UserVO[] members, @Context HttpServletRequest httpRequest) { @@ -550,9 +476,6 @@ public class OrganisationsWebService { /** * Remove the membership of the identity from the specified organization and role. * - * @response.representation.200.doc The membership was removed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The organization or the identity was not found * @param curriculumElementKey The curriculum element primary key * @param identityKey The member to remove * @return Nothing @@ -560,10 +483,9 @@ public class OrganisationsWebService { @DELETE @Path("{organisationKey}/{role}/{identityKey}") @Operation(summary = "Remove the membership", description = "Remove the membership of the identity from the specified organization and role") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The membership was removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found")}) + @ApiResponse(responseCode = "200", description = "The membership was removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The curriculum element or the identity was not found") public Response deleteMember(@PathParam("organisationKey") Long organisationKey, @PathParam("role") String role, @PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { diff --git a/src/main/java/org/olat/user/restapi/RelationRolesWebService.java b/src/main/java/org/olat/user/restapi/RelationRolesWebService.java index 0438f2b1dc7..374b7c8193f 100644 --- a/src/main/java/org/olat/user/restapi/RelationRolesWebService.java +++ b/src/main/java/org/olat/user/restapi/RelationRolesWebService.java @@ -20,7 +20,6 @@ package org.olat.user.restapi; import java.util.Collections; - import java.util.List; import java.util.stream.Collectors; @@ -52,7 +51,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -73,16 +71,13 @@ public class RelationRolesWebService { /** * The version of the Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return The version number */ @GET @Path("version") @Operation(summary = "The version of the Web Service", description = "The version of the Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") }) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -91,22 +86,16 @@ public class RelationRolesWebService { /** * List of relation roles. * - * @response.representation.200.qname {http://www.example.com}relationRoleVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all relation roles in the OpenOLAT system - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param httpRequest The HTTP request * @return An array of organizations */ @GET @Path("roles") @Operation(summary = "List of relation roles", description = "List of relation roles") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all relation roles in the OpenOLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RelationRoleVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RelationRoleVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The list of all relation roles in the OpenOLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = RelationRoleVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = RelationRoleVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRoles(@Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { @@ -121,15 +110,6 @@ public class RelationRolesWebService { /** * Creates and persists a new relation role entity. * - * @response.representation.qname {http://www.example.com}relationRoleVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The relation role to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted relation role - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param relationRoleVo The relation role to persist * @param request The HTTP request * @return The new persisted <code>relation role</code> @@ -137,12 +117,11 @@ public class RelationRolesWebService { @PUT @Path("roles") @Operation(summary = "Creates and persists a new relation role entity", description = "Creates and persists a new relation role entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The persisted relation role", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RelationRoleVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RelationRoleVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "The persisted relation role", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RelationRoleVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RelationRoleVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response putRelationRole(RelationRoleVO relationRoleVo, @Context HttpServletRequest httpRequest) { @@ -156,15 +135,6 @@ public class RelationRolesWebService { /** * Updates a relation role entity. * - * @response.representation.qname {http://www.example.com}relationRoleVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The relation role to update - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged relation role - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param relationRoleVo The relation role to merge * @param request The HTTP request * @return The merged <code>relation role</code> @@ -172,12 +142,11 @@ public class RelationRolesWebService { @POST @Path("roles") @Operation(summary = "Update a relation role entity", description = "Updates a relation role entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged relation role", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RelationRoleVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RelationRoleVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "The merged relation role", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RelationRoleVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RelationRoleVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postRelationRole(RelationRoleVO relationRoleVo, @Context HttpServletRequest httpRequest) { @@ -191,15 +160,6 @@ public class RelationRolesWebService { /** * Updates a relation role entity. * - * @response.representation.qname {http://www.example.com}relationRoleVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The relation role to update - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The merged relation role - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_RELATIONROLEVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json * @param relationRoleVo The relation role to merge * @param request The HTTP request * @return The merged <code>relation role</code> @@ -207,12 +167,11 @@ public class RelationRolesWebService { @POST @Path("roles/{relationRoleKey}") @Operation(summary = "Update a relation role entity", description = "Updates a relation role entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The merged relation role", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RelationRoleVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RelationRoleVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "application/xml, application/json")}) + @ApiResponse(responseCode = "200", description = "The merged relation role", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RelationRoleVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RelationRoleVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "application/xml, application/json") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response postRelationRole(RelationRoleVO relationRoleVo, @PathParam("relationRoleKey") Long relationRoleKey, @@ -254,10 +213,9 @@ public class RelationRolesWebService { @DELETE @Path("roles/{relationRoleKey}") @Operation(summary = "Remove role", description = "Remove a role") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The role has been removed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "Role not found")}) + @ApiResponse(responseCode = "200", description = "The role has been removed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "Role not found") public Response deleteRelationRole(@PathParam("relationRoleKey") Long relationRoleKey, @Context HttpServletRequest httpRequest) { if(!isAdministrator(httpRequest)) { return Response.serverError().status(Status.UNAUTHORIZED).build(); diff --git a/src/main/java/org/olat/user/restapi/UserAuthenticationWebService.java b/src/main/java/org/olat/user/restapi/UserAuthenticationWebService.java index c696ca9202f..cf35ccf9b0f 100644 --- a/src/main/java/org/olat/user/restapi/UserAuthenticationWebService.java +++ b/src/main/java/org/olat/user/restapi/UserAuthenticationWebService.java @@ -21,7 +21,6 @@ package org.olat.user.restapi; import static org.olat.restapi.security.RestSecurityHelper.getIdentity; - import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -39,12 +38,12 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.apache.logging.log4j.Logger; import org.olat.basesecurity.Authentication; import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.OrganisationRoles; import org.olat.core.id.Identity; import org.olat.core.id.Roles; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.login.auth.OLATAuthManager; import org.olat.restapi.security.RestSecurityHelper; @@ -59,7 +58,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -83,16 +81,13 @@ public class UserAuthenticationWebService { /** * The version of the User Authentication Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return The version number */ @GET @Path("version") @Operation(summary = "The version of the User Authentication Web Service", description = "The version of the User Authentication Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") }) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -100,24 +95,18 @@ public class UserAuthenticationWebService { /** * Returns all user authentications - * @response.representation.200.qname {http://www.example.com}authenticationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all users in the OLAT system - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_AUTHVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param username The username of the user to retrieve authentication * @param request The HTTP request * @return */ @GET @Operation(summary = "Returns all user authentications", description = "Returns all user authentications") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all users in the OLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = AuthenticationVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = AuthenticationVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found") }) + @ApiResponse(responseCode = "200", description = "The list of all users in the OLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = AuthenticationVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = AuthenticationVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getAuthenticationTokenList(@PathParam("username") String username, @Context HttpServletRequest request) { Identity identity = securityManager.findIdentityByName(username); @@ -139,18 +128,7 @@ public class UserAuthenticationWebService { /** * Creates and persists an authentication - * @response.representation.qname {http://www.example.com}authenticationVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc An authentication to save - * @response.representation.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_AUTHVO} - * @response.representation.200.qname {http://www.example.com}authenticationVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The saved authentication - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_AUTHVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found - * @response.representation.406.doc Cannot create the authentication for an unkown reason - * @response.representation.409.doc Cannot create the authentication because the authentication username is already used by someone else within the same provider + * * @param username The username of the user * @param authenticationVO The authentication object to persist * @param request The HTTP request @@ -158,14 +136,13 @@ public class UserAuthenticationWebService { */ @PUT @Operation(summary = "Creates and persists an authentication", description = "Creates and persists an authentication") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The saved authentication", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = AuthenticationVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = AuthenticationVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found") , - @ApiResponse(responseCode = "406", description = "Cannot create the authentication for an unkown reason"), - @ApiResponse(responseCode = "409", description = "Cannot create the authentication because the authentication username is already used by someone else within the same provider") }) + @ApiResponse(responseCode = "200", description = "The saved authentication", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = AuthenticationVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = AuthenticationVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") + @ApiResponse(responseCode = "406", description = "Cannot create the authentication for an unkown reason") + @ApiResponse(responseCode = "409", description = "Cannot create the authentication because the authentication username is already used by someone else within the same provider") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response create(@PathParam("username") String username, AuthenticationVO authenticationVO, @Context HttpServletRequest request) { @@ -185,29 +162,25 @@ public class UserAuthenticationWebService { String credentials = authenticationVO.getCredential(); Authentication currentAuthentication = securityManager.findAuthenticationByAuthusername(authUsername, provider); - if(currentAuthentication != null) { - if(!currentAuthentication.getIdentity().equals(identity)) { - ErrorVO error = new ErrorVO(); - error.setCode("unkown:409"); - error.setTranslation("Authentication name used by: " + currentAuthentication.getIdentity().getUser().getEmail()); - return Response.serverError().status(Status.CONFLICT).entity(error).build(); - } + if(currentAuthentication != null && !currentAuthentication.getIdentity().equals(identity)) { + ErrorVO error = new ErrorVO(); + error.setCode("unkown:409"); + error.setTranslation("Authentication name used by: " + currentAuthentication.getIdentity().getUser().getEmail()); + return Response.serverError().status(Status.CONFLICT).entity(error).build(); } Authentication authentication = securityManager.createAndPersistAuthentication(identity, provider, authUsername, credentials, null); if(authentication == null) { return Response.serverError().status(Status.NOT_ACCEPTABLE).build(); } - log.info(Tracing.M_AUDIT, "New authentication created for " + authUsername + " with provider " + provider); + log.info(Tracing.M_AUDIT, "New authentication created for {} with provider {}", authUsername, provider); AuthenticationVO savedAuth = ObjectFactory.get(authentication, true); return Response.ok(savedAuth).build(); } /** * Deletes an authentication from the system - * @response.representation.200.doc The authentication successfully deleted - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the authentication not found + * * @param username The username of the user * @param authKey The authentication key identifier * @param request The HTTP request @@ -217,10 +190,9 @@ public class UserAuthenticationWebService { @DELETE @Path("{authKey}") @Operation(summary = "Deletes an authentication from the system", description = "Deletes an authentication from the system") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The authentication successfully deleted"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found") }) + @ApiResponse(responseCode = "200", description = "The authentication successfully deleted") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") public Response delete(@PathParam("username") String username, @PathParam("authKey") Long authKey, @Context HttpServletRequest request) { Identity identity = securityManager.findIdentityByName(username); if(identity == null) { @@ -243,10 +215,6 @@ public class UserAuthenticationWebService { /** * Change the password of a user. * - * @response.representation.200.doc The password successfully changed - * @response.representation.304.doc The password was not changed - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity or the authentication not found * @param username The username of the user to change the password * @param newPassword The new password * @param request The HTTP request @@ -255,11 +223,10 @@ public class UserAuthenticationWebService { @POST @Path("password") @Operation(summary = "Change the password of a user", description = "Change the password of a user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The password successfully changed"), - @ApiResponse(responseCode = "304", description = "The password was not changed"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity or the authentication not found") }) + @ApiResponse(responseCode = "200", description = "The password successfully changed") + @ApiResponse(responseCode = "304", description = "The password was not changed") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity or the authentication not found") public Response changePassword(@PathParam("username") String username, @FormParam("newPassword") String newPassword, @Context HttpServletRequest request) { Identity doer = getIdentity(request); diff --git a/src/main/java/org/olat/user/restapi/UserCoursesWebService.java b/src/main/java/org/olat/user/restapi/UserCoursesWebService.java index 1ebe8fa04c8..a5bcbe58ba4 100644 --- a/src/main/java/org/olat/user/restapi/UserCoursesWebService.java +++ b/src/main/java/org/olat/user/restapi/UserCoursesWebService.java @@ -20,7 +20,6 @@ package org.olat.user.restapi; import java.util.ArrayList; - import java.util.Collections; import java.util.List; @@ -35,9 +34,9 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; +import org.apache.logging.log4j.Logger; import org.olat.core.commons.persistence.DB; import org.olat.core.id.Identity; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.course.CourseFactory; import org.olat.course.ICourse; @@ -55,7 +54,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * @@ -79,11 +77,7 @@ public class UserCoursesWebService { /** * Retrieves the list of "My entries" but limited to courses. - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The courses - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param start The first result * @param limit Max result * @param httpRequest The HTTP request @@ -93,11 +87,10 @@ public class UserCoursesWebService { @GET @Path("my") @Operation(summary = "Retrieves the list of \"My entries\"", description = "Retrieves the list of \"My entries\" but limited to courses") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The courses", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The courses", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getMyCourses(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @Context HttpServletRequest httpRequest, @@ -121,11 +114,7 @@ public class UserCoursesWebService { /** * Retrieves the list of "My supervised courses" but limited to courses. - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The courses - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param start The first result * @param limit Max result * @param httpRequest The HTTP request @@ -135,11 +124,10 @@ public class UserCoursesWebService { @GET @Path("teached") @Operation(summary = "Retrieves the list of \"My supervised courses\"", description = "Retrieves the list of \"My supervised courses\" but limited to courses") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The courses", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The courses", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getTeachedCourses(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @Context HttpServletRequest httpRequest, @@ -163,11 +151,7 @@ public class UserCoursesWebService { /** * Retrieves the list of my favorite courses. - * @response.representation.200.qname {http://www.example.com}courseVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The courses - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSEVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param start The first result * @param limit Max result * @param httpRequest The HTTP request @@ -177,11 +161,10 @@ public class UserCoursesWebService { @GET @Path("favorite") @Operation(summary = "Retrieves the list of my favorite courses", description = "Retrieves the list of my favorite courses") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The courses", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The courses", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CourseVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getFavoritCourses(@QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @Context HttpServletRequest httpRequest, diff --git a/src/main/java/org/olat/user/restapi/UserFoldersWebService.java b/src/main/java/org/olat/user/restapi/UserFoldersWebService.java index f81bebf9a40..93f00b35328 100644 --- a/src/main/java/org/olat/user/restapi/UserFoldersWebService.java +++ b/src/main/java/org/olat/user/restapi/UserFoldersWebService.java @@ -75,13 +75,9 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; /** * - * Description:<br> - * - * <P> * Initial Date: 16 déc. 2011 <br> * * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com @@ -114,11 +110,7 @@ public class UserFoldersWebService { /** * Retrieves the folder of a group - * @response.representation.200.qname {http://www.example.com}fileVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The files - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_FILE} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param groupKey The key of the group * @param courseNodeId The key of the node if it's a course * @param httpRequest The HTTP request @@ -127,11 +119,10 @@ public class UserFoldersWebService { */ @Path("group/{groupKey}") @Operation(summary = "Retrieve the folder of a group", description = "Retrieves the folder of a group") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public VFSWebservice getGroupFolder(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) { if(groupKey == null) { throw new WebApplicationException( Response.serverError().status(Status.NOT_FOUND).build()); @@ -141,11 +132,7 @@ public class UserFoldersWebService { /** * Retrieves the folder of a course building block - * @response.representation.200.qname {http://www.example.com}fileVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The files - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_FILE} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param courseKey The key of the course * @param courseNodeId The key of the node * @param httpRequest The HTTP request @@ -154,11 +141,10 @@ public class UserFoldersWebService { */ @Path("course/{courseKey}/{courseNodeId}") @Operation(summary = "Retrieves the folder of a course building block", description = "Retrieves the folder of a course building block") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The files", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The files", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FileVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") public VFSWebservice getCourseFolder(@PathParam("courseKey") Long courseKey, @PathParam("courseNodeId") String courseNodeId, @Context HttpServletRequest request) { return new BCWebService().getVFSWebService(courseKey, courseNodeId, request); @@ -168,11 +154,7 @@ public class UserFoldersWebService { * Retrieves a list of folders on a user base. All folders of groups * where the user is participant/tutor + all folders in course where * the user is a participant (owner, tutor or participant) - * @response.representation.200.qname {http://www.example.com}folderVOes - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The folders - * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_FOLDERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient + * * @param identityKey The key of the user (IdentityImpl) * @param httpRequest The HTTP request * @return The folders @@ -181,11 +163,10 @@ public class UserFoldersWebService { @Operation(summary = "Retrieves a list of folders on a user base", description = "Retrieves a list of folders on a user base. All folders of groups \n" + " where the user is participant/tutor + all folders in course where\n" + " the user is a participant (owner, tutor or participant)") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The folders", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") }) + @ApiResponse(responseCode = "200", description = "The folders", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = FolderVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getFolders(@Context HttpServletRequest httpRequest) { diff --git a/src/main/java/org/olat/user/restapi/UserWebService.java b/src/main/java/org/olat/user/restapi/UserWebService.java index 63fc2c68ab0..3e28447897c 100644 --- a/src/main/java/org/olat/user/restapi/UserWebService.java +++ b/src/main/java/org/olat/user/restapi/UserWebService.java @@ -20,7 +20,6 @@ package org.olat.user.restapi; import static org.olat.restapi.security.RestSecurityHelper.getIdentity; - import static org.olat.restapi.security.RestSecurityHelper.getLocale; import static org.olat.restapi.security.RestSecurityHelper.getRoles; import static org.olat.restapi.security.RestSecurityHelper.getUserRequest; @@ -101,7 +100,6 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -143,16 +141,13 @@ public class UserWebService { /** * The version of the User Web Service - * @response.representation.200.mediaType text/plain - * @response.representation.200.doc The version of this specific Web Service - * @response.representation.200.example 1.0 + * * @return The version number */ @GET @Path("version") @Operation(summary = "The version of the User Web Service", description = "The version of the User Web Service") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The version of this specific Web Service")}) + @ApiResponse(responseCode = "200", description = "The version of this specific Web Service") @Produces(MediaType.TEXT_PLAIN) public Response getVersion() { return Response.ok(VERSION).build(); @@ -172,11 +167,6 @@ public class UserWebService { * <br >/ The lookup is possible for authors, usermanagers and system administrators. Normal * users are not allowed to use the lookup service. * - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The list of all users in the OLAT system - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVOes} - * @response.representation.401.doc The roles of the authenticated user are not sufficient * @param login The login (search with like) * @param authProvider An authentication provider (optional) * @param authUsername An specific username from the authentication provider @@ -197,11 +187,10 @@ public class UserWebService { " users?telMobile=39847592&login=test\n" + " <br >/ The lookup is possible for authors, usermanagers and system administrators. Normal\n" + " users are not allowed to use the lookup service.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The list of all users in the OLAT system", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "The list of all users in the OLAT system", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = UserVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getUserListQuery(@QueryParam("login") String login, @QueryParam("authProvider") String authProvider, @QueryParam("authUsername") String authUsername, @@ -270,11 +259,10 @@ public class UserWebService { @GET @Path("managed") @Operation(summary = "Get managed Users", description = "Get managed Users") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "List of all managed users", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ManagedUserVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ManagedUserVO.class))) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient")}) + @ApiResponse(responseCode = "200", description = "List of all managed users", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ManagedUserVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ManagedUserVO.class))) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getManagedUsers(@Context HttpServletRequest httpRequest) { if(!isUserManager(httpRequest)) { @@ -294,31 +282,20 @@ public class UserWebService { /** * Creates and persists a new user entity - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The user to persist - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVO} - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The persisted user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.406.mediaType application/xml, application/json - * @response.representation.406.doc The list of errors - * @response.representation.406.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ERRORVOes} + * * @param user The user to persist * @param request The HTTP request * @return the new persisted <code>User</code> */ @PUT @Operation(summary = "Creates and persists a new user entity", description = "Creates and persists a new user entity") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The persisted user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "406", description = "The list of errors", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))) })}) + @ApiResponse(responseCode = "200", description = "The persisted user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "406", description = "The list of errors", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))) }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response create(UserVO user, @Context HttpServletRequest request) { @@ -394,11 +371,7 @@ public class UserWebService { /** * Retrieves the roles of a user given its unique key identifier - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ROLESVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param identityKey The user key identifier of the user being searched * @param httpRequest The HTTP request * @return an xml or json representation of a the roles being search. @@ -427,11 +400,7 @@ public class UserWebService { /** * Update the roles of a user given its unique key identifier - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ROLESVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param identityKey The user key identifier of the user being searched * @param roles The updated roles * @param httpRequest The HTTP request @@ -440,12 +409,11 @@ public class UserWebService { @POST @Path("{identityKey}/roles") @Operation(summary = "Update the roles", description = "Update the roles of a user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = RolesVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = RolesVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RolesVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = RolesVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Consumes({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response updateRoles(@PathParam("identityKey") Long identityKey, RolesVO roles, @Context HttpServletRequest request) { @@ -473,12 +441,7 @@ public class UserWebService { /** * Retrieves the status of a user given its unique key identifier - * @response.representation.qname {http://www.example.com}statusVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_STATUSVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param identityKey The user key identifier of the user being searched * @param httpRequest The HTTP request * @return an xml or json representation of a the status being search. @@ -486,12 +449,11 @@ public class UserWebService { @GET @Path("{identityKey}/status") @Operation(summary = "Retrieve the status", description = "Retrieves the status of a user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = StatusVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = StatusVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = StatusVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = StatusVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response getStatus(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { boolean isUserManager = isUserManagerOf(identityKey, request); @@ -517,12 +479,6 @@ public class UserWebService { * <li>199: deleted</li> * </ul> * - * @response.representation.qname {http://www.example.com}statusVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_ROLESVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found * @param identityKey The user key identifier of the user being searched * @param status The status to update * @param httpRequest The HTTP request @@ -538,12 +494,11 @@ public class UserWebService { " <li>199: deleted</li> \n" + " </ul>\n" + " ") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = StatusVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = StatusVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = StatusVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = StatusVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Consumes({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response updateStatus(@PathParam("identityKey") Long identityKey, StatusVO status, @Context HttpServletRequest request) { @@ -566,11 +521,7 @@ public class UserWebService { /** * Retrieves the preferences of a user given its unique key identifier - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The preferences - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_PREFERENCESVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param identityKey The user key identifier of the user being searched * @param httpRequest The HTTP request * @return an xml or json representation of a the roles being search. @@ -578,12 +529,11 @@ public class UserWebService { @GET @Path("{identityKey}/preferences") @Operation(summary = "Retrieve the preferences", description = "Retrieves the preferences of a user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The preferences", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = PreferencesVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = PreferencesVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The preferences", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PreferencesVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = PreferencesVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response getUserPreferences(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { boolean isUserManager = isUserManagerOf(identityKey, request); @@ -602,11 +552,7 @@ public class UserWebService { /** * Update the preferences of a user given its unique key identifier - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_PREFERENCESVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param identityKey The user key identifier of the user being searched * @param preferences The updated preferences * @param httpRequest The HTTP request @@ -615,12 +561,11 @@ public class UserWebService { @POST @Path("{identityKey}/preferences") @Operation(summary = "Update the preferences", description = "Update the preferences of a user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = PreferencesVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = PreferencesVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PreferencesVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = PreferencesVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Consumes({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response updatePreferences(@PathParam("identityKey") Long identityKey, PreferencesVO preferences, @Context HttpServletRequest request) { @@ -654,11 +599,7 @@ public class UserWebService { /** * Retrieves an user given its unique key identifier - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found + * * @param identityKey The user key identifier of the user being searched * @param withPortrait If true return the portrait as Base64 (default false) * @param httpRequest The HTTP request @@ -669,12 +610,11 @@ public class UserWebService { @GET @Path("{identityKey}") @Operation(summary = "Retrieve a user", description = "Retrieves an user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") @Produces({MediaType.APPLICATION_XML ,MediaType.APPLICATION_JSON}) public Response findById(@PathParam("identityKey") Long identityKey, @QueryParam("withPortrait") @DefaultValue("false") Boolean withPortrait, @Context HttpServletRequest httpRequest) { @@ -690,10 +630,9 @@ public class UserWebService { @Path("{identityKey}/folders") @Operation(summary = "Retrieve folders", description = "Retrieves folders from a user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The folders"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The folders") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") public UserFoldersWebService getFoldersWebService(@PathParam("identityKey") Long identityKey) { Identity identity = securityManager.loadIdentityByKey(identityKey, false); if(identity == null) { @@ -704,10 +643,9 @@ public class UserWebService { @Path("{identityKey}/courses") @Operation(summary = "Retrieve courses", description = "Retrieves courses from a user given its unique key identifier") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The courses"), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found")}) + @ApiResponse(responseCode = "200", description = "The courses") + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") public UserCoursesWebService getCoursesWebService(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) { Identity identity = securityManager.loadIdentityByKey(identityKey, false); @@ -726,18 +664,15 @@ public class UserWebService { /** * Retrieves the portrait of an user - * @response.representation.200.mediaType application/octet-stream - * @response.representation.200.doc The portrait as image - * @response.representation.404.doc The identity or the portrait not found + * * @param identityKey The identity key of the user being searched * @return The image */ @HEAD @Path("{identityKey}/portrait") @Operation(summary = "Retrieves the portrait of an user", description = "Retrieves the portrait of an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The portrait as image"), - @ApiResponse(responseCode = "404", description = "The identity or the portrait not found")}) + @ApiResponse(responseCode = "200", description = "The portrait as image") + @ApiResponse(responseCode = "404", description = "The identity or the portrait not found") @Produces({"image/jpeg","image/jpg",MediaType.APPLICATION_OCTET_STREAM}) public Response getPortraitHead(@PathParam("identityKey") Long identityKey) { IdentityShort identity = securityManager.loadIdentityShortByKey(identityKey); @@ -756,18 +691,15 @@ public class UserWebService { /** * Retrieves the portrait of an user - * @response.representation.200.mediaType application/octet-stream - * @response.representation.200.doc The portrait as image - * @response.representation.404.doc The identity or the portrait not found + * * @param identityKey The identity key of the user being searched * @return The image */ @HEAD @Path("{identityKey}/portrait/{size}") @Operation(summary = "Retrieves the portrait of an user", description = "Retrieves the portrait of an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The portrait as image"), - @ApiResponse(responseCode = "404", description = "The identity or the portrait not found")}) + @ApiResponse(responseCode = "200", description = "The portrait as image") + @ApiResponse(responseCode = "404", description = "The identity or the portrait not found") @Produces({"image/jpeg","image/jpg",MediaType.APPLICATION_OCTET_STREAM}) public Response getOriginalPortraitHead(@PathParam("identityKey") Long identityKey, @PathParam("size") String size) { IdentityShort identity = securityManager.loadIdentityShortByKey(identityKey); @@ -793,9 +725,7 @@ public class UserWebService { /** * Retrieves the portrait of an user - * @response.representation.200.mediaType application/octet-stream - * @response.representation.200.doc The portrait as image - * @response.representation.404.doc The identity or the portrait not found + * * @param identityKey The identity key of the user being searched * @param request The REST request * @return The image @@ -803,9 +733,8 @@ public class UserWebService { @GET @Path("{identityKey}/portrait") @Operation(summary = "Retrieves the portrait of an user", description = "Retrieves the portrait of an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The portrait as image"), - @ApiResponse(responseCode = "404", description = "The identity or the portrait not found")}) + @ApiResponse(responseCode = "200", description = "The portrait as image") + @ApiResponse(responseCode = "404", description = "The identity or the portrait not found") @Produces({"image/jpeg","image/jpg",MediaType.APPLICATION_OCTET_STREAM}) public Response getPortrait(@PathParam("identityKey") Long identityKey, @Context Request request) { IdentityShort identity = securityManager.loadIdentityShortByKey(identityKey); @@ -828,10 +757,7 @@ public class UserWebService { /** * Upload the portrait of an user - * @response.representation.200.mediaType application/octet-stream - * @response.representation.200.doc The portrait as image - * @response.representation.401.doc Not authorized - * @response.representation.404.doc The identity or the portrait not found + * * @param identityKey The user key identifier of the user being searched * @param file The image * @param request The REST request @@ -840,10 +766,9 @@ public class UserWebService { @POST @Path("{identityKey}/portrait") @Operation(summary = "Upload the portrait of an user", description = "Upload the portrait of an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The portrait as image"), - @ApiResponse(responseCode = "401", description = "Not authorized"), - @ApiResponse(responseCode = "404", description = "The identity or the portrait not found")}) + @ApiResponse(responseCode = "200", description = "The portrait as image") + @ApiResponse(responseCode = "401", description = "Not authorized") + @ApiResponse(responseCode = "404", description = "The identity or the portrait not found") @Consumes({MediaType.MULTIPART_FORM_DATA}) public Response postPortrait(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { MultipartReader partsReader = null; @@ -871,8 +796,7 @@ public class UserWebService { /** * Deletes the portrait of an user - * @response.representation.200.doc The portrait deleted - * @response.representation.401.doc Not authorized + * * @param identityKey The identity key identifier of the user being searched * @param request The REST request * @return The image @@ -880,9 +804,8 @@ public class UserWebService { @DELETE @Path("{identityKey}/portrait") @Operation(summary = "Deletes the portrait of an user", description = "Deletes the portrait of an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The portrait deleted"), - @ApiResponse(responseCode = "401", description = "Not authorized")}) + @ApiResponse(responseCode = "200", description = "The portrait deleted") + @ApiResponse(responseCode = "401", description = "Not authorized") public Response deletePortrait(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { Identity authIdentity = getUserRequest(request).getIdentity(); Identity identity = securityManager.loadIdentityByKey(identityKey, false); @@ -909,20 +832,7 @@ public class UserWebService { /** * Update an user - * @response.representation.qname {http://www.example.com}userVO - * @response.representation.mediaType application/xml, application/json - * @response.representation.doc The user - * @response.representation.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVO} - * @response.representation.200.qname {http://www.example.com}userVO - * @response.representation.200.mediaType application/xml, application/json - * @response.representation.200.doc The user - * @response.representation.200.example {@link org.olat.user.restapi.Examples#SAMPLE_USERVO} - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found - * @response.representation.406.qname {http://www.example.com}errorVO - * @response.representation.406.mediaType application/xml, application/json - * @response.representation.406.doc The list of validation errors - * @response.representation.406.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_ERRORVOes} + * * @param identityKey The user key identifier * @param user The user datas * @param request The HTTP request @@ -931,15 +841,14 @@ public class UserWebService { @POST @Path("{identityKey}") @Operation(summary = "Update an user", description = "Update an user") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), - @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) }), - @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found"), - @ApiResponse(responseCode = "406", description = "The list of validation errors", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))), - @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))) })}) + @ApiResponse(responseCode = "200", description = "The user", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = UserVO.class)), + @Content(mediaType = "application/xml", schema = @Schema(implementation = UserVO.class)) }) + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") + @ApiResponse(responseCode = "406", description = "The list of validation errors", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = ErrorVO.class))) }) @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response update(@PathParam("identityKey") Long identityKey, UserVO user, @Context HttpServletRequest request) { @@ -1040,10 +949,7 @@ public class UserWebService { /** * Delete an user from the system - * @response.representation.200.doc The user is removed from the group - * @response.representation.401.doc The roles of the authenticated user are not sufficient - * @response.representation.404.doc The identity not found - * @response.representation.500.doc Unknown problem while deleting, see olat.log + * * @param identityKey The user key identifier * @param request The HTTP request * @return <code>Response</code> object. The operation status (success or fail) @@ -1051,11 +957,10 @@ public class UserWebService { @DELETE @Path("{identityKey}") @Operation(summary = "Delete an user from the system", description = "Delete an user from the system") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "The user is removed from the group"), - @ApiResponse(responseCode = "401", description = "he roles of the authenticated user are not sufficient"), - @ApiResponse(responseCode = "404", description = "The identity not found"), - @ApiResponse(responseCode = "500", description = "Unknown problem while deleting, see olat.log")}) + @ApiResponse(responseCode = "200", description = "The user is removed from the group") + @ApiResponse(responseCode = "401", description = "he roles of the authenticated user are not sufficient") + @ApiResponse(responseCode = "404", description = "The identity not found") + @ApiResponse(responseCode = "500", description = "Unknown problem while deleting, see olat.log") public Response delete(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest request) { Identity actingIdentity = getIdentity(request); if(actingIdentity == null || !isUserManagerOf(identityKey, request)) { -- GitLab