View Javadoc
1   /**
2   The contents of this file are subject to the Mozilla Public License Version 1.1 
3   (the "License"); you may not use this file except in compliance with the License. 
4   You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
5   Software distributed under the License is distributed on an "AS IS" basis, 
6   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
7   specific language governing rights and limitations under the License. 
8   
9   The Original Code is "StructureDef.java".  Description: 
10  "Information about a structure within a message (e.g" 
11  
12  The Initial Developer of the Original Code is University Health Network. Copyright (C) 
13  2001.  All Rights Reserved. 
14  
15  Contributor(s): ______________________________________. 
16  
17  Alternatively, the contents of this file may be used under the terms of the 
18  GNU General Public License (the  �GPL�), in which case the provisions of the GPL are 
19  applicable instead of those above.  If you wish to allow use of your version of this 
20  file only under the terms of the GPL and not to allow others to use your version 
21  of this file under the MPL, indicate your decision by deleting  the provisions above 
22  and replace  them with the notice and other provisions required by the GPL License.  
23  If you do not delete the provisions above, a recipient may use your version of 
24  this file under either the MPL or the GPL. 
25  
26  */
27  
28  package ca.uhn.hl7v2.sourcegen;
29  
30  import java.util.List;
31  
32  import ca.uhn.hl7v2.model.Group;
33  
34  /**
35   * Information about a structure within a message (eg group, segment) 
36   * that is used in creating source for a Group class. 
37   * @author Bryan Tripp (bryan_tripp@sourceforge.net)
38   */
39  public interface StructureDef {
40  
41  	/**
42  	 * For superstructures, returns the message structures this structure is associated with
43  	 */
44      List<String> getAssociatedStructures();
45  	
46      /**
47       * Returns the name of the structure.
48       */
49      String getName();
50      
51      /**
52       * Returns a text description of the structure.
53       */
54      String getDescription();
55      
56      /**
57       * Returns true if this structure is required in the Group.  
58       */
59      boolean isRequired();
60  
61      /**
62       * @see Group#isChoiceElement(String)
63       */
64      boolean isChoice();
65      
66      /**
67       * Returns true if this structure is a segment.  
68       */
69      boolean isSegment();
70      
71      /**
72       * Returns true if this structure can repeat in the Group.  
73       */
74      boolean isRepeating();
75  
76      /**
77       * Returns true if this structure can repeat in the Group.  
78       */
79      boolean isGroup();
80      
81      /**
82       * Returns a list of the names of the segments that are children of this Structure.  
83       * If the structure is a Segment, a 1-element array is returned containing the segment 
84       * name.  If a Group, an array of all the segments in the Group, including those nested
85       * in subgroups (depth first).  This method is used to support the XML SIG's convention 
86       * for deriving group names. 
87       */
88      String[] getChildSegments();
89      
90      /**
91       * @return Returns the name without any prefix qualification. This is only different for
92       * group definitions, where the qualification is the message type (i.e. this will 
93       * return PROCEDURE instead of ADT_A01_PROCEDURE)
94       */
95      String getUnqualifiedName();
96      
97      /** 
98       * Returns the name by which a particular structure can be accessed (eg for use 
99       * in writing accessor source code).  This may differ from the class name of the 
100      * structure of there are >1 structures in the same group with the same class.  
101      * For example in ADT_A01 there are two ROL's that are not in sub-groups - AbstractGroup 
102      * stores the first one under the name ROL and the second under the name ROL2.  This 
103      * method returns names using the same naming scheme.  The order in which this 
104      * method is called matters: it should be called ONCE for each element of the group in the 
105      * order in which they appear.  
106      */
107     String getIndexName();
108     
109     /**
110      * {@see #getIndexName()}
111      */
112     void setIndexName(String theIndexName);
113 }
114