Skip to content

Commit

Permalink
Let swagger no the HTTP response codes for WorkflowInstanceResource
Browse files Browse the repository at this point in the history
  • Loading branch information
gmokki committed Nov 29, 2014
1 parent 4ead68c commit 2169f66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public int insertWorkflowInstance(WorkflowInstance instance) {
* Update the workflow instance in the database if it is currently not running, and insert the workflow instance action if not null.
* @param instance The instance to be updated.
* @param action The action to be inserted. Can be null.
* @return True if the update was successful, false otherwise.
* @return True if the update was successful, false otherwise.
*/
@Transactional
public boolean updateWorkflowInstance(WorkflowInstance instance, WorkflowInstanceAction action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;

@Path("/v1/workflow-instance")
@Consumes(APPLICATION_JSON)
Expand All @@ -66,6 +68,7 @@ public WorkflowInstanceResource(

@PUT
@ApiOperation(value = "Submit new workflow instance", response = CreateWorkflowInstanceResponse.class)
@ApiResponse(code = 201, message = "Workflow was created")
public Response createWorkflowInstance(@Valid CreateWorkflowInstanceRequest req) {
WorkflowInstance instance = createWorkflowConverter.convertAndValidate(req);
int id = workflowInstances.insertWorkflowInstance(instance);
Expand All @@ -76,6 +79,8 @@ public Response createWorkflowInstance(@Valid CreateWorkflowInstanceRequest req)
@PUT
@Path("/{id}")
@ApiOperation(value = "Update workflow instance state")
@ApiResponses({ @ApiResponse(code = 204, message = "If update was sucessful"),
@ApiResponse(code = 409, message = "If workflow was executing and no update was done") })
public Response updateWorkflowInstance(
@ApiParam("Internal id for workflow instance")
@PathParam("id") int id,
Expand Down

0 comments on commit 2169f66

Please sign in to comment.