View Javadoc
1   /*
2    * Copyright 2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.modules.hl7;
17  
18  /**
19   * HL7 Error codes and messages
20   * 
21   * @author Christian Ohr
22   * @deprecated use {@link ca.uhn.hl7v2.ErrorCode}
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  }