EhrDatatype

public abstract class EhrDatatype

This is the base class for all data types included in a generic Archetype, as defined by the OpenEHR ADL structure

Fields

datatypeChangeListener

protected EhrDatatypeChangeListener datatypeChangeListener

The datatype change listener.

path

protected String path

The path of the datatype

Methods

fromJSON

public abstract void fromJSON(JSONObject data)

Load the new content of this datatype from a json schema.

Parameters:
  • data – the json structure representing this datatype
Throws:
  • InvalidDatatypeException – the invalid datatype exception
  • JSONException – if a malformed json structure was provided

getPath

public String getPath()

Gets the path of this datatype

Returns:the path

isCluster

public boolean isCluster()
Returns:True if this datatype is a container for other datatypes, False otherwise

isInnerArchetype

public boolean isInnerArchetype()
Returns:True if this datatype is an archetype itself False otherwise

setAttributes

protected abstract void setAttributes(JSONObject attributes)

Sets the attributes for this datatype. Generally, different datatypes have different attributes.

Parameters:
  • attributes – the json structure containing all the attributes of this datatype.
Throws:
  • JSONException – if a malformed json structure was provided

setDatatypeChangeListener

public void setDatatypeChangeListener(EhrDatatypeChangeListener datatypeChangeListener)

Sets the Event listener interface for ‘change’ events.

Parameters:
  • datatypeChangeListener – the Listener where to notify any content modification of this datatype

setPath

protected void setPath(String path)

Sets the path of this datatype.

Parameters:
  • path – the new path

toJSON

public abstract JSONObject toJSON()

Get the json structure representing the current state of this datatype.

Returns:the JSON structure representing the current state of this datatype