Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yanavasileva committed Jan 30, 2025
1 parent c5e11d8 commit 51bc9c9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.engine.rest.dto.repository;

import org.camunda.bpm.engine.rest.dto.VariableValueDto;
Expand All @@ -6,22 +22,22 @@
import java.util.Map;

public class DecisionEvaluationDto {
protected String decisionInstanceId;
protected List<Map<String, VariableValueDto>> result;
protected String decisionInstanceId;
protected List<Map<String, VariableValueDto>> result;

public String getDecisionInstanceId() {
return decisionInstanceId;
}
public String getDecisionInstanceId() {
return decisionInstanceId;
}

public void setDecisionInstanceId(String decisionInstanceId) {
this.decisionInstanceId = decisionInstanceId;
}
public void setDecisionInstanceId(String decisionInstanceId) {
this.decisionInstanceId = decisionInstanceId;
}

public List<Map<String, VariableValueDto>> getResult() {
return result;
}
public List<Map<String, VariableValueDto>> getResult() {
return result;
}

public void setResult(List<Map<String, VariableValueDto>> result) {
this.result = result;
}
public void setResult(List<Map<String, VariableValueDto>> result) {
this.result = result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public interface DecisionDefinitionResource {
@Produces(MediaType.APPLICATION_JSON)
List<Map<String, VariableValueDto>> evaluateDecision(@Context UriInfo context, EvaluateDecisionDto parameters);

//This api evaluates dmn decision and returns the associated decisionInstanceId in the response

@POST
@Path("/evaluate-with-id")
@Consumes(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public List<Map<String, VariableValueDto>> evaluateDecision(UriInfo context, Eva
}
}

@Override
public DecisionEvaluationDto evaluateDecisionWithId(UriInfo context, EvaluateDecisionDto parameters) {
DecisionService decisionService = engine.getDecisionService();

Expand All @@ -182,19 +183,15 @@ public DecisionEvaluationDto evaluateDecisionWithId(UriInfo context, EvaluateDec
response.setDecisionInstanceId(decisionResult.getDmnDecisionInstanceId());
return response;

}
catch (AuthorizationException e) {
} catch (AuthorizationException e) {
throw e;
}
catch (NotFoundException e) {
} catch (NotFoundException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.NOT_FOUND, e, errorMessage);
}
catch (NotValidException e) {
} catch (NotValidException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.BAD_REQUEST, e, errorMessage);
}
catch (ProcessEngineException|DmnEngineException e) {
} catch (ProcessEngineException | DmnEngineException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
Expand Down

0 comments on commit 51bc9c9

Please sign in to comment.