View Javadoc
1   /*
2    * Copyright 2011 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.commons.ihe.xds.core.ebxml.ebxml30;
17  
18  import org.apache.commons.lang3.Validate;
19  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLRegistryError;
20  import org.openehealth.ipf.commons.ihe.xds.core.responses.Severity;
21  import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.RegistryError;
22  
23  /**
24   * @author Dmytro Rud
25   */
26  public class EbXMLRegistryError30 implements EbXMLRegistryError {
27      private final RegistryError error;
28  
29      public EbXMLRegistryError30(RegistryError error) {
30          Validate.notNull(error, "registry error object cannot be null");
31          this.error = error;
32      }
33  
34      @Override
35      public String getCodeContext() {
36          return error.getCodeContext();
37      }
38  
39      @Override
40      public void setCodeContext(String codeContext) {
41          error.setCodeContext(codeContext);
42      }
43  
44      @Override
45      public String getErrorCode() {
46          return error.getErrorCode();
47      }
48  
49      @Override
50      public void setErrorCode(String errorCode) {
51          error.setErrorCode(errorCode);
52      }
53  
54      @Override
55      public Severity getSeverity() {
56          return Severity.valueOfOpcode30(error.getSeverity());
57      }
58  
59      @Override
60      public void setSeverity(Severity severity) {
61          error.setSeverity(severity.getOpcode30());
62      }
63  
64      @Override
65      public String getLocation() {
66          return error.getLocation();
67      }
68  
69      @Override
70      public void setLocation(String location) {
71          error.setLocation(location);
72      }
73  
74      public RegistryError getInternal() {
75          return error;
76      }
77  }