View Javadoc
1   /*
2    * Copyright 2009 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 static org.apache.commons.lang3.Validate.notNull;
19  
20  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLExternalIdentifier;
21  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLInternationalString;
22  import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.ExternalIdentifierType;
23  
24  /**
25   * Encapsulation of {@link ExternalIdentifierType}.
26   * @author Jens Riemschneider
27   */
28  public class EbXMLExternalIdentifier30 implements EbXMLExternalIdentifier {
29      private final ExternalIdentifierType externalIdentifier;
30      
31      /**
32       * Constructs an external identifier by wrapping the given ebXML 3.0 object.
33       * @param externalIdentifierType
34       *          the object to wrap.
35       */
36      public EbXMLExternalIdentifier30(ExternalIdentifierType externalIdentifierType) {
37          notNull(externalIdentifierType, "externalIdentifierType cannot be null");
38          externalIdentifier = externalIdentifierType;
39      }
40      
41      @Override
42      public String getIdentificationScheme() {
43          return externalIdentifier.getIdentificationScheme();
44      }
45  
46      @Override
47      public EbXMLInternationalString getName() {
48          return new EbXMLInternationalString30(externalIdentifier.getName());
49      }
50  
51      @Override
52      public String getValue() {
53          return externalIdentifier.getValue();
54      }
55  
56      @Override
57      public void setIdentificationScheme(String identificationScheme) {
58          externalIdentifier.setIdentificationScheme(identificationScheme);        
59      }
60  
61      @Override
62      public void setName(EbXMLInternationalString name) {
63          externalIdentifier.setName(((EbXMLInternationalString30)name).getInternal());
64      }
65  
66      @Override
67      public void setValue(String value) {
68          externalIdentifier.setValue(value);
69      }
70  
71      @Override
72      public String getRegistryObject() {
73          return externalIdentifier.getRegistryObject();
74      }
75  
76      @Override
77      public void setRegistryObject(String registryObject) {
78          externalIdentifier.setRegistryObject(registryObject);
79      }
80  
81      @Override
82      public String getId() {
83          return externalIdentifier.getId();
84      }
85  
86      @Override
87      public void setId(String id) {
88          externalIdentifier.setId(id);
89      }
90  }