001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.exceptions.FHIRException;
035
036public enum ListOrder {
037
038  /**
039   * The list was sorted by a user. The criteria the user used are not specified.
040   */
041  USER,
042  /**
043   * The list was sorted by the system. The criteria the user used are not
044   * specified; define additional codes to specify a particular order (or use
045   * other defined codes).
046   */
047  SYSTEM,
048  /**
049   * The list is sorted by the data of the event. This can be used when the list
050   * has items which are dates with past or future events.
051   */
052  EVENTDATE,
053  /**
054   * The list is sorted by the date the item was added to the list. Note that the
055   * date added to the list is not explicit in the list itself.
056   */
057  ENTRYDATE,
058  /**
059   * The list is sorted by priority. The exact method in which priority has been
060   * determined is not specified.
061   */
062  PRIORITY,
063  /**
064   * The list is sorted alphabetically by an unspecified property of the items in
065   * the list.
066   */
067  ALPHABETIC,
068  /**
069   * The list is sorted categorically by an unspecified property of the items in
070   * the list.
071   */
072  CATEGORY,
073  /**
074   * The list is sorted by patient, with items for each patient grouped together.
075   */
076  PATIENT,
077  /**
078   * added to help the parsers
079   */
080  NULL;
081
082  public static ListOrder fromCode(String codeString) throws FHIRException {
083    if (codeString == null || "".equals(codeString))
084      return null;
085    if ("user".equals(codeString))
086      return USER;
087    if ("system".equals(codeString))
088      return SYSTEM;
089    if ("event-date".equals(codeString))
090      return EVENTDATE;
091    if ("entry-date".equals(codeString))
092      return ENTRYDATE;
093    if ("priority".equals(codeString))
094      return PRIORITY;
095    if ("alphabetic".equals(codeString))
096      return ALPHABETIC;
097    if ("category".equals(codeString))
098      return CATEGORY;
099    if ("patient".equals(codeString))
100      return PATIENT;
101    throw new FHIRException("Unknown ListOrder code '" + codeString + "'");
102  }
103
104  public String toCode() {
105    switch (this) {
106    case USER:
107      return "user";
108    case SYSTEM:
109      return "system";
110    case EVENTDATE:
111      return "event-date";
112    case ENTRYDATE:
113      return "entry-date";
114    case PRIORITY:
115      return "priority";
116    case ALPHABETIC:
117      return "alphabetic";
118    case CATEGORY:
119      return "category";
120    case PATIENT:
121      return "patient";
122    case NULL:
123      return null;
124    default:
125      return "?";
126    }
127  }
128
129  public String getSystem() {
130    return "http://terminology.hl7.org/CodeSystem/list-order";
131  }
132
133  public String getDefinition() {
134    switch (this) {
135    case USER:
136      return "The list was sorted by a user. The criteria the user used are not specified.";
137    case SYSTEM:
138      return "The list was sorted by the system. The criteria the user used are not specified; define additional codes to specify a particular order (or use other defined codes).";
139    case EVENTDATE:
140      return "The list is sorted by the data of the event. This can be used when the list has items which are dates with past or future events.";
141    case ENTRYDATE:
142      return "The list is sorted by the date the item was added to the list. Note that the date added to the list is not explicit in the list itself.";
143    case PRIORITY:
144      return "The list is sorted by priority. The exact method in which priority has been determined is not specified.";
145    case ALPHABETIC:
146      return "The list is sorted alphabetically by an unspecified property of the items in the list.";
147    case CATEGORY:
148      return "The list is sorted categorically by an unspecified property of the items in the list.";
149    case PATIENT:
150      return "The list is sorted by patient, with items for each patient grouped together.";
151    case NULL:
152      return null;
153    default:
154      return "?";
155    }
156  }
157
158  public String getDisplay() {
159    switch (this) {
160    case USER:
161      return "Sorted by User";
162    case SYSTEM:
163      return "Sorted by System";
164    case EVENTDATE:
165      return "Sorted by Event Date";
166    case ENTRYDATE:
167      return "Sorted by Item Date";
168    case PRIORITY:
169      return "Sorted by Priority";
170    case ALPHABETIC:
171      return "Sorted Alphabetically";
172    case CATEGORY:
173      return "Sorted by Category";
174    case PATIENT:
175      return "Sorted by Patient";
176    case NULL:
177      return null;
178    default:
179      return "?";
180    }
181  }
182
183}