Skip to content

Commit 0858fb9

Browse files
committed
more updates in constants, use constants as well in tests
1 parent 69d473c commit 0858fb9

File tree

26 files changed

+474
-347
lines changed

26 files changed

+474
-347
lines changed

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.highmed.dsf.bpe.message;
22

33
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
4-
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE;
4+
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR;
55

66
import java.util.stream.Stream;
77

@@ -34,7 +34,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut
3434
.getReference();
3535

3636
Task.ParameterComponent input = getTaskHelper()
37-
.createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE,
37+
.createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
3838
"An error occurred while calculating the multi medic feasibility result for "
3939
+ "all defined cohorts, see task with url='" + taskUrl + "'");
4040
return Stream.of(input);

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.highmed.dsf.bpe.message;
22

33
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
4-
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE;
4+
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR;
55

66
import java.util.List;
77
import java.util.stream.Stream;
@@ -76,7 +76,7 @@ private Stream<ParameterComponent> getErrorInput(DelegateExecution execution)
7676
task.getIdElement().getIdPart())).getReference();
7777

7878
Task.ParameterComponent input = getTaskHelper()
79-
.createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE,
79+
.createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
8080
"Errors occurred for missing cohorts while calculating their multi medic feasibility "
8181
+ "result, see task with url='" + taskUrl + "'");
8282
return Stream.of(input);
@@ -89,6 +89,6 @@ private boolean hasErrorOutput(List<Task.TaskOutputComponent> outputs)
8989
{
9090
return outputs.stream().anyMatch(output -> output.getType().getCoding().stream().anyMatch(
9191
coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_BPMN) && coding.getCode()
92-
.equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE)));
92+
.equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR)));
9393
}
9494
}

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ private void addFinalFeasibilityQueryErrorsToLeadingTask(Task toRead, Task toWri
4949
toRead.getInput().stream()
5050
.filter(in -> in.hasType() && in.getType().hasCoding() && ConstantsBase.CODESYSTEM_HIGHMED_BPMN
5151
.equals(in.getType().getCodingFirstRep().getSystem())
52-
&& ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE
52+
&& ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR
5353
.equals(in.getType().getCodingFirstRep().getCode())).forEach(in -> toWrite.getOutput()
5454
.add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
55-
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE, in.getValue().primitiveValue())));
55+
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, in.getValue().primitiveValue())));
5656
}
5757

5858
private FinalFeasibilityQueryResults readFinalFeasibilityQueryResultsFromCurrentTask(Task task)

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected void doExecute(DelegateExecution execution) throws Exception
6161

6262
logger.info(errorMessage);
6363
leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
64-
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE, errorMessage));
64+
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage));
6565
}
6666
else
6767
{

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ private void addError(Task task, String cohortId, String error)
7171
logger.info(errorMessage);
7272

7373
task.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
74-
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE, errorMessage));
74+
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage));
7575
}
7676
}

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.highmed.dsf.bpe.service;
22

33
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
4-
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE;
4+
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR;
55
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.ERROR_CODE_MULTI_MEDIC_RESULT;
66

77
import java.util.List;
@@ -67,7 +67,7 @@ private List<FinalFeasibilityQueryResult> filterResultsByParticipatingMedics(Tas
6767
result.getCohortId(), taskId, businessKey, correlationKey);
6868

6969
leadingTask.getOutput().add(getTaskHelper()
70-
.createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE,
70+
.createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
7171
"Removed result with cohort id='" + result.getCohortId()
7272
+ "' from feasibility request because of not enough participating MeDICs"));
7373

@@ -93,7 +93,7 @@ private boolean checkIfAtLeastOneResultExists(Task leadingTask, List<FinalFeasib
9393
businessKey, correlationKey);
9494

9595
leadingTask.getOutput().add(getTaskHelper()
96-
.createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE,
96+
.createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
9797
"Did not receive enough results from participating MeDICs for any cohort definition"));
9898

9999
return false;

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.highmed.dsf.bpe.service;
22

3+
import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON;
4+
35
import java.io.IOException;
46
import java.io.InputStream;
57
import java.util.List;
@@ -9,14 +11,13 @@
911
import javax.ws.rs.core.MediaType;
1012

1113
import org.camunda.bpm.engine.delegate.DelegateExecution;
12-
import org.highmed.dsf.bpe.ConstantsBase;
1314
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
1415
import org.highmed.dsf.bpe.variables.ConstantsFeasibility;
15-
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
16-
import org.highmed.dsf.fhir.task.TaskHelper;
1716
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
1817
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
1918
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
19+
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
20+
import org.highmed.dsf.fhir.task.TaskHelper;
2021
import org.highmed.fhir.client.FhirWebserviceClient;
2122
import org.highmed.openehr.model.structure.ResultSet;
2223
import org.hl7.fhir.r4.model.IdType;
@@ -80,7 +81,7 @@ private InputStream readBinaryResource(FhirWebserviceClient client, String id)
8081
try
8182
{
8283
logger.info("Reading binary from {} with id {}", client.getBaseUrl(), id);
83-
return client.readBinary(id, MediaType.valueOf(ConstantsBase.OPENEHR_MIMETYPE_JSON));
84+
return client.readBinary(id, MediaType.valueOf(OPENEHR_MIMETYPE_JSON));
8485
}
8586
catch (Exception e)
8687
{

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.highmed.dsf.bpe.service;
22

3+
import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON;
34
import static org.highmed.dsf.bpe.ConstantsBase.ORGANIZATION_IDENTIFIER_SYSTEM;
45

56
import java.security.Key;
@@ -152,12 +153,12 @@ protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securit
152153
Reference securityContext = new Reference();
153154
securityContext.setType(ResourceType.Organization.name()).getIdentifier()
154155
.setSystem(ORGANIZATION_IDENTIFIER_SYSTEM).setValue(securityIdentifier);
155-
Binary binary = new Binary().setContentType(ConstantsBase.OPENEHR_MIMETYPE_JSON)
156-
.setSecurityContext(securityContext).setData(content);
156+
Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext)
157+
.setData(content);
157158

158159
IdType created = createBinaryResource(binary);
159-
return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), created.getIdPart(),
160-
created.getVersionIdPart()).getValue();
160+
return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(),
161+
created.getIdPart(), created.getVersionIdPart()).getValue();
161162
}
162163

163164
private byte[] serializeResultSet(ResultSet resultSet)

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ protected void doExecute(DelegateExecution execution) throws Exception
2323
currentTask.getInput().forEach(input -> {
2424
boolean isErrorInput = input.getType().getCoding().stream().anyMatch(
2525
code -> code.getSystem().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN) && code.getCode()
26-
.equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE));
26+
.equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR));
2727

2828
if (isErrorInput)
2929
{
3030
leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
31-
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR_MESSAGE, input.getValue().primitiveValue()));
31+
ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, input.getValue().primitiveValue()));
3232
}
3333
});
3434

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package org.highmed.dsf.bpe.variables;
22

3+
import static org.highmed.dsf.bpe.ConstantsBase.PROCESS_URI_BASE;
4+
5+
import org.hl7.fhir.r4.model.CodeType;
6+
37
public interface ConstantsFeasibility
48
{
59
String VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig";
@@ -13,6 +17,12 @@ public interface ConstantsFeasibility
1317

1418
String ERROR_CODE_MULTI_MEDIC_RESULT = "errorMultiMedicSimpleFeasibilityResult";
1519

20+
// Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs
21+
// (if I already know the cohort size in my MeDIC)
22+
int MIN_PARTICIPATING_MEDICS = 3;
23+
int MIN_COHORT_DEFINITIONS = 1;
24+
String SIMPLE_FEASIBILITY_QUERY_PREFIX = "select count";
25+
1626
String CODESYSTEM_HIGHMED_FEASIBILITY = "http://highmed.org/fhir/CodeSystem/feasibility";
1727
String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key";
1828
String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check";
@@ -25,27 +35,43 @@ public interface ConstantsFeasibility
2535
String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result";
2636
String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference";
2737

28-
// Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs
29-
// (if I already know the cohort size in my MeDIC)
30-
int MIN_PARTICIPATING_MEDICS = 3;
31-
int MIN_COHORT_DEFINITIONS = 1;
32-
33-
String SIMPLE_FEASIBILITY_QUERY_PREFIX = "select count";
34-
3538
String EXTENSION_PARTICIPATING_MEDIC_URI = "http://highmed.org/fhir/StructureDefinition/participating-medic";
3639
String EXTENSION_PARTICIPATING_TTP_URI = "http://highmed.org/fhir/StructureDefinition/participating-ttp";
3740
String EXTENSION_GROUP_ID_URI = "http://highmed.org/fhir/StructureDefinition/group-id";
3841

39-
String FEASIBILITY_RESEARCH_STUDY_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-research-study-feasibility";
4042
String GROUP_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-group";
43+
String FEASIBILITY_RESEARCH_STUDY_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-research-study-feasibility";
4144
String RESEARCH_STUDY_IDENTIFIER_SYSTEM = "http://highmed.org/fhir/NamingSystem/research-study-identifier";
4245

4346
String REQUEST_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-request-simple-feasibility";
44-
String LOCAL_SERVICES_PROCESS_URI = "http://highmed.org/bpe/Process/localServicesIntegration";
45-
String REQUEST_FEASIBILITY_PROCESS_URI = "http://highmed.org/bpe/Process/requestSimpleFeasibility";
47+
String REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_URI_BASE + "requestSimpleFeasibility/";
4648
String REQUEST_FEASIBILITY_PROCESS_LATEST_VERSION = "0.4.0";
4749
String REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
48-
REQUEST_FEASIBILITY_PROCESS_URI + "/" + REQUEST_FEASIBILITY_PROCESS_LATEST_VERSION;
49-
50+
REQUEST_FEASIBILITY_PROCESS_URI + REQUEST_FEASIBILITY_PROCESS_LATEST_VERSION;
5051
String REQUEST_FEASIBILITY_MESSAGE_NAME = "requestSimpleFeasibilityMessage";
52+
53+
String EXECUTE_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-execute-simple-feasibility";
54+
String EXECUTE_FEASIBILITY_PROCESS_URI = PROCESS_URI_BASE + "executeSimpleFeasibility/";
55+
String EXECUTE_FEASIBILITY_PROCESS_LATEST_VERSION = "0.4.0";
56+
String EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
57+
EXECUTE_FEASIBILITY_PROCESS_URI + EXECUTE_FEASIBILITY_PROCESS_LATEST_VERSION;
58+
String EXECUTE_FEASIBILITY_MESSAGE_NAME = "executeSimpleFeasibilityMessage";
59+
60+
String COMPUTE_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-compute-simple-feasibility";
61+
String COMPUTE_FEASIBILITY_PROCESS_URI = PROCESS_URI_BASE + "computeSimpleFeasibility/";
62+
String COMPUTE_FEASIBILITY_PROCESS_LATEST_VERSION = "0.4.0";
63+
String COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
64+
COMPUTE_FEASIBILITY_PROCESS_URI + COMPUTE_FEASIBILITY_PROCESS_LATEST_VERSION;
65+
String COMPUTE_FEASIBILITY_MESSAGE_NAME = "computeSimpleFeasibilityMessage";
66+
67+
String SINGLE_MEDIC_RESULT_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-single-medic-result-simple-feasibility";
68+
String SINGLE_MEDIC_RESULT_FEASIBILITY_MESSAGE_NAME = "resultSingleMedicSimpleFeasibilityMessage";
69+
70+
String MULTI_MEDIC_RESULT_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-multi-medic-result-simple-feasibility";
71+
String MULTI_MEDIC_RESULT_FEASIBILITY_MESSAGE_NAME = "resultMultiMedicSimpleFeasibilityMessage";
72+
73+
String ERROR_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-multi-medic-error-simple-feasibility";
74+
String ERROR_FEASIBILITY_MESSAGE_NAME = "errorMultiMedicSimpleFeasibilityMessage";
75+
76+
String LOCAL_SERVICES_PROCESS_URI = PROCESS_URI_BASE + "localServicesIntegration/";
5177
}

0 commit comments

Comments
 (0)