1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.modules.hl7;
17
18
19
20
21
22
23
24
25 public enum HL70357 {
26
27 MESSAGE_ACCEPTED(0, "Message accepted"),
28 SEGMENT_SEQUENCE_ERROR(100, "Segment sequence error"),
29 REQUIRED_FIELD_MISSING(101, "Required field missing"),
30 DATA_TYPE_ERROR(102, "Data type error"),
31 TABLE_VALUE_NOT_FOUND(103, "Table value not found"),
32 UNSUPPORTED_MESSAGE_TYPE(200, "Unsupported message type"),
33 UNSUPPORTED_EVENT_CODE(201, "Unsupported event code"),
34 UNSUPPORTED_PROCESSING_ID(202, "Unsupported processing id"),
35 UNSUPPORTED_VERSION_ID(203, "Unsupported version id"),
36 UNKNOWN_KEY_IDENTIFIER(204, "Unknown key identifier"),
37 DUPLICATE_KEY_IDENTIFIER(205, "Duplicate key identifier"),
38 APPLICATION_RECORD_LOCKED(206, "Application record locked"),
39 APPLICATION_INTERNAL_ERROR(207, "Application internal error");
40
41 private final int errCode;
42 private final String message;
43
44 HL70357(int errCode, String message) {
45 this.errCode = errCode;
46 this.message = message;
47 }
48
49 public static String messageFor(int errCode) {
50 for (HL70357 err : HL70357.values()) {
51 if (err.errCode == errCode) {
52 return err.message;
53 }
54 }
55 return "Unknown error";
56 }
57 }