public class FormUtil
extends java.lang.Object
Form
,
FormField
,
Field
,
FieldType
,
FieldAnswer
Constructor and Description |
---|
FormUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
conceptToString(Concept concept,
ConceptName localizedName)
Turn the given concept/concept-name pair into a string acceptable for hl7 and forms
|
static java.lang.String |
conceptToString(Concept concept,
java.util.Locale locale)
Turn the given concept into a string acceptable to for hl7 and forms
|
static java.lang.String |
dateToString() |
static java.lang.String |
dateToString(java.util.Date date) |
static java.lang.String |
drugToString(Drug drug)
Turn the given drug into a string acceptable for hl7 and forms
|
static java.util.TreeMap<java.lang.Integer,java.util.TreeSet<FormField>> |
getFormStructure(Form form)
Returns a sorted and structured map of
FormField s for the given OpenMRS form. |
static java.lang.String |
getFormUriWithoutExtension(Form form)
Get a string somewhat unique to this form.
|
static java.lang.String |
getNewTag(java.lang.String s,
java.util.Vector<java.lang.String> tagList)
Generates a new, unique tag name for any given string
|
static java.lang.String |
getXmlToken(java.lang.String s)
Converts a string into a valid XML token (tag name)
|
public static java.lang.String getXmlToken(java.lang.String s)
s
- string to convert into XML tokenpublic static java.lang.String getNewTag(java.lang.String s, java.util.Vector<java.lang.String> tagList)
s
- string to convert into a unique XML tagtagList
- java.util.Vector containing all previously created tags. If the tagList is
null, it will be initialized automaticallytagList
)public static java.util.TreeMap<java.lang.Integer,java.util.TreeSet<FormField>> getFormStructure(Form form)
FormField
s for the given OpenMRS form.
The root sections of the schema are stored under a key of zero (i.e.,
java.lang.Integer.valueOf(0)
). All other entries represent sequences of
children stored under the identifier (formField.getFormFieldId()
) of
their parent FormField. The form structure is sorted by the natural sorting order of the
FormField
s (as defined by the .equals() and .compareTo()
methods).form
- form for which structure is requestedFormField
s, where the top-level fields are under the key
zero and all other leaves are stored under their parent FormField
's id.public static java.lang.String dateToString()
public static java.lang.String dateToString(java.util.Date date)
public static java.lang.String getFormUriWithoutExtension(Form form)
form
- Form to get the uri forpublic static java.lang.String conceptToString(Concept concept, java.util.Locale locale)
concept
- Concept to convert to a stringlocale
- Locale to use for the concept namepublic static java.lang.String conceptToString(Concept concept, ConceptName localizedName)
concept
- Concept to convert to a stringlocalizedName
- specific localized concept-namepublic static java.lang.String drugToString(Drug drug)
drug
- Drug to convert to a stringCopyright © 2018 OpenMRS Inc.. All Rights Reserved.