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;
17  
18  import java.util.List;
19  
20  /**
21   * Provides access to slots and their values.
22   * @author Jens Riemschneider
23   */
24  public interface EbXMLSlotList {
25      /**
26       * @return the complete list of all slots.
27       */
28      List<EbXMLSlot> getSlots();
29      
30      /**
31       * Returns a filtered list of the slots.
32       * @param slotName
33       *          name of the slots.
34       * @return the list of slots named with the given slot name.
35       */
36      List<EbXMLSlot> getSlots(String slotName);
37      
38      /**
39       * Adds a slot with a list of values.
40       * @param slotName
41       *          the slot name.
42       * @param slotValues
43       *          the slot values. The slot will not be created if this parameter is
44       *          empty or <code>null</code>.
45       */
46      void addSlot(String slotName, String... slotValues);
47      
48      /**
49       * Gets the values of a slot.
50       * @param slotName
51       *          the name of the slot. It is expected that the name is only used for
52       *          a single slot. Use {@link #getSlots(String)} if it is possible that
53       *          the name is used multiple times.
54       * @return the list of slot values.
55       */
56      List<String> getSlotValues(String slotName);
57  
58      /**
59       * Gets a single slot value. 
60       * @param slotName
61       *          the name of the slot. It is expected that the name is only used for
62       *          a single slot. Use {@link #getSlots(String)} if it is possible that
63       *          the name is used multiple times.
64       * @return the first slot value. Other slot values are ignored. Can be 
65       *          <code>null</code> if the slot does not exist, has no slot values 
66       *          or the value is <code>null</code>.
67       */
68      String getSingleSlotValue(String slotName);
69  }