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  import ca.uhn.hl7v2.*;
19  import ca.uhn.hl7v2.model.Message;
20  
21  /**
22   * HL7v2Exception extends {@link RuntimeException} so it need not to be caught.
23   * All calls are delegated to the contained {@link ca.uhn.hl7v2.HL7Exception}
24   * 
25   * @author Christian Ohr
26   * @author Marek Vaclavik
27   */
28  @SuppressWarnings("serial")
29  public class HL7v2Exception extends RuntimeException {
30  
31  	private HL7Exception nested;
32  
33  	public HL7v2Exception(HL7Exception nested) {
34          super(nested);
35          this.nested = nested;
36  	}
37  
38      Object getDetail() {
39          return nested.getDetail();
40      }
41  
42      public void setSegmentRepetition(int segmentRepetition) {
43          nested.setSegmentRepetition(segmentRepetition);
44      }
45  
46      public ErrorCode getError() {
47          return nested.getError();
48      }
49  
50      public void setFieldPosition(int pos) {
51          nested.setFieldPosition(pos);
52      }
53  
54      public void setError(ErrorCode errorCode) {
55          nested.setError(errorCode);
56      }
57  
58      public Message populateResponse(Message emptyResponse, AcknowledgmentCode acknowledgmentCode, int repetition) throws HL7Exception {
59          return nested.populateResponse(emptyResponse, acknowledgmentCode, repetition);
60      }
61  
62      public String getMessageWithoutLocation() {
63          return nested.getMessageWithoutLocation();
64      }
65  
66      public Severity getSeverity() {
67          return nested.getSeverity();
68      }
69  
70      public void setResponseMessage(Message responseMessage) {
71          nested.setResponseMessage(responseMessage);
72      }
73  
74      public void setDetail(Object detail) {
75          nested.setDetail(detail);
76      }
77  
78      public void setErrorCode(int errorCode) {
79          nested.setErrorCode(errorCode);
80      }
81  
82      public void setSeverity(Severity severity) {
83          nested.setSeverity(severity);
84      }
85  
86      public int getErrorCode() {
87          return nested.getErrorCode();
88      }
89  
90      public void setSegmentName(String segmentName) {
91          nested.setSegmentName(segmentName);
92      }
93  
94      public Message getResponseMessage() {
95          return nested.getResponseMessage();
96      }
97  
98      public void setLocation(Location location) {
99          nested.setLocation(location);
100     }
101 
102     public Location getLocation() {
103         return nested.getLocation();
104     }
105 
106     @Override
107     public String getMessage() {
108         return nested.getMessage();
109     }
110 }