Newer
Older
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
### Commandline Client
The sdk comes with a commandline client to be able to use the sdk without any coding.
#### Setup & Build
1. Build project root wih ``mvn clean package``
2. Go to client/target and find a runnable jar ``client-VERSION.jar``
3. set environment variable ``CONFIG_LOCATION`` or drop a configured [sdk.conf](../sdk.conf) file next to the runnable jar
1. Linux/MacOS: ``export CONFIG_LOCATION=path/to/sdk.conf``
2. Windows: ``set CONFIG_LOCATION=C:\Path\To\sdk.conf``
4. run client with ``java -jar client-VERSION.jar [COMMAND] [OPTIONS]``
#### SEND Example
The send command submits a new submission to a destination. Apart from optional attachments, all options are mandatory.
````sh
java -jar client-1.0-SNAPSHOT.jar send
--destinationId=1b7d1a24-a6c8-4050-bb71-ae3749ec432f
--serviceName=Test
--leikaKey=urn:de:fim:leika:leistung:99400048079000
--attachments=C:/path/to/attachments/dummy1.pdf, C:/path/to/attachments/dummy2.pdf
--data="{foo: 'bar'}"
--dataType=JSON
````
> Hint: copy example on one line for execution !
#### LIST Submissions Example
The list command lists all submissionIds for a given destinationID.
````sh
java -jar client-1.0-SNAPSHOT.jar list --destinationID=1b7d1a24-a6c8-4050-bb71-ae3749ec432f
````
#### GET Single Submission Example
The get command loads a submission by id and stores data and attachments in the given target location. If no target is
set, the cmd-client saves the data into in a folder named by the submission id within the working dir of the runnable
jar.
````sh
java -jar client-1.0-SNAPSHOT.jar get --submissionID=cc9b9b3c-d4b1-4ac7-a70b-e7ca76e88608 --target=Users/submissions/data
````
#### Usage And Commands
````shell
Usage: <main class> [command] [command options]
Commands:
send Send a submission
Usage: send [options]
Options:
--attachments
Attachments as list of paths
Default: []
* --data
JSON or XML data as string
* --dataType
Data mime type (JSON/XML), default JSON
Default: JSON
Possible Values: [JSON, XML]
* --destinationId
Unique destination identifier - UUID format
* --leikaKey
The LeikaKey of the service type
* --serviceName
Name of the service type
list Lists available submissions
Usage: list [options]
Options:
* --destinationId
Unique destination identifier - UUID format
get Fetches one submission by id
Usage: get [options]
Options:
* --submissionId
Unique submission identifier - UUID format
--target
Target folder where attachments and data is written to
````
### API Flow
The ClientFactory provides fluent API clients both for **Sender** and **Subscriber**.
As the flow chart below shows, the fluent client guides through all essential calls in order to hand in a correct
**Submission** as well as receive submissions on the subscriber side.
#### Api client flow for sending a submission
For the actual sender client those calls look like this:
<table>
<tr>
<th>Workflow</th>
<th>Java sample calls</th>
</tr>
<tr>
<td>
```mermaid
flowchart TD
A[Create Client] --> B(Provide DestinationID)
B -->|next| C[Add Service Type]
C -->|next| D[Add Attachments]
D -->|next| E[Add Data]
C -->|next| E[Add Data]
E -->|send| F[SubmissionForPickup]
```
</td>
<td>
```java
ClientFactory.senderClient()
.withDestination(UUID.randomUUID())
.withServiceType("ServiceName", "leika:key:service")
.withAttachments(attachments)
.withJsonData("{ caseSpecific: 'Data' }")
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
.submit();
```
</td>
</tr>
</table>
#### Api client flow for subscribing to a submission
<table>
<tr>
<th>Workflow</th>
<th>Java sample calls</th>
</tr>
<tr>
<td>
```mermaid
flowchart TD
A[Create Client] --> B(Poll List ofAvailable Submissions)
A[Create Client] --> C(Request Submission by ID)
B -->|next| C[Request Submission by ID]
C -->|get| D[Attachments]
C -->|get| E[Metadata]
C -->|get| F[Data]
```
</td>
<td>
```java
var client = ClientFactory.subscriberClient();
var submissions = client.getAvailableSubmissions(destinationId);
// filter submission list for requested one ...
var submission = client.requestSubmission(submissionId)
submission.getAttachments();
submission.getMetadata();
submission.getData();
```
</td>
</tr>
</table>