Skip to content

Commit

Permalink
[incubator-kie-issues-1522] Transition object to make extensible user…
Browse files Browse the repository at this point in the history
… task transition restendpoint
  • Loading branch information
elguardian committed Oct 8, 2024
1 parent 30cf1bd commit a8b57e6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.kie.kogito.usertask.model;

import java.util.Map;

public class TransitionInfo {

private String transitionId;

private Map<String, Object> data;

public Map<String, Object> getData() {
return data;
}

public void setData(Map<String, Object> data) {
this.data = data;
}

public String getTransitionId() {
return transitionId;
}

public void setTransitionId(String transitionId) {
this.transitionId = transitionId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public UserTaskView find(@PathParam("taskId") String taskId, @QueryParam("user")
@Produces(MediaType.APPLICATION_JSON)
public UserTaskView transition(
@PathParam("taskId") String taskId,
@QueryParam("transitionId") String transitionId,
@QueryParam("user") String user,
@QueryParam("group") List<String> groups, Map<String, Object> data) {
return userTaskService.transition(taskId, transitionId, data, IdentityProviders.of(user, groups)).orElseThrow(NotFoundException::new);
@QueryParam("group") List<String> groups,
TransitionInfo transitionInfo) {
return userTaskService.transition(taskId, transitionInfo.getTransitionId(), transitionInfo.getData(), IdentityProviders.of(user, groups)).orElseThrow(NotFoundException::new);
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public UserTaskView transition(
@RequestParam("transitionId") String transitionId,
@RequestParam("user") String user,
@RequestParam("group") List<String> groups,
@RequestBody Map<String, Object> data) {
return userTaskService.transition(taskId, transitionId, data, IdentityProviders.of(user, groups)).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND));
@RequestBody TransitionInfo transitionInfo) {
return userTaskService.transition(taskId, transitionInfo.getTransitionId(), transitionInfo.getData(), IdentityProviders.of(user, groups)).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND));
}

@GetMapping(value = "/{taskId}/transition", produces = MediaType.APPLICATION_JSON_VALUE)
Expand Down

0 comments on commit a8b57e6

Please sign in to comment.