Skip to content

Commit 1bbc572

Browse files
committed
Merge remote-tracking branch
'origin/issues/1_Upgrade_to_New_Process_Plugin_API' into develop
2 parents b7b1576 + ee8a298 commit 1bbc572

20 files changed

+317
-343
lines changed

pom.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
<groupId>dev.dsf</groupId>
88
<artifactId>dsf-process-allow-list</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>1.0.0.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<compileSource>17</compileSource>
1515
<compileTarget>17</compileTarget>
1616

17-
<dsf.version>1.0.0-SNAPSHOT</dsf.version>
17+
<dsf.version>1.0.0-M1</dsf.version>
1818
<dsf.location>../dsf</dsf.location>
1919
</properties>
2020

@@ -39,7 +39,7 @@
3939
<dependencies>
4040
<dependency>
4141
<groupId>dev.dsf</groupId>
42-
<artifactId>dsf-bpe-process-base</artifactId>
42+
<artifactId>dsf-bpe-process-api-v1</artifactId>
4343
<version>${dsf.version}</version>
4444
<scope>provided</scope>
4545
</dependency>
@@ -54,7 +54,7 @@
5454
<!-- testing -->
5555
<dependency>
5656
<groupId>dev.dsf</groupId>
57-
<artifactId>dsf-bpe-process-base</artifactId>
57+
<artifactId>dsf-bpe-process-api-v1</artifactId>
5858
<version>${dsf.version}</version>
5959
<scope>test</scope>
6060
<type>test-jar</type>
@@ -175,9 +175,6 @@
175175
<id>github</id>
176176
<name>GitHub DSF Apache Maven Packages</name>
177177
<url>https://maven.pkg.github.com/datasharingframework/dsf</url>
178-
<releases>
179-
<enabled>true</enabled>
180-
</releases>
181178
<snapshots>
182179
<enabled>true</enabled>
183180
</snapshots>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package dev.dsf.bpe;
2+
3+
import java.time.LocalDate;
4+
import java.util.Arrays;
5+
import java.util.List;
6+
import java.util.Map;
7+
8+
import dev.dsf.bpe.spring.config.AllowListConfig;
9+
import dev.dsf.bpe.v1.ProcessPluginDefinition;
10+
11+
public class AllowListProcessPluginDefinition implements ProcessPluginDefinition
12+
{
13+
public static final String VERSION = "1.0.0.0";
14+
public static final LocalDate RELEASE_DATE = LocalDate.of(2023, 5, 20);
15+
16+
@Override
17+
public String getName()
18+
{
19+
return "dsf-process-allow-list";
20+
}
21+
22+
@Override
23+
public String getVersion()
24+
{
25+
return VERSION;
26+
}
27+
28+
@Override
29+
public LocalDate getReleaseDate()
30+
{
31+
return RELEASE_DATE;
32+
}
33+
34+
@Override
35+
public List<String> getProcessModels()
36+
{
37+
return List.of("bpe/updateAllowList.bpmn", "bpe/downloadAllowList.bpmn");
38+
}
39+
40+
@Override
41+
public List<Class<?>> getSpringConfigurations()
42+
{
43+
return List.of(AllowListConfig.class);
44+
}
45+
46+
@Override
47+
public Map<String, List<String>> getFhirResourcesByProcessId()
48+
{
49+
var c = "fhir/CodeSystem/dsf-allow-list.xml";
50+
51+
var aDown = "fhir/ActivityDefinition/dsf-downloadAllowList.xml";
52+
var aUp = "fhir/ActivityDefinition/dsf-updateAllowList.xml";
53+
54+
var sDown = "fhir/StructureDefinition/dsf-task-download-allow-list.xml";
55+
var sUp = "fhir/StructureDefinition/dsf-task-update-allow-list.xml";
56+
57+
var v = "fhir/ValueSet/dsf-allow-list.xml";
58+
59+
return Map.of(ConstantsAllowList.PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST, Arrays.asList(c, aDown, sDown, v),
60+
ConstantsAllowList.PROCESS_NAME_FULL_UPDATE_ALLOW_LIST, Arrays.asList(c, aUp, sUp, v));
61+
}
62+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package dev.dsf.bpe;
2+
3+
public interface ConstantsAllowList
4+
{
5+
String PROCESS_NAME_DOWNLOAD_ALLOW_LIST = "downloadAllowList";
6+
String PROCESS_NAME_UPDATE_ALLOW_LIST = "updateAllowList";
7+
8+
String PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST = "dsfdev_" + PROCESS_NAME_DOWNLOAD_ALLOW_LIST;
9+
String PROCESS_NAME_FULL_UPDATE_ALLOW_LIST = "dsfdev_" + PROCESS_NAME_UPDATE_ALLOW_LIST;
10+
11+
String CODESYSTEM_DSF_ALLOW_LIST = "http://dsf.dev/fhir/CodeSystem/allow-list";
12+
String CODESYSTEM_DSF_ALLOW_LIST_VALUE_ALLOW_LIST = "allow_list";
13+
14+
String PROCESS_DSF_URI_BASE = "http://dsf.dev/bpe/Process/";
15+
16+
String PROFILE_DSF_TASK_DOWNLOAD_ALLOW_LIST = "http://dsf.dev/fhir/StructureDefinition/task-download-allow-list";
17+
String PROFILE_DSF_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_DOWNLOAD_ALLOW_LIST;
18+
String PROFILE_DSF_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME = "downloadAllowListMessage";
19+
20+
String PROFILE_DSF_TASK_UPDATE_ALLOW_LIST = "http://dsf.dev/fhir/StructureDefinition/task-update-allow-list";
21+
String PROFILE_DSF_TASK_UPDATE_ALLOW_LIST_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_UPDATE_ALLOW_LIST;
22+
String PROFILE_DSF_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME = "updateAllowListMessage";
23+
}

src/main/java/dev/dsf/bpe/ConstantsUpdateAllowList.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/dev/dsf/bpe/UpdateAllowListProcessPluginDefinition.java

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/main/java/dev/dsf/bpe/service/DownloadAllowList.java

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.EnumSet;
44
import java.util.List;
5-
import java.util.Objects;
65

76
import org.camunda.bpm.engine.delegate.DelegateExecution;
87
import org.hl7.fhir.r4.model.Bundle;
@@ -13,42 +12,28 @@
1312
import org.slf4j.Logger;
1413
import org.slf4j.LoggerFactory;
1514

16-
import ca.uhn.fhir.context.FhirContext;
17-
import dev.dsf.bpe.ConstantsUpdateAllowList;
18-
import dev.dsf.bpe.delegate.AbstractServiceDelegate;
19-
import dev.dsf.fhir.authorization.read.ReadAccessHelper;
15+
import dev.dsf.bpe.ConstantsAllowList;
16+
import dev.dsf.bpe.v1.ProcessPluginApi;
17+
import dev.dsf.bpe.v1.activity.AbstractServiceDelegate;
18+
import dev.dsf.bpe.v1.variables.Variables;
2019
import dev.dsf.fhir.client.FhirWebserviceClient;
21-
import dev.dsf.fhir.client.FhirWebserviceClientProvider;
22-
import dev.dsf.fhir.task.TaskHelper;
2320
import jakarta.ws.rs.WebApplicationException;
2421

2522
public class DownloadAllowList extends AbstractServiceDelegate
2623
{
2724
private static final Logger logger = LoggerFactory.getLogger(DownloadAllowList.class);
2825

29-
private final FhirContext context;
30-
31-
public DownloadAllowList(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
32-
ReadAccessHelper readAccessHelper, FhirContext context)
26+
public DownloadAllowList(ProcessPluginApi api)
3327
{
34-
super(clientProvider, taskHelper, readAccessHelper);
35-
36-
this.context = context;
28+
super(api);
3729
}
3830

3931
@Override
40-
public void afterPropertiesSet() throws Exception
32+
protected void doExecute(DelegateExecution execution, Variables variables) throws Exception
4133
{
42-
super.afterPropertiesSet();
43-
Objects.requireNonNull(context, "fhirContext");
44-
}
45-
46-
@Override
47-
protected void doExecute(DelegateExecution execution) throws Exception
48-
{
49-
Task task = getCurrentTaskFromExecutionVariables(execution);
34+
Task task = variables.getStartTask();
5035
IdType bundleId = getBundleId(task);
51-
FhirWebserviceClient requesterClient = getFhirWebserviceClientProvider()
36+
FhirWebserviceClient requesterClient = api.getFhirWebserviceClientProvider()
5237
.getWebserviceClient(bundleId.getBaseUrl());
5338

5439
Bundle bundle;
@@ -75,8 +60,9 @@ protected void doExecute(DelegateExecution execution) throws Exception
7560

7661
try
7762
{
78-
logger.debug("Posting bundle to local endpoint: {}", context.newXmlParser().encodeResourceToString(bundle));
79-
getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().postBundle(bundle);
63+
logger.debug("Posting bundle to local endpoint: {}",
64+
api.getFhirContext().newXmlParser().encodeResourceToString(bundle));
65+
api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().postBundle(bundle);
8066
}
8167
catch (Exception e)
8268
{
@@ -89,28 +75,26 @@ protected void doExecute(DelegateExecution execution) throws Exception
8975

9076
private IdType getBundleId(Task task)
9177
{
92-
List<Reference> bundleReferences = getTaskHelper()
93-
.getInputParameterReferenceValues(task, ConstantsUpdateAllowList.CODESYSTEM_DSF_UPDATE_ALLOW_LIST,
94-
ConstantsUpdateAllowList.CODESYSTEM_DSF_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST)
78+
List<Reference> bundleReferences = api.getTaskHelper()
79+
.getInputParameterValues(task, ConstantsAllowList.CODESYSTEM_DSF_ALLOW_LIST,
80+
ConstantsAllowList.CODESYSTEM_DSF_ALLOW_LIST_VALUE_ALLOW_LIST, Reference.class)
9581
.toList();
9682

9783
if (bundleReferences.size() != 1)
9884
{
9985
logger.error("Task input parameter {} contains unexpected number of Bundle IDs, expected 1, got {}",
100-
ConstantsUpdateAllowList.CODESYSTEM_DSF_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST,
101-
bundleReferences.size());
86+
ConstantsAllowList.CODESYSTEM_DSF_ALLOW_LIST_VALUE_ALLOW_LIST, bundleReferences.size());
10287
throw new RuntimeException(
103-
"Task input parameter " + ConstantsUpdateAllowList.CODESYSTEM_DSF_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST
88+
"Task input parameter " + ConstantsAllowList.CODESYSTEM_DSF_ALLOW_LIST_VALUE_ALLOW_LIST
10489
+ " contains unexpected number of Bundle IDs, expected 1, got " + bundleReferences.size());
10590
}
10691
else if (!bundleReferences.get(0).hasReference()
10792
|| !bundleReferences.get(0).getReference().contains("/Bundle/"))
10893
{
10994
logger.error("Task input parameter {} has no Bundle reference",
110-
ConstantsUpdateAllowList.CODESYSTEM_DSF_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST);
111-
throw new RuntimeException(
112-
"Task input parameter " + ConstantsUpdateAllowList.CODESYSTEM_DSF_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST
113-
+ " has no Bundle reference");
95+
ConstantsAllowList.CODESYSTEM_DSF_ALLOW_LIST_VALUE_ALLOW_LIST);
96+
throw new RuntimeException("Task input parameter "
97+
+ ConstantsAllowList.CODESYSTEM_DSF_ALLOW_LIST_VALUE_ALLOW_LIST + " has no Bundle reference");
11498
}
11599

116100
return new IdType(bundleReferences.get(0).getReference());

0 commit comments

Comments
 (0)