Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.9.0'
Browse files Browse the repository at this point in the history
* release/0.9.0:
  prepare release 0.9.0
  add missing test, change .keep to readme files, log questionnaire-response pretty
  move user-task to its own process, update to dsf 0.9.0
  update to dsf 0.9.0-SNAPSHOT, add display type
  add url type to questionnaire
  remove not needed extension element
  log user task after execution
  use default user task listener, move url and version to form key
  update to dsf version 0.8.0-SNAPSHOT
  adds taskHelper to user task
  improve questionnaire with more types
  update to dsf 0.7.0, improve questionnaire
  • Loading branch information
wetret committed Oct 24, 2022
2 parents 511118f + ff2146c commit ddbfa37
Show file tree
Hide file tree
Showing 24 changed files with 530 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dsf-bpe-process-hello-world/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-example-processes-pom</artifactId>
<version>0.6.0</version>
<version>0.9.0</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@

public interface ConstantsHelloWorld
{
String PROCESS_NAME_HELLO_WORLD = "helloWorld";
String PROCESS_NAME_FULL_HELLO_WORLD = "highmedorg_" + PROCESS_NAME_HELLO_WORLD;

String PROCESS_NAME_HELLO_USER = "helloUser";
String PROCESS_NAME_FULL_HELLO_USER = "highmedorg_" + PROCESS_NAME_HELLO_USER;

String PROFILE_HIGHMED_TASK_HELLO_WORLD = "http://highmed.org/fhir/StructureDefinition/task-hello-world";
String PROFILE_HIGHMED_TASK_HELLO_WORLD_AND_LATEST_VERSION = "http://highmed.org/fhir/StructureDefinition/task-hello-world"
+ "|" + VERSION;
String PROFILE_HIGHMED_TASK_HELLO_WORLD_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "helloWorld/";
String PROFILE_HIGHMED_TASK_HELLO_WORLD_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_HELLO_WORLD + "|" + VERSION;
String PROFILE_HIGHMED_TASK_HELLO_WORLD_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + PROCESS_NAME_HELLO_WORLD + "/";
String PROFILE_HIGHMED_TASK_HELLO_WORLD_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_HELLO_WORLD_PROCESS_URI
+ VERSION;
String PROFILE_HIGHMED_TASK_HELLO_WORLD_MESSAGE_NAME = "helloWorldMessage";
String PROFILE_HIGHMED_TASK_HELLO_WORLD_MESSAGE_NAME = "helloWorld";

String PROFILE_HIGHMED_TASK_HELLO_USER = "http://highmed.org/fhir/StructureDefinition/task-hello-user";
String PROFILE_HIGHMED_TASK_HELLO_USER_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_HELLO_USER + "|" + VERSION;
String PROFILE_HIGHMED_TASK_HELLO_USER_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + PROCESS_NAME_HELLO_USER + "/";
String PROFILE_HIGHMED_TASK_HELLO_USER_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_HELLO_USER_PROCESS_URI
+ VERSION;
String PROFILE_HIGHMED_TASK_HELLO_USER_MESSAGE_NAME = "helloUser";
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.highmed.dsf.bpe;

import static org.highmed.dsf.bpe.ConstantsHelloWorld.PROCESS_NAME_FULL_HELLO_USER;
import static org.highmed.dsf.bpe.ConstantsHelloWorld.PROCESS_NAME_FULL_HELLO_WORLD;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
Expand All @@ -9,6 +12,7 @@
import org.highmed.dsf.bpe.spring.config.HelloWorldConfig;
import org.highmed.dsf.fhir.resources.AbstractResource;
import org.highmed.dsf.fhir.resources.ActivityDefinitionResource;
import org.highmed.dsf.fhir.resources.QuestionnaireResource;
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
import org.springframework.core.env.PropertyResolver;
Expand All @@ -17,13 +21,13 @@

public class HelloWorldProcessPluginDefinition implements ProcessPluginDefinition
{
public static final String VERSION = "0.6.0";
public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10);
public static final String VERSION = "0.9.0";
public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 10, 24);

@Override
public String getName()
{
return "dsf-bpe-process-hello-world";
return "dsf-bpe-process-hello-world-and-user";
}

@Override
Expand All @@ -41,7 +45,7 @@ public LocalDate getReleaseDate()
@Override
public Stream<String> getBpmnFiles()
{
return Stream.of("bpe/helloWorld.bpmn");
return Stream.of("bpe/helloWorld.bpmn", "bpe/helloUser.bpmn");
}

@Override
Expand All @@ -54,11 +58,17 @@ public Stream<Class<?>> getSpringConfigClasses()
public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
PropertyResolver resolver)
{
var aHelloUser = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-helloUser.xml");
var aHelloWorld = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-helloWorld.xml");

var qHelloWorld = QuestionnaireResource.file("fhir/Questionnaire/highmed-questionnaire-hello-user.xml");

var tHelloUser = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-hello-user.xml");
var tHelloWorld = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-hello-world.xml");

Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("highmedorg_helloWorld/" + VERSION,
Arrays.asList(aHelloWorld, tHelloWorld));
Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of(
PROCESS_NAME_FULL_HELLO_USER + "/" + VERSION, Arrays.asList(aHelloUser, qHelloWorld, tHelloUser),
PROCESS_NAME_FULL_HELLO_WORLD + "/" + VERSION, Arrays.asList(aHelloWorld, tHelloWorld));

return ResourceProvider.read(VERSION, RELEASE_DATE,
() -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`message` package typically used for implementing task message send events
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public HelloWorld(FhirWebserviceClientProvider clientProvider, TaskHelper taskHe
}

@Override
public void doExecute(DelegateExecution execution) throws Exception
public void doExecute(DelegateExecution execution)
{
Task task = getCurrentTaskFromExecutionVariables();
Task task = getCurrentTaskFromExecutionVariables(execution);
logger.info("Hello World from organization with identifier '{}'",
task.getRequester().getIdentifier().getValue());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.highmed.dsf.bpe.service;

import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_QUESTIONNAIRE_RESPONSE_COMPLETED;

import java.util.Objects;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.QuestionnaireResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;

import ca.uhn.fhir.context.FhirContext;

public class LogUserTaskResponse extends AbstractServiceDelegate implements InitializingBean
{
private static final Logger logger = LoggerFactory.getLogger(LogUserTaskResponse.class);

private final FhirContext fhirContext;

public LogUserTaskResponse(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
ReadAccessHelper readAccessHelper, FhirContext fhirContext)
{
super(clientProvider, taskHelper, readAccessHelper);
this.fhirContext = fhirContext;
}

@Override
public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
Objects.requireNonNull(fhirContext, "fhirContext");
}

@Override
protected void doExecute(DelegateExecution execution)
{
QuestionnaireResponse questionnaireResponse = (QuestionnaireResponse) execution
.getVariable(BPMN_EXECUTION_VARIABLE_QUESTIONNAIRE_RESPONSE_COMPLETED);

logger.info("Completed QuestionnaireResponse: {}",
fhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(questionnaireResponse));
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package org.highmed.dsf.bpe.spring.config;

import org.highmed.dsf.bpe.service.HelloWorld;
import org.highmed.dsf.bpe.service.LogUserTaskResponse;
import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import ca.uhn.fhir.context.FhirContext;

@Configuration
public class HelloWorldConfig
{
Expand All @@ -20,9 +23,18 @@ public class HelloWorldConfig
@Autowired
private ReadAccessHelper readAccessHelper;

@Autowired
private FhirContext fhirContext;

@Bean
public HelloWorld helloWorld()
{
return new HelloWorld(clientProvider, taskHelper, readAccessHelper);
}

@Bean
public LogUserTaskResponse logUserTaskResponse()
{
return new LogUserTaskResponse(clientProvider, taskHelper, readAccessHelper, fhirContext);
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`variable` package typically used for implementing custom BPMN variable serializers
54 changes: 54 additions & 0 deletions dsf-bpe-process-hello-world/src/main/resources/bpe/helloUser.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0">
<bpmn:process id="highmedorg_helloUser" isExecutable="true" camunda:versionTag="#{version}">
<bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="userTask" />
<bpmn:endEvent id="EndEvent_0xd0x8k">
<bpmn:incoming>Flow_034bfq7</bpmn:incoming>
</bpmn:endEvent>
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_0bbhq2r</bpmn:outgoing>
<bpmn:messageEventDefinition messageRef="Message_1nn2wdw" />
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_00nx7hv" sourceRef="userTask" targetRef="logUserTaskRespose" />
<bpmn:userTask id="userTask" name="User Task" camunda:formKey="http://highmed.org/fhir/Questionnaire/hello-user|#{version}">
<bpmn:incoming>SequenceFlow_0bbhq2r</bpmn:incoming>
<bpmn:outgoing>Flow_00nx7hv</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_034bfq7" sourceRef="logUserTaskRespose" targetRef="EndEvent_0xd0x8k" />
<bpmn:serviceTask id="logUserTaskRespose" name="log user task respose" camunda:class="org.highmed.dsf.bpe.service.LogUserTaskResponse">
<bpmn:incoming>Flow_00nx7hv</bpmn:incoming>
<bpmn:outgoing>Flow_034bfq7</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmn:message id="Message_1nn2wdw" name="helloUser" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_helloUser">
<bpmndi:BPMNEdge id="Flow_034bfq7_di" bpmnElement="Flow_034bfq7">
<di:waypoint x="520" y="121" />
<di:waypoint x="612" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_00nx7hv_di" bpmnElement="Flow_00nx7hv">
<di:waypoint x="360" y="121" />
<di:waypoint x="420" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0bbhq2r_di" bpmnElement="SequenceFlow_0bbhq2r">
<di:waypoint x="188" y="121" />
<di:waypoint x="260" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0xd0x8k_di" bpmnElement="EndEvent_0xd0x8k">
<dc:Bounds x="612" y="103" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_06hqzi2_di" bpmnElement="userTask">
<dc:Bounds x="260" y="81" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1kldjfh_di" bpmnElement="logUserTaskRespose">
<dc:Bounds x="420" y="81" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0x5gijn_di" bpmnElement="StartEvent_1">
<dc:Bounds x="152" y="103" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0">
<bpmn:process id="highmedorg_helloWorld" isExecutable="true" camunda:versionTag="#{version}">
<bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="helloWorldTask" />
<bpmn:endEvent id="EndEvent_0xd0x8k">
Expand All @@ -15,26 +15,26 @@
<bpmn:messageEventDefinition messageRef="Message_1nn2wdw" />
</bpmn:startEvent>
</bpmn:process>
<bpmn:message id="Message_1nn2wdw" name="helloWorldMessage" />
<bpmn:message id="Message_1nn2wdw" name="helloWorld" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_helloWorld">
<bpmndi:BPMNEdge id="SequenceFlow_0oyvmcd_di" bpmnElement="SequenceFlow_0oyvmcd">
<di:waypoint x="365" y="121" />
<di:waypoint x="415" y="121" />
<di:waypoint x="422" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0bbhq2r_di" bpmnElement="SequenceFlow_0bbhq2r">
<di:waypoint x="215" y="121" />
<di:waypoint x="265" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0xd0x8k_di" bpmnElement="EndEvent_0xd0x8k">
<dc:Bounds x="415" y="103" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0um3ad2_di" bpmnElement="helloWorldTask">
<dc:Bounds x="265" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0x5gijn_di" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="103" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0xd0x8k_di" bpmnElement="EndEvent_0xd0x8k">
<dc:Bounds x="422" y="103" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<ActivityDefinition xmlns="http://hl7.org/fhir">
<meta>
<tag>
<system value="http://highmed.org/fhir/CodeSystem/read-access-tag" />
<code value="ALL" />
</tag>
</meta>
<extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization">
<extension url="message-name">
<valueString value="helloUser" />
</extension>
<extension url="task-profile">
<valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-hello-user|#{version}" />
</extension>
<extension url="requester">
<valueCoding>
<system value="http://highmed.org/fhir/CodeSystem/process-authorization" />
<code value="LOCAL_ALL" />
</valueCoding>
</extension>
<extension url="recipient">
<valueCoding>
<system value="http://highmed.org/fhir/CodeSystem/process-authorization" />
<code value="LOCAL_ALL" />
</valueCoding>
</extension>
</extension>
<url value="http://highmed.org/bpe/Process/helloUser" />
<!-- version managed by bpe -->
<version value="#{version}" />
<name value="HelloUser" />
<title value="Hello User" />
<subtitle value="Example Template Process as template for implementation of novel processes with user-tasks" />
<!-- status managed by bpe -->
<status value="unknown" />
<experimental value="false" />
<!-- date managed by bpe -->
<date value="#{date}" />
<publisher value="HiGHmed" />
<contact>
<name value="HiGHmed" />
<telecom>
<system value="email" />
<value value="[email protected]" />
</telecom>
</contact>
<description value="Example process as template for implementation of novel processes with user-tasks" />
<kind value="Task" />
</ActivityDefinition>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</meta>
<extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization">
<extension url="message-name">
<valueString value="helloWorldMessage" />
<valueString value="helloWorld" />
</extension>
<extension url="task-profile">
<valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-hello-world|#{version}" />
Expand Down
Loading

0 comments on commit ddbfa37

Please sign in to comment.