1
1
package org .highmed .dsf .bpe .start ;
2
2
3
+ import static org .highmed .dsf .bpe .ConstantsBase .CODESYSTEM_HIGHMED_BPMN ;
4
+ import static org .highmed .dsf .bpe .ConstantsBase .CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME ;
5
+ import static org .highmed .dsf .bpe .ConstantsBase .ORGANIZATION_IDENTIFIER_SYSTEM ;
6
+ import static org .highmed .dsf .bpe .start .ConstantsExampleStarters .CERTIFICATE_PASSWORD ;
7
+ import static org .highmed .dsf .bpe .start .ConstantsExampleStarters .CERTIFICATE_PATH ;
8
+ import static org .highmed .dsf .bpe .start .ConstantsExampleStarters .ORGANIZATION_IDENTIFIER_VALUE_TTP ;
9
+ import static org .highmed .dsf .bpe .start .ConstantsExampleStarters .TTP_FHIR_BASE_URL ;
10
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .CODESYSTEM_HIGHMED_UPDATE_RESOURCE ;
11
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE ;
12
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER ;
13
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .REQUEST_UPDATE_RESOURCES_MESSAGE_NAME ;
14
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .REQUEST_UPDATE_RESOURCES_PROCESS_LATEST_VERSION ;
15
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .REQUEST_UPDATE_RESOURCES_PROCESS_URI ;
16
+ import static org .highmed .dsf .bpe .variables .ConstantsUpdateResources .REQUEST_UPDATE_RESOURCES_TASK_PROFILE ;
17
+
3
18
import java .io .IOException ;
4
19
import java .nio .file .Paths ;
5
20
import java .security .KeyStore ;
18
33
import org .hl7 .fhir .r4 .model .Bundle ;
19
34
import org .hl7 .fhir .r4 .model .IdType ;
20
35
import org .hl7 .fhir .r4 .model .Reference ;
36
+ import org .hl7 .fhir .r4 .model .ResourceType ;
21
37
import org .hl7 .fhir .r4 .model .StringType ;
22
38
import org .hl7 .fhir .r4 .model .Task ;
23
39
import org .hl7 .fhir .r4 .model .Task .TaskIntent ;
24
40
import org .hl7 .fhir .r4 .model .Task .TaskStatus ;
25
41
26
42
import ca .uhn .fhir .context .FhirContext ;
43
+
27
44
import de .rwh .utils .crypto .CertificateHelper ;
28
45
import de .rwh .utils .crypto .io .CertificateReader ;
29
46
@@ -32,48 +49,47 @@ public class UpdateResource3MedicTtpExampleStarter
32
49
public static void main (String [] args )
33
50
throws KeyStoreException , CertificateException , NoSuchAlgorithmException , IOException
34
51
{
35
- char [] keyStorePassword = "password" .toCharArray ();
36
- KeyStore keyStore = CertificateReader .fromPkcs12 (Paths .get (
37
- "../../dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12" ),
38
- keyStorePassword );
52
+ KeyStore keyStore = CertificateReader .fromPkcs12 (Paths .get (CERTIFICATE_PATH ), CERTIFICATE_PASSWORD );
39
53
KeyStore trustStore = CertificateHelper .extractTrust (keyStore );
40
54
41
55
FhirContext context = FhirContext .forR4 ();
42
56
ReferenceCleaner referenceCleaner = new ReferenceCleanerImpl (new ReferenceExtractorImpl ());
43
- FhirWebserviceClient client = new FhirWebserviceClientJersey ("https://ttp/fhir/" , trustStore , keyStore ,
44
- keyStorePassword , null , null , null , 0 , 0 , null , context , referenceCleaner );
57
+ FhirWebserviceClient client = new FhirWebserviceClientJersey (TTP_FHIR_BASE_URL , trustStore , keyStore ,
58
+ CERTIFICATE_PASSWORD , null , null , null , 0 , 0 , null , context , referenceCleaner );
45
59
46
60
Bundle searchResult = client .searchWithStrictHandling (Bundle .class , Map .of ("identifier" ,
47
61
Collections .singletonList ("http://highmed.org/fhir/CodeSystem/update-allow-list|highmed_allow_list" )));
62
+
48
63
if (searchResult .getTotal () != 1 && searchResult .getEntryFirstRep ().getResource () instanceof Bundle )
49
64
throw new IllegalStateException ("Expected a single allow list Bundle" );
50
65
Bundle allowList = (Bundle ) searchResult .getEntryFirstRep ().getResource ();
51
66
52
67
System .out .println (context .newXmlParser ().encodeResourceToString (allowList ));
53
68
54
69
Task task = new Task ();
55
- task .getMeta ().addProfile ("http://highmed.org/fhir/StructureDefinition/highmed-task-request-update-resources" );
56
- task .setInstantiatesUri ("http://highmed.org/bpe/Process/requestUpdateResources/0.4.0" );
70
+ task .getMeta ().addProfile (REQUEST_UPDATE_RESOURCES_TASK_PROFILE );
71
+ task .setInstantiatesUri (
72
+ REQUEST_UPDATE_RESOURCES_PROCESS_URI + "/" + REQUEST_UPDATE_RESOURCES_PROCESS_LATEST_VERSION );
57
73
task .setStatus (TaskStatus .REQUESTED );
58
74
task .setIntent (TaskIntent .ORDER );
59
75
task .setAuthoredOn (new Date ());
60
- task .getRequester ().setType (" Organization" ).getIdentifier ()
61
- .setSystem ("http://highmed.org/fhir/NamingSystem/organization-identifier" ).setValue ("Test_TTP" );
62
- task .getRestriction ().addRecipient ().setType (" Organization" ).getIdentifier ()
63
- .setSystem ("http://highmed.org/fhir/NamingSystem/organization-identifier" ).setValue ("Test_TTP" );
76
+ task .getRequester ().setType (ResourceType . Organization . name () ).getIdentifier ()
77
+ .setSystem (ORGANIZATION_IDENTIFIER_SYSTEM ).setValue (ORGANIZATION_IDENTIFIER_VALUE_TTP );
78
+ task .getRestriction ().addRecipient ().setType (ResourceType . Organization . name () ).getIdentifier ()
79
+ .setSystem (ORGANIZATION_IDENTIFIER_SYSTEM ).setValue (ORGANIZATION_IDENTIFIER_VALUE_TTP );
64
80
65
- task .addInput ().setValue (new StringType ("requestUpdateResourcesMessage" )).getType ().addCoding ()
66
- .setSystem ("http://highmed.org/fhir/CodeSystem/bpmn-message" ).setCode ("message-name" );
81
+ task .addInput ().setValue (new StringType (REQUEST_UPDATE_RESOURCES_MESSAGE_NAME )).getType ().addCoding ()
82
+ .setSystem (CODESYSTEM_HIGHMED_BPMN ).setCode (CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME );
67
83
68
- task .addInput ()
69
- . setValue ( new Reference ( new IdType (" Bundle" , allowList .getIdElement ().getIdPart (),
70
- allowList .getIdElement ().getVersionIdPart ())))
71
- .getType (). addCoding (). setSystem ("http://highmed.org/fhir/CodeSystem/update-resources" )
72
- .setCode ("bundle-reference" );
84
+ task .addInput (). setValue ( new Reference (
85
+ new IdType (ResourceType . Bundle . name () , allowList .getIdElement ().getIdPart (),
86
+ allowList .getIdElement ().getVersionIdPart ()))). getType (). addCoding ()
87
+ .setSystem (CODESYSTEM_HIGHMED_UPDATE_RESOURCE )
88
+ .setCode (CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE );
73
89
74
90
task .addInput ().setValue (new StringType ("http://highmed.org/fhir/NamingSystem/organization-identifier|" ))
75
- .getType ().addCoding ().setSystem ("http://highmed.org/fhir/CodeSystem/update-resources" )
76
- .setCode ("organization-identifier-search-parameter" );
91
+ .getType ().addCoding ().setSystem (CODESYSTEM_HIGHMED_UPDATE_RESOURCE )
92
+ .setCode (CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER );
77
93
78
94
client .withMinimalReturn ().create (task );
79
95
}
0 commit comments