T
- the Java class used for typed valuespublic interface CustomDatatype<T>
Modifier and Type | Interface and Description |
---|---|
static class |
CustomDatatype.Summary
A short reprepresentation of a custom value, along with an indication of whether this is the complete value,
or just a summary.
|
Modifier and Type | Method and Description |
---|---|
T |
fromReferenceString(java.lang.String referenceString)
Converts a reference string to its typed value.
|
java.lang.String |
getReferenceStringForValue(T typedValue)
Gets the reference string that would be persisted for the given typed value.
|
CustomDatatype.Summary |
getTextSummary(java.lang.String referenceString)
Converts a reference string to a short (generally < 100 characters) plain-text representation of its value.
|
java.lang.String |
save(T typedValue,
java.lang.String existingValueReference)
The OpenMRS service layer calls this method when a custom value of this datatype is saved (created or edited).
|
void |
setConfiguration(java.lang.String config)
A
CustomValueDescriptor defines both a datatype and its configuration (e.g. |
void |
validate(T typedValue)
Validates the given value to see if it is a legal value for the given handler.
|
void setConfiguration(java.lang.String config)
CustomValueDescriptor
defines both a datatype and its configuration (e.g. a regex for a RegexValidatedString datatype).
The framework will instantiate datatypes and call this method to set that configuration. Subclasses should define the format
of this configuration.config
- java.lang.String save(T typedValue, java.lang.String existingValueReference) throws InvalidCustomValueException
typedValue
- existingValueReference
- If null, the custom value is being saved for the first time. If not null, this custom value has
been saved before with the given reference. Implementations may choose to return the same value reference if they are overwriting
the old value on remote storage.InvalidCustomValueException
java.lang.String getReferenceStringForValue(T typedValue) throws java.lang.UnsupportedOperationException
typedValue
- java.lang.UnsupportedOperationException
- if it is not feasible to calculate this efficiently (e.g. you'd need to go to remote storage)T fromReferenceString(java.lang.String referenceString) throws InvalidCustomValueException
referenceString
- InvalidCustomValueException
- if the persisted value is illegal (perhaps because datatype configuration
was changed since this value was persisted)CustomDatatype.Summary getTextSummary(java.lang.String referenceString)
referenceString
- void validate(T typedValue) throws InvalidCustomValueException
typedValue
- InvalidCustomValueException
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.