-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodeSystem.java
More file actions
871 lines (809 loc) · 31.5 KB
/
Copy pathCodeSystem.java
File metadata and controls
871 lines (809 loc) · 31.5 KB
1
2
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
package dev.dsf.bpe;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import org.hl7.fhir.r4.model.Coding;
public final class CodeSystem
{
private CodeSystem()
{
}
interface SingleStringValueEnum
{
String getValue();
}
protected static class SingleStringValueEnumParser<T extends Enum<T> & SingleStringValueEnum>
{
private final Class<T> enumClass;
public SingleStringValueEnumParser(Class<T> enumClass)
{
this.enumClass = enumClass;
}
public T ofValue(String value)
{
try
{
return T.valueOf(enumClass, value);
}
catch (IllegalArgumentException e)
{
for (T t : enumClass.getEnumConstants())
{
if (t.getValue().equals(value))
{
return t;
}
}
throw new IllegalArgumentException("Unable to convert " + value + " to " + enumClass.getName());
}
}
}
public static final class DsfPing
{
public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping";
private DsfPing()
{
}
public static Coding fromCode(Code code, String resourceVersion)
{
return new Coding().setSystem(URL).setCode(code.getValue()).setVersion(resourceVersion);
}
public enum Code implements SingleStringValueEnum
{
PING_STATUS("ping-status"),
PONG_STATUS("pong-status"),
ENDPOINT_IDENTIFIER("endpoint-identifier"),
TARGET_ENDPOINTS("target-endpoints"),
TIMER_INTERVAL("timer-interval"),
DOWNLOAD_RESOURCE_SIZE_BYTES("download-resource-size-bytes"),
DOWNLOADED_DURATION_MILLIS("downloaded-duration"),
DOWNLOADED_BYTES("downloaded-bytes"),
DOWNLOAD_RESOURCE_REFERENCE("download-resource-reference"),
ERROR("error"),
PONG_TIMEOUT_DURATION_ISO_8601("pong-timeout-duration");
private final String value;
Code(String value)
{
this.value = value;
}
public String getValue()
{
return value;
}
public static Code ofValue(String value)
{
return new SingleStringValueEnumParser<>(Code.class).ofValue(value);
}
}
}
public static final class DsfPingStatus
{
public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-status";
private DsfPingStatus()
{
}
public static Coding fromCode(Code code, String resourceVersion)
{
return new Coding().setSystem(URL).setCode(code.getValue()).setVersion(resourceVersion);
}
public enum Code implements SingleStringValueEnum
{
NOT_ALLOWED("not-allowed"),
NOT_REACHABLE("not-reachable"),
PONG_MISSING("pong-missing"),
PONG_RECEIVED("pong-received"),
PONG_SENT("pong-send");
private final String value;
Code(String value)
{
this.value = value;
}
public String getValue()
{
return value;
}
public static Code ofValue(String value)
{
return new SingleStringValueEnumParser<>(Code.class).ofValue(value);
}
}
}
// TODO: rename to DsfNetworkSpeedUnits
public static final class DsfPingUnits
{
public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-units";
private DsfPingUnits()
{
}
public static Coding fromCode(Code code, String resourceVersion)
{
return new Coding().setSystem(URL).setCode(code.toUcum()).setVersion(resourceVersion);
}
public enum Code
{
bps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal bits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return bits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "bit/s";
}
},
kbps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "kbit/s";
}
},
Mbps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "Mbit/s";
}
},
Gbps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000000000), RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "Gbit/s";
}
},
Bps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "By/s";
}
},
kBps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "kBy/s";
}
},
MBps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "MBy/s";
}
},
GBps
{
@Override
public BigDecimal calculateSpeed(long bytes, Duration duration)
{
if (bytes == 0)
return BigDecimal.ZERO;
if (duration.isZero())
return BigDecimal.valueOf(Long.MAX_VALUE);
BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000000000), RoundingMode.HALF_UP);
BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP)
.divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP);
return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP);
}
@Override
public String toUcum()
{
return "GBy/s";
}
};
public abstract BigDecimal calculateSpeed(long bytes, Duration duration);
public abstract String toUcum();
public static SpeedAndUnit calculateSpeedWithFittingUnit(Long downloadedBytes, Duration downloadedDuration)
{
return Stream
.of(CodeSystem.DsfPingUnits.Code.bps, CodeSystem.DsfPingUnits.Code.kbps,
CodeSystem.DsfPingUnits.Code.Mbps, CodeSystem.DsfPingUnits.Code.Gbps)
.map(unit -> new SpeedAndUnit(unit.calculateSpeed(downloadedBytes, downloadedDuration), unit))
.filter(speedAndUnit -> speedAndUnit.speed.compareTo(BigDecimal.valueOf(1000L)) < 0).findFirst()
.orElse(new SpeedAndUnit(
CodeSystem.DsfPingUnits.Code.Gbps.calculateSpeed(downloadedBytes, downloadedDuration),
Code.Gbps));
}
public record SpeedAndUnit(BigDecimal speed, Code unit)
{
}
}
}
public final class DsfPingError
{
public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-error";
private DsfPingError()
{
}
public static Coding fromConcept(Concept concept, String resourceVersion)
{
return new Coding().setSystem(URL).setCode(concept.getCode()).setDisplay(concept.getDisplay())
.setVersion(resourceVersion);
}
public enum Concept
{
SEND_MESSAGE_HTTP_401(
"send-message-http-401",
"Sending a message to the remote instance resulted in HTTP status 401 - Unauthorized"
),
SEND_MESSAGE_HTTP_403(
"send-message-http-403",
"Sending a message to the remote instance resulted in HTTP status 403 - Forbidden"
),
SEND_REFERENCE_MESSAGE_HTTP_403(
"send-reference-message-http-403",
"Sending a message including a reference to the remote instance resulted in HTTP status 403 - Forbidden"
),
SEND_MESSAGE_HTTP_407(
"send-message-http-407",
"Sending a message to the remote instance resulted in HTTP status 407 - Proxy Authentication Required"
),
SEND_MESSAGE_HTTP_500(
"send-message-http-500",
"Sending a message to the remote instance resulted in HTTP status 500 - Internal Server Error"
),
SEND_MESSAGE_HTTP_502(
"send-message-http-502",
"Sending a message to the remote instance resulted in HTTP status 502 - Bad Gateway"
),
SEND_MESSAGE_HTTP_503(
"send-message-http-503",
"Sending a message to the remote instance resulted in HTTP status 503 - Service Unavailable"
),
SEND_MESSAGE_HTTP_504(
"send-message-http-504",
"Sending a message to the remote instance resulted in HTTP status 504 - Gateway Timeout"
),
SEND_MESSAGE_HTTP_UNEXPECTED(
"send-message-http-unexpected",
"Sending a message to the remote instance resulted in an unexpected HTTP status code"
),
SEND_MESSAGE_SSL_HANDSHAKE(
"send-message-ssl-handshake",
"Sending a message to the remote instance was unsuccessful because of a failed SSL handshake"
),
SEND_MESSAGE_CONNECT_TIMEOUT(
"send-message-connect-timeout",
"Sending a message to the remote instance was unsuccessful because of a connection timeout"
),
SEND_MESSAGE_HTTP_HOST_CONNECT(
"send-message-http-host-connect",
"Sending a message to the remote instance was unsuccessful because the connection was refused"
),
SEND_MESSAGE_UNKNOWN_HOST(
"send-message-unknown-host",
"Sending a message to the remote instance was unsuccessful because the target hostname could not be resolved"
),
RECEIVE_MESSAGE_HTTP_401(
"receive-message-http-401",
"Received a message and responded with HTTP status 401 - Unauthorized"
),
RECEIVE_MESSAGE_HTTP_403(
"receive-message-http-403",
"Received a message and responded with HTTP status 403 - Forbidden"
),
RECEIVE_REFERENCE_MESSAGE_HTTP_403(
"receive-reference-message-http-403",
"Received a message including a reference and responded with HTTP status 403 - Forbidden"
),
RECEIVE_MESSAGE_HTTP_407(
"receive-message-http-407",
"Received a message and responded with HTTP status 407 - Proxy Authentication Required"
),
RECEIVE_MESSAGE_HTTP_500(
"receive-message-http-500",
"Received a message and responded with HTTP status 500 - Internal Server Error"
),
RECEIVE_MESSAGE_HTTP_502(
"receive-message-http-502",
"Received a message and responded with HTTP status 502 - Bad Gateway"
),
RECEIVE_MESSAGE_HTTP_503(
"receive-message-http-503",
"Received a message and responded with HTTP status 503 - Service Unavailable"
),
RECEIVE_MESSAGE_HTTP_504(
"receive-message-http-504",
"Received a message and responded with HTTP status 504 - Gateway Timeout"
),
RECEIVE_MESSAGE_HTTP_UNEXPECTED(
"receive-message-http-unexpected",
"Received a message and responded with an unexpected HTTP status code"
),
RECEIVE_MESSAGE_SSL_HANDSHAKE(
"receive-message-ssl-handshake",
"Receiving a message was unsuccessful because of a failed SSL handshake"
),
RECEIVE_MESSAGE_CONNECT_TIMEOUT(
"receive-message-connect-timeout",
"Receiving a message was unsuccessful because of a connection timeout"
),
RECEIVE_MESSAGE_HTTP_HOST_CONNECT(
"receive-message-http-host-connect",
"Receiving a message was unsuccessful because the connection was refused"
),
RECEIVE_MESSAGE_UNKNOWN_HOST(
"receive-message-unknown-host",
"Receiving a message was unsuccessful because the target hostname could not be resolved"
),
LOCAL_BINARY_DELETE_TIMEOUT_CONNECT(
"local-binary-delete-timeout-connect",
"Local instance encountered a connect timeout trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_TIMEOUT_READ(
"local-binary-delete-timeout-read",
"Local instance encountered a read timeout trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_HOST_CONNECT(
"local-binary-delete-http-host-connect",
"Local instance was unable to clean up the binary resource from the local DSF FHIR server because the connection was refused"
),
LOCAL_BINARY_DELETE_HTTP_401(
"local-binary-delete-http-401",
"Local instance encountered a HTTP status 401 - Unauthorized trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_403(
"local-binary-delete-http-403",
"Local instance encountered a HTTP status 403 - Forbidden trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_407(
"local-binary-delete-http-407",
"Local instance encountered a HTTP status 407 - Proxy Authentication Required trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_500(
"local-binary-delete-http-500",
"Local instance encountered a HTTP status 500 - Internal Server Error trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_502(
"local-binary-delete-http-502",
"Local instance encountered a HTTP status 502 - Bad Gateway trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_503(
"local-binary-delete-http-503",
"Local instance encountered a HTTP status 503 - Service Unavailable trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_504(
"local-binary-delete-http-504",
"Local instance encountered a HTTP status 504 - Gateway Timeout trying to clean up the binary resource"
),
LOCAL_BINARY_DELETE_HTTP_UNEXPECTED(
"local-binary-delete-http-unexpected",
"Local instance encountered an unexpected HTTP status code trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_TIMEOUT_CONNECT(
"remote-binary-delete-timeout-connect",
"Remote instance encountered a connect timeout trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_TIMEOUT_READ(
"remote-binary-delete-timeout-read",
"Remote instance encountered a read timeout trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_HOST_CONNECT(
"remote-binary-delete-http-host-connect",
"Remote instance was unable to clean up the binary resource from its DSF FHIR server because the connection was refused"
),
REMOTE_BINARY_DELETE_HTTP_401(
"remote-binary-delete-http-401",
"Remote instance encountered a HTTP status 401 - Unauthorized trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_403(
"remote-binary-delete-http-403",
"Remote instance encountered a HTTP status 403 - Forbidden trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_407(
"remote-binary-delete-http-407",
"Remote instance encountered a HTTP status 407 - Proxy Authentication Required trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_500(
"remote-binary-delete-http-500",
"Remote instance encountered a HTTP status 500 - Internal Server Error trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_502(
"remote-binary-delete-http-502",
"Remote instance encountered a HTTP status 502 - Bad Gateway trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_503(
"remote-binary-delete-http-503",
"Remote instance encountered a HTTP status 503 - Service Unavailable trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_504(
"remote-binary-delete-http-504",
"Remote instance encountered a HTTP status 504 - Gateway Timeout trying to clean up the binary resource"
),
REMOTE_BINARY_DELETE_HTTP_UNEXPECTED(
"remote-binary-delete-http-unexpected",
"Remote instance encountered an unexpected HTTP status code trying to clean up the binary resource"
),
LOCAL_BINARY_POST_HTTP_401(
"local-binary-post-http-401",
"Local instance encountered a HTTP status 401 - Unauthorized trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_403(
"local-binary-post-http-403",
"Local instance encountered a HTTP status 403 - Forbidden trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_407(
"local-binary-post-http-407",
"Local instance encountered a HTTP status 407 - Proxy Authentication Required trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_413(
"local-binary-post-http-413",
"Local instance encountered a HTTP status 413 - Payload Too Large trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_500(
"local-binary-post-http-500",
"Local instance encountered a HTTP status 500 - Internal Server Error trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_502(
"local-binary-post-http-502",
"Local instance encountered a HTTP status 502 - Bad Gateway trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_503(
"local-binary-post-http-503",
"Local instance encountered a HTTP status 503 - Service Unavailable trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_504(
"local-binary-post-http-504",
"Local instance encountered a HTTP status 504 - Gateway Timeout trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_UNEXPECTED(
"local-binary-post-http-unexpected",
"Local instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_TIMEOUT_CONNECT(
"local-binary-post-timeout-connect",
"Local instance encountered a connect timeout trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_TIMEOUT_READ(
"local-binary-post-timeout-read",
"Local instance encountered a read timeout trying to post the binary resource to its own FHIR server"
),
LOCAL_BINARY_POST_HTTP_HOST_CONNECT(
"local-binary-post-http-host-connect",
"Local instance was unable to post the binary resource to its own DSF FHIR server because the connection was refused"
),
REMOTE_BINARY_POST_HTTP_401(
"remote-binary-post-http-401",
"Remote instance encountered a HTTP status 401 - Unauthorized trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_403(
"remote-binary-post-http-403",
"Remote instance encountered a HTTP status 403 - Forbidden trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_407(
"remote-binary-post-http-407",
"Remote instance encountered a HTTP status 407 - Proxy Authentication Required trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_413(
"remote-binary-post-http-413",
"Remote instance encountered a HTTP status 413 - Payload Too Large trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_500(
"remote-binary-post-http-500",
"Remote instance encountered a HTTP status 500 - Internal Server Error trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_502(
"remote-binary-post-http-502",
"Remote instance encountered a HTTP status 502 - Bad Gateway trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_503(
"remote-binary-post-http-503",
"Remote instance encountered a HTTP status 503 - Service Unavailable trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_504(
"remote-binary-post-http-504",
"Remote instance encountered a HTTP status 504 - Gateway Timeout trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_UNEXPECTED(
"remote-binary-post-http-unexpected",
"Remote instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_TIMEOUT_CONNECT(
"remote-binary-post-timeout-connect",
"Remote instance encountered a connect timeout trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_TIMEOUT_READ(
"remote-binary-post-timeout-read",
"Remote instance encountered a read timeout trying to post the binary resource to its own FHIR server"
),
REMOTE_BINARY_POST_HTTP_HOST_CONNECT(
"remote-binary-post-http-host-connect",
"Remote instance was unable to post the binary resource to its own DSF FHIR server because the connection was refused"
),
RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED(
"response-message-timeout-status-requested",
"Response missing, sent Task status is 'requested'"
),
RESPONSE_MESSAGE_TIMEOUT_STATUS_IN_PROGRESS(
"response-message-timeout-status-in-progress",
"Response missing, sent Task status is 'in-progress'"
),
RESPONSE_MESSAGE_TIMEOUT_STATUS_FAILED(
"response-message-timeout-status-failed",
"Response missing, sent Task status is 'failed'"
),
RESPONSE_MESSAGE_TIMEOUT_STATUS_COMPLETED(
"response-message-timeout-status-completed",
"Response missing, sent Task status is 'completed'"
),
RESPONSE_MESSAGE_TIMEOUT_STATUS_UNEXPECTED(
"response-message-timeout-status-unexpected",
"Response missing, sent Task status is neither of 'requested', 'in-progress', 'failed' or 'completed'"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_401(
"response-message-timeout-http-401",
"Response message timed out. Received HTTP status 401 - Unauthorized trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_403(
"response-message-timeout-http-403",
"Response message timed out. Received HTTP status 403 - Forbidden trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_407(
"response-message-timeout-http-407",
"Response message timed out. Received HTTP status 407 - Proxy Authentication Required trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_500(
"response-message-timeout-http-500",
"Response message timed out. Received HTTP status 500 - Internal Server Error trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_502(
"response-message-timeout-http-502",
"Response message timed out. Received HTTP status 502 - Bad Gateway trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_503(
"response-message-timeout-http-503",
"Response message timed out. Received HTTP status 503 - Service Unavailable trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_504(
"response-message-timeout-http-504",
"Response message timed out. Received HTTP status 504 - Gateway Timeout trying to check request status on the target"
),
RESPONSE_MESSAGE_TIMEOUT_HTTP_UNEXPECTED(
"response-message-timeout-http-unexpected",
"Response message timed out. Received an unexpected HTTP status code trying to check request status on the target"
),
CLEANUP_MESSAGE_TIMEOUT(
"cleanup-message-timeout",
"Timeout while waiting for cleanup message from remote instance"
),
LOCAL_BINARY_DOWNLOAD_IO_ERROR(
"local-binary-download-io-error",
"Local instance encountered an I/O error trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_401(
"local-binary-download-http-401",
"Local instance Received HTTP status 401 - Unauthorized trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_403(
"local-binary-download-http-403",
"Local instance Received HTTP status 403 - Forbidden trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_407(
"local-binary-download-http-407",
"Local instance Received HTTP status 407 - Proxy Authentication Required trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_500(
"local-binary-download-http-500",
"Local instance Received HTTP status 500 - Internal Server Error trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_502(
"local-binary-download-http-502",
"Local instance Received HTTP status 502 - Bad Gateway trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_503(
"local-binary-download-http-503",
"Local instance Received HTTP status 503 - Service Unavailable trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_504(
"local-binary-download-http-504",
"Local instance Received HTTP status 504 - Gateway Timeout trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_UNEXPECTED(
"local-binary-download-http-unexpected",
"Local instance received an unexpected HTTP status trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_TIMEOUT_CONNECT(
"local-binary-download-timeout-connect",
"Local instance encountered a connect timeout trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_TIMEOUT_READ(
"local-binary-download-timeout-read",
"Local instance encountered a read timeout trying to download the binary resource from the target"
),
LOCAL_BINARY_DOWNLOAD_HTTP_HOST_CONNECT(
"local-binary-download-http-host-connect",
"Local instance was unable to download the binary resource from the remote DSF FHIR server because the connection was refused"
),
LOCAL_BINARY_DOWNLOAD_MISSING_REFERENCE(
"local-binary-download-missing-reference",
"Local instance was unable to download the binary resource from the target because the reference was missing"
),
REMOTE_BINARY_DOWNLOAD_IO_ERROR(
"remote-binary-download-io-error",
"Remote instance encountered an I/O error trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_401(
"remote-binary-download-http-401",
"Remote instance Received HTTP status 401 - Unauthorized trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_403(
"remote-binary-download-http-403",
"Remote instance Received HTTP status 403 - Forbidden trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_407(
"remote-binary-download-http-407",
"Remote instance Received HTTP status 407 - Proxy Authentication Required trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_500(
"remote-binary-download-http-500",
"Remote instance Received HTTP status 500 - Internal Server Error trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_502(
"remote-binary-download-http-502",
"Remote instance Received HTTP status 502 - Bad Gateway trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_503(
"remote-binary-download-http-503",
"Remote instance Received HTTP status 503 - Service Unavailable trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_504(
"remote-binary-download-http-504",
"Remote instance Received HTTP status 504 - Gateway Timeout trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_UNEXPECTED(
"remote-binary-download-http-unexpected",
"Remote instance received an unexpected HTTP status trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_TIMEOUT_CONNECT(
"remote-binary-download-timeout-connect",
"Remote instance encountered a connect timeout trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_TIMEOUT_READ(
"remote-binary-download-timeout-read",
"Remote instance encountered a read timeout trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_HTTP_HOST_CONNECT(
"remote-binary-download-timeout-read",
"Remote instance encountered a read timeout trying to download the binary resource from this server"
),
REMOTE_BINARY_DOWNLOAD_MISSING_REFERENCE(
"remote-binary-download-http-host-connect",
"Remote instance was unable to download the binary resource from the local DSF FHIR server because the connection was refused"
),
LOCAL_UNKNOWN(
"local-unknown",
"An unknown error was encountered by the local instance"
),
REMOTE_UNKNOWN(
"remote-unknown",
"An unknown error was encountered by the remote instance"
);
private final String code;
private final String display;
private static final Map<String, Concept> CODE_TO_ENUM = new HashMap<>();
static
{
for (Concept e : values())
{
CODE_TO_ENUM.put(e.code, e);
}
}
Concept(String code, String display)
{
this.code = code;
this.display = display;
}
public String getCode()
{
return code;
}
public String getDisplay()
{
return display;
}
public static Concept fromCode(String code)
{
return CODE_TO_ENUM.get(code);
}
}
}
}