diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/workflow/WorkflowResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/workflow/WorkflowResource.java index 7df87cebd624..3591b8416944 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/workflow/WorkflowResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/workflow/WorkflowResource.java @@ -100,6 +100,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.ExternalDocumentation; @@ -185,6 +186,13 @@ externalDocs = @ExternalDocumentation(description = "Additional Workflow API information", url = "https://www.dotcms.com/docs/latest/workflow-rest-api") ) +@ApiResponses( + value = { // error codes only! + @ApiResponse(responseCode = "401", description = "Invalid User"), // not logged in + @ApiResponse(responseCode = "403", description = "Forbidden"), // no permission + @ApiResponse(responseCode = "500", description = "Internal Server Error") // + } +) public class WorkflowResource { public final static String VERSION = "1.0"; @@ -284,10 +292,7 @@ public WorkflowResource() { schema = @Schema(implementation = ResponseEntityWorkflowSchemesView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow scheme not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow scheme not found") } ) public final Response findSchemes(@Context final HttpServletRequest request, @@ -345,10 +350,7 @@ public final Response findSchemes(@Context final HttpServletRequest request, content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseEntityWorkflowActionletsView.class) ) - ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + ) } ) public final Response findActionlets(@Context final HttpServletRequest request) { @@ -424,10 +426,7 @@ public final Response findActionlets(@Context final HttpServletRequest request) ) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response findActionletsByAction(@Context final HttpServletRequest request, @@ -481,10 +480,7 @@ public final Response findActionletsByAction(@Context final HttpServletRequest r schema = @Schema(implementation = SchemesAndSchemesContentTypeView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Content type ID not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Content type ID not found") } ) public final Response findAllSchemesAndSchemesByContentType( @@ -542,10 +538,7 @@ public final Response findAllSchemesAndSchemesByContentType( schema = @Schema(implementation = ResponseEntityWorkflowStepsView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow scheme not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow scheme not found") } ) public final Response findStepsByScheme(@Context final HttpServletRequest request, @@ -603,10 +596,7 @@ public final Response findStepsByScheme(@Context final HttpServletRequest reques schema = @Schema(implementation = ResponseEntityWorkflowActionsView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Contentlet not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Contentlet not found") } ) public final Response findAvailableActions(@Context final HttpServletRequest request, @@ -747,10 +737,7 @@ private static List createActionInputViews (final WorkflowActio schema = @Schema(implementation = ResponseEntityBulkActionView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response getBulkActions(@Context final HttpServletRequest request, @@ -815,10 +802,7 @@ public final Response getBulkActions(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityBulkActionsResultView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final void fireBulkActions(@Context final HttpServletRequest request, @@ -880,10 +864,7 @@ public final void fireBulkActions(@Context final HttpServletRequest request, schema = @Schema(implementation = EventOutput.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public EventOutput fireBulkActions(@Context final HttpServletRequest request, @@ -979,10 +960,7 @@ public EventOutput fireBulkActions(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityWorkflowActionView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response findAction(@Context final HttpServletRequest request, @@ -1034,10 +1012,7 @@ public final Response findAction(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityStringView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response evaluateActionCondition( @@ -1088,10 +1063,7 @@ public final Response evaluateActionCondition( schema = @Schema(implementation = ResponseEntityWorkflowActionView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found within specified step"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found within specified step") } ) public final Response findActionByStep(@Context final HttpServletRequest request, @@ -1149,10 +1121,7 @@ public final Response findActionByStep(@Context final HttpServletRequest request schema = @Schema(implementation = ResponseEntityWorkflowActionsView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow step not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow step not found") } ) public final Response findActionsByStep(@Context final HttpServletRequest request, @@ -1202,10 +1171,7 @@ public final Response findActionsByStep(@Context final HttpServletRequest reques schema = @Schema(implementation = ResponseEntityWorkflowActionsView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow scheme not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow scheme not found") } ) public final Response findActionsByScheme(@Context final HttpServletRequest request, @@ -1256,10 +1222,7 @@ public final Response findActionsByScheme(@Context final HttpServletRequest requ schema = @Schema(implementation = ResponseEntityWorkflowActionsView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response findActionsBySchemesAndSystemAction(@Context final HttpServletRequest request, @@ -1336,10 +1299,7 @@ public final Response findActionsBySchemesAndSystemAction(@Context final HttpSer schema = @Schema(implementation = ResponseEntitySystemActionWorkflowActionMappings.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow scheme not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow scheme not found") } ) public final Response findSystemActionsByScheme(@Context final HttpServletRequest request, @@ -1390,10 +1350,7 @@ public final Response findSystemActionsByScheme(@Context final HttpServletReques schema = @Schema(implementation = ResponseEntitySystemActionWorkflowActionMappings.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Content Type not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Content Type not found") } ) public final Response findSystemActionsByContentType(@Context final HttpServletRequest request, @@ -1446,10 +1403,7 @@ public final Response findSystemActionsByContentType(@Context final HttpServletR schema = @Schema(implementation = ResponseEntitySystemActionWorkflowActionMappings.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response getSystemActionsReferredByWorkflowAction(@Context final HttpServletRequest request, @@ -1512,10 +1466,7 @@ public final Response getSystemActionsReferredByWorkflowAction(@Context final Ht schema = @Schema(implementation = ResponseEntityBulkActionsResultView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response saveSystemAction(@Context final HttpServletRequest request, @@ -1593,10 +1544,7 @@ public final Response saveSystemAction(@Context final HttpServletRequest request schema = @Schema(implementation = ResponseEntitySystemActionWorkflowActionMapping.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response deletesSystemAction(@Context final HttpServletRequest request, @@ -1651,10 +1599,7 @@ public final Response deletesSystemAction(@Context final HttpServletRequest requ schema = @Schema(implementation = ResponseEntityWorkflowActionView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response saveAction(@Context final HttpServletRequest request, @@ -1744,10 +1689,7 @@ public final Response saveAction(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityWorkflowActionView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response updateAction(@Context final HttpServletRequest request, @@ -1864,10 +1806,7 @@ public final Response updateAction(@Context final HttpServletRequest request, ) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response saveActionToStep(@Context final HttpServletRequest request, @@ -1969,10 +1908,7 @@ public final Response saveActionToStep(@Context final HttpServletRequest request ) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response saveActionletToAction(@Context final HttpServletRequest request, @@ -2045,10 +1981,7 @@ public final Response saveActionletToAction(@Context final HttpServletRequest re schema = @Schema(implementation = ResponseEntityWorkflowStepView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final void deleteStep(@Context final HttpServletRequest request, @@ -2096,10 +2029,7 @@ public final void deleteStep(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityStringView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response deleteAction(@Context final HttpServletRequest request, @@ -2154,10 +2084,7 @@ public final Response deleteAction(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityStringView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response deleteAction(@Context final HttpServletRequest request, @@ -2209,10 +2136,7 @@ public final Response deleteAction(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityStringView.class) ) ), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "404", description = "Workflow action not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Workflow action not found") } ) public final Response deleteActionlet(@Context final HttpServletRequest request, @@ -2274,10 +2198,7 @@ public final Response deleteActionlet(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityStringView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response reorderStep(@Context final HttpServletRequest request, @@ -2334,10 +2255,7 @@ public final Response reorderStep(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityWorkflowStepView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response updateStep(@Context final HttpServletRequest request, @@ -2405,10 +2323,7 @@ public final Response updateStep(@Context final HttpServletRequest request, schema = @Schema(implementation = ResponseEntityWorkflowStepView.class) ) ), - @ApiResponse(responseCode = "400", description = "Bad request"), - @ApiResponse(responseCode = "401", description = "Invalid User"), - @ApiResponse(responseCode = "403", description = "Forbidden"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "400", description = "Bad request") } ) public final Response addStep(@Context final HttpServletRequest request, @@ -2471,10 +2386,7 @@ public final Response addStep(@Context final HttpServletRequest request, ) ), @ApiResponse(responseCode = "400", description = "Bad request"), // invalid param string like `\` - @ApiResponse(responseCode = "401", description = "Invalid User"), // not logged in - @ApiResponse(responseCode = "403", description = "Forbidden"), // no permission - @ApiResponse(responseCode = "405", description = "Method Not Allowed"), // if param string blank - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "405", description = "Method Not Allowed") // if param string blank } ) public final Response findStepById(@Context final HttpServletRequest request, @@ -2527,10 +2439,7 @@ public final Response findStepById(@Context final HttpServletRequest request, ) ), @ApiResponse(responseCode = "400", description = "Bad request"), // invalid param string like `\` - @ApiResponse(responseCode = "401", description = "Invalid User"), // not logged in - @ApiResponse(responseCode = "403", description = "Forbidden"), // no permission - @ApiResponse(responseCode = "404", description = "Content not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Content not found") } ) public final Response fireActionByNameMultipartNewPath(@Context final HttpServletRequest request, @@ -2672,10 +2581,7 @@ public final Response fireActionByNameMultipart(@Context final HttpServletReques ) ), @ApiResponse(responseCode = "400", description = "Bad request"), // invalid param string like `\` - @ApiResponse(responseCode = "401", description = "Invalid User"), // not logged in - @ApiResponse(responseCode = "403", description = "Forbidden"), // no permission - @ApiResponse(responseCode = "404", description = "Content not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Content not found") } ) public final Response fireActionByNameSinglePart(@Context final HttpServletRequest request, @@ -2945,10 +2851,7 @@ private boolean needSave (final FireActionForm fireActionForm) { ) ), @ApiResponse(responseCode = "400", description = "Bad request"), // invalid param string like `\` - @ApiResponse(responseCode = "401", description = "Invalid User"), // not logged in - @ApiResponse(responseCode = "403", description = "Forbidden"), // no permission - @ApiResponse(responseCode = "404", description = "Content not found"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Content not found") } ) public final Response fireActionDefaultSinglePart(@Context final HttpServletRequest request, @@ -3215,11 +3118,7 @@ public final Response fireActionDefaultSinglePart(@Context final HttpServletRequ ) ), @ApiResponse(responseCode = "400", description = "Bad request"), // invalid param string like `\` - @ApiResponse(responseCode = "401", description = "Invalid User"), // not logged in - @ApiResponse(responseCode = "403", description = "Forbidden"), // no permission - @ApiResponse(responseCode = "404", description = "Content not found"), - @ApiResponse(responseCode = "406", description = "Not acceptable"), - @ApiResponse(responseCode = "500", description = "Internal Server Error") + @ApiResponse(responseCode = "404", description = "Content not found") } ) public final Response fireMultipleActionDefault(@Context final HttpServletRequest request, @@ -3510,11 +3409,7 @@ private void saveMultipleContentletsByDefaultAction(final List