Skip to content

Commit

Permalink
[incubator-kie-issues#1249] Fix REST call in process-rest-workitem-qu…
Browse files Browse the repository at this point in the history
…arkus example (#1926)
  • Loading branch information
martinweiler committed May 23, 2024
1 parent dc96c74 commit 2f8e10e
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 31 deletions.
4 changes: 0 additions & 4 deletions kogito-quarkus-examples/process-rest-workitem-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@
package org.acme.travels.rest;

import org.acme.travels.User;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;

@Path("/v2")
@RegisterRestClient
public interface UsersRemoteService {
public class UserResource {

@Inject
UserService userService;

@GET
@Path("/user/{username}")
@Produces("application/json")
User get(@PathParam("username") String username);
public User getUser(@PathParam("username") String username) {
return userService.getUser(username);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.acme.travels.rest;

import org.acme.travels.User;

import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class UserService {

public User getUser(String name) {
if ("test".equals(name)) {
User user = new User();
user.setLastName(name);
return user;
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
# quarkus.package.type=fast-jar

quarkus.swagger-ui.always-include=true

org.acme.travels.rest.UsersRemoteService/mp-rest/url=https://petstore.swagger.io
org.acme.travels.rest.UsersRemoteService/mp-rest/scope=javax.enterprise.context.ApplicationScoped
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_1ztzQLGyEDmz-aPY8v7uEg" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_yBVmwPqbEDyfjZKSxf4Vqg" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">
<bpmn2:itemDefinition id="_travellerItem" structureRef="org.acme.travels.User"/>
<bpmn2:itemDefinition id="_usernameItem" structureRef="String"/>
<bpmn2:itemDefinition id="_E5D17755-D671-43ED-BD7D-F6538933069C_InMessageType"/>
<bpmn2:itemDefinition id="_E5D17755-D671-43ED-BD7D-F6538933069C_OutMessageType"/>
<bpmn2:itemDefinition id="__E5D17755-D671-43ED-BD7D-F6538933069C_ParameterInputXItem" structureRef="org.acme.travels.User"/>
<bpmn2:itemDefinition id="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_EndpointInputXItem" structureRef="String"/>
<bpmn2:itemDefinition id="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_UrlInputXItem" structureRef="String"/>
<bpmn2:itemDefinition id="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_usernameInputXItem" structureRef="String"/>
<bpmn2:itemDefinition id="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_PortInputXItem" structureRef="String"/>
<bpmn2:itemDefinition id="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_ResultOutputXItem" structureRef="java.lang.Object"/>
<bpmn2:message id="_E5D17755-D671-43ED-BD7D-F6538933069C_InMessage" itemRef="_E5D17755-D671-43ED-BD7D-F6538933069C_InMessageType"/>
<bpmn2:message id="_E5D17755-D671-43ED-BD7D-F6538933069C_OutMessage" itemRef="_E5D17755-D671-43ED-BD7D-F6538933069C_OutMessageType"/>
<bpmn2:interface id="_E5D17755-D671-43ED-BD7D-F6538933069C_ServiceInterface" name="org.acme.travels.services.AuditService" implementationRef="org.acme.travels.services.AuditService">
<bpmn2:operation id="_E5D17755-D671-43ED-BD7D-F6538933069C_ServiceOperation" name="auditUser" implementationRef="auditUser"/>
<bpmn2:operation id="_E5D17755-D671-43ED-BD7D-F6538933069C_ServiceOperation" name="auditUser" implementationRef="auditUser">
<bpmn2:inMessageRef>_E5D17755-D671-43ED-BD7D-F6538933069C_InMessage</bpmn2:inMessageRef>
<bpmn2:outMessageRef>_E5D17755-D671-43ED-BD7D-F6538933069C_OutMessage</bpmn2:outMessageRef>
</bpmn2:operation>
</bpmn2:interface>
<bpmn2:collaboration id="_C2F952AF-07EA-4F70-8DE1-3A50D544E83A" name="Default Collaboration">
<bpmn2:participant id="_566F32DE-B61E-4CBA-A56A-6F05C1FEB0B6" name="Pool Participant" processRef="users"/>
</bpmn2:collaboration>
<bpmn2:process id="users" drools:packageName="org.acme.travels" drools:version="1.0" drools:adHoc="false" name="users" isExecutable="true" processType="Public">
<bpmn2:property id="traveller" itemSubjectRef="_travellerItem" name="traveller"/>
<bpmn2:property id="username" itemSubjectRef="_usernameItem" name="username"/>
Expand All @@ -21,21 +33,21 @@
</drools:metaData>
</bpmn2:extensionElements>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="_4EFC11AE-52BB-4EEF-B241-CFAAE4B7AE93" name="Yes" sourceRef="_13BAF867-3CA8-4C6F-85C6-D3FD748D07D2" targetRef="_E5D17755-D671-43ED-BD7D-F6538933069C">
<bpmn2:sequenceFlow id="_BF17E37C-6984-4F27-9B6A-A9880E95B019" name="No" sourceRef="_13BAF867-3CA8-4C6F-85C6-D3FD748D07D2" targetRef="_95885F94-555D-485A-BB86-5E835B9C3389">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Yes]]></drools:metaValue>
<drools:metaValue><![CDATA[No]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="http://www.java.com/java"><![CDATA[return traveller != null;]]></bpmn2:conditionExpression>
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="http://www.java.com/java"><![CDATA[return traveller == null;]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="_BF17E37C-6984-4F27-9B6A-A9880E95B019" name="No" sourceRef="_13BAF867-3CA8-4C6F-85C6-D3FD748D07D2" targetRef="_95885F94-555D-485A-BB86-5E835B9C3389">
<bpmn2:sequenceFlow id="_4EFC11AE-52BB-4EEF-B241-CFAAE4B7AE93" name="Yes" sourceRef="_13BAF867-3CA8-4C6F-85C6-D3FD748D07D2" targetRef="_E5D17755-D671-43ED-BD7D-F6538933069C">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[No]]></drools:metaValue>
<drools:metaValue><![CDATA[Yes]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="http://www.java.com/java"><![CDATA[return traveller == null;]]></bpmn2:conditionExpression>
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="http://www.java.com/java"><![CDATA[return traveller != null;]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="_1A98DE32-CF81-424B-A59E-6D22899E31C0" sourceRef="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8" targetRef="_13BAF867-3CA8-4C6F-85C6-D3FD748D07D2"/>
<bpmn2:sequenceFlow id="_4EB288EA-3135-4B97-BB46-E77159F78832" sourceRef="_E5D17755-D671-43ED-BD7D-F6538933069C" targetRef="_FD4D7A19-558E-4347-8CFE-376792FEDA57">
Expand All @@ -57,37 +69,50 @@
<bpmn2:incoming>_DBA10C00-6407-4EF5-9D85-01177AE8F39F</bpmn2:incoming>
<bpmn2:outgoing>_1A98DE32-CF81-424B-A59E-6D22899E31C0</bpmn2:outgoing>
<bpmn2:ioSpecification>
<bpmn2:dataInput id="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_EndpointInputX" drools:dtype="String" itemSubjectRef="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_EndpointInputXItem" name="Url"/>
<bpmn2:dataInput id="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_UrlInputX" drools:dtype="String" itemSubjectRef="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_UrlInputXItem" name="Url"/>
<bpmn2:dataInput id="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_usernameInputX" drools:dtype="String" itemSubjectRef="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_usernameInputXItem" name="username"/>
<bpmn2:dataInput id="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_PortInputX" drools:dtype="String" itemSubjectRef="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_PortInputXItem" name="Port"/>
<bpmn2:dataInput id="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_TaskNameInputX" drools:dtype="Object" name="TaskName"/>
<bpmn2:dataOutput id="_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_ResultOutputX" drools:dtype="java.lang.Object" itemSubjectRef="__296CCA4D-3C70-469C-A10E-2FF421D4D7A8_ResultOutputXItem" name="Result"/>
<bpmn2:inputSet>
<bpmn2:dataInputRefs>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_EndpointInputX</bpmn2:dataInputRefs>
<bpmn2:dataInputRefs>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_UrlInputX</bpmn2:dataInputRefs>
<bpmn2:dataInputRefs>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_usernameInputX</bpmn2:dataInputRefs>
<bpmn2:dataInputRefs>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_PortInputX</bpmn2:dataInputRefs>
<bpmn2:dataInputRefs>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_TaskNameInputX</bpmn2:dataInputRefs>
</bpmn2:inputSet>
<bpmn2:outputSet>
<bpmn2:dataOutputRefs>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_ResultOutputX</bpmn2:dataOutputRefs>
</bpmn2:outputSet>
</bpmn2:ioSpecification>
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_EndpointInputX</bpmn2:targetRef>
<bpmn2:targetRef>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_UrlInputX</bpmn2:targetRef>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[/v2/user/{username}]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_EndpointInputX]]></bpmn2:to>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_UrlInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
<bpmn2:dataInputAssociation>
<bpmn2:sourceRef>username</bpmn2:sourceRef>
<bpmn2:targetRef>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_usernameInputX</bpmn2:targetRef>
</bpmn2:dataInputAssociation>
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_PortInputX</bpmn2:targetRef>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[8080]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_PortInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_TaskNameInputX</bpmn2:targetRef>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[Rest]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_TaskNameInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
<bpmn2:dataOutputAssociation>
<bpmn2:sourceRef>_296CCA4D-3C70-469C-A10E-2FF421D4D7A8_ResultOutputX</bpmn2:sourceRef>
<bpmn2:targetRef>traveller</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:task>
<bpmn2:startEvent id="_5A1A031B-CA99-4CB7-BC07-A730CE95D655" name="StartProcess">
<bpmn2:extensionElements>
Expand Down Expand Up @@ -131,8 +156,8 @@
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>_1A98DE32-CF81-424B-A59E-6D22899E31C0</bpmn2:incoming>
<bpmn2:outgoing>_BF17E37C-6984-4F27-9B6A-A9880E95B019</bpmn2:outgoing>
<bpmn2:outgoing>_4EFC11AE-52BB-4EEF-B241-CFAAE4B7AE93</bpmn2:outgoing>
<bpmn2:outgoing>_BF17E37C-6984-4F27-9B6A-A9880E95B019</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:endEvent id="_FD4D7A19-558E-4347-8CFE-376792FEDA57" name="Done">
<bpmn2:extensionElements>
Expand Down Expand Up @@ -171,15 +196,15 @@
<di:waypoint x="612" y="189"/>
<di:waypoint x="774" y="189"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__13BAF867-3CA8-4C6F-85C6-D3FD748D07D2_to_shape__E5D17755-D671-43ED-BD7D-F6538933069C" bpmnElement="_4EFC11AE-52BB-4EEF-B241-CFAAE4B7AE93">
<di:waypoint x="830" y="189"/>
<di:waypoint x="910" y="189"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__13BAF867-3CA8-4C6F-85C6-D3FD748D07D2_to_shape__95885F94-555D-485A-BB86-5E835B9C3389" bpmnElement="_BF17E37C-6984-4F27-9B6A-A9880E95B019">
<di:waypoint x="802" y="217"/>
<di:waypoint x="802" y="325"/>
<di:waypoint x="1144" y="325"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__13BAF867-3CA8-4C6F-85C6-D3FD748D07D2_to_shape__E5D17755-D671-43ED-BD7D-F6538933069C" bpmnElement="_4EFC11AE-52BB-4EEF-B241-CFAAE4B7AE93">
<di:waypoint x="830" y="189"/>
<di:waypoint x="910" y="189"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__5A1A031B-CA99-4CB7-BC07-A730CE95D655_to_shape__296CCA4D-3C70-469C-A10E-2FF421D4D7A8" bpmnElement="_DBA10C00-6407-4EF5-9D85-01177AE8F39F">
<di:waypoint x="460" y="189"/>
<di:waypoint x="612" y="138"/>
Expand Down Expand Up @@ -241,7 +266,7 @@
</bpsim:Scenario>
</bpsim:BPSimData>
</bpmn2:extensionElements>
<bpmn2:source>_1ztzQLGyEDmz-aPY8v7uEg</bpmn2:source>
<bpmn2:target>_1ztzQLGyEDmz-aPY8v7uEg</bpmn2:target>
<bpmn2:source>_yBVmwPqbEDyfjZKSxf4Vqg</bpmn2:source>
<bpmn2:target>_yBVmwPqbEDyfjZKSxf4Vqg</bpmn2:target>
</bpmn2:relationship>
</bpmn2:definitions>

0 comments on commit 2f8e10e

Please sign in to comment.