@Component public class LongFreeTextDatatype extends Object implements CustomDatatype<String>
CustomDatatype.Summary
Constructor and Description |
---|
LongFreeTextDatatype() |
Modifier and Type | Method and Description |
---|---|
String |
fromReferenceString(String referenceString)
Converts a reference string to its typed value.
|
String |
getReferenceStringForValue(String typedValue)
Gets the reference string that would be persisted for the given typed value.
|
CustomDatatype.Summary |
getTextSummary(String referenceString)
Converts a reference string to a short (generally < 100 characters) plain-text representation of its value.
|
String |
save(String typedValue,
String existingValueReference)
The OpenMRS service layer calls this method when a custom value of this datatype is saved (created or edited).
|
void |
setConfiguration(String config)
A
CustomValueDescriptor defines both a datatype and its configuration (e.g. a regex for a RegexValidatedString datatype). |
void |
validate(String typedValue)
Validates the given value to see if it is a legal value for the given handler.
|
public void setConfiguration(String config)
CustomDatatype
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.setConfiguration
in interface CustomDatatype<String>
CustomDatatype.setConfiguration(java.lang.String)
public String save(String typedValue, String existingValueReference) throws InvalidCustomValueException
CustomDatatype
save
in interface CustomDatatype<String>
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
CustomDatatype.save(java.lang.Object, java.lang.String)
public String getReferenceStringForValue(String typedValue) throws UnsupportedOperationException
CustomDatatype
getReferenceStringForValue
in interface CustomDatatype<String>
UnsupportedOperationException
- if it is not feasible to calculate this efficiently (e.g. you'd need to go to remote storage)CustomDatatype.getReferenceStringForValue(java.lang.Object)
public String fromReferenceString(String referenceString) throws InvalidCustomValueException
CustomDatatype
fromReferenceString
in interface CustomDatatype<String>
InvalidCustomValueException
- if the persisted value is illegal (perhaps because datatype configuration
was changed since this value was persisted)CustomDatatype.fromReferenceString(java.lang.String)
public CustomDatatype.Summary getTextSummary(String referenceString)
CustomDatatype
getTextSummary
in interface CustomDatatype<String>
CustomDatatype.getTextSummary(java.lang.String)
public void validate(String typedValue) throws InvalidCustomValueException
CustomDatatype
validate
in interface CustomDatatype<String>
InvalidCustomValueException
CustomDatatype.validate(java.lang.Object)
Copyright © 2024 OpenMRS Inc.. All rights reserved.