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 java.util.List;
21  
22  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLSlot;
23  import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.SlotType1;
24  
25  /**
26   * Encapsulation of {@link SlotType1}.
27   * @author Jens Riemschneider
28   */
29  public class EbXMLSlot30 implements EbXMLSlot {
30  
31      public static final int MAX_SLOT_LENGTH = 256;
32      private final SlotType1 slot;
33      
34      /**
35       * Constructs a slot by wrapping the given ebXML 3.0 object.
36       * @param slot
37       *          the object to wrap.
38       */
39      public EbXMLSlot30(SlotType1 slot) {
40          notNull(slot, "slot cannot be null");
41          this.slot = slot;
42      }
43      
44      @Override
45      public String getName() {
46          return slot.getName();
47      }
48  
49      @Override
50      public List<String> getValueList() {
51          return slot.getValueList().getValue();
52      }
53  
54      @Override
55      public int getValueLengthLimit() {
56          return MAX_SLOT_LENGTH;
57      }
58  }