EntityToElementStrategy
- public class EntityToElementStrategy implements ToElementStrategy
Base class for the generation of a JDOM (XML) representation for entities.
Record and RecordType entities use this class only. Properties, Parents, Files and other entities have specialized sub classes.
- Author:
Timm Fitschen
Fields
tagName
Constructors
EntityToElementStrategy
Methods
addPermissions
- protected void addPermissions(EntityInterface entity, Element element)
addToElement
- public Element addToElement(EntityInterface entity, Element parent, SerializeFieldStrategy serializeFieldStrategy)
setDatatype
- public void setDatatype(EntityInterface entity, Element element)
Set the data type of this entity as a JDOM
Attribute
of the given element.If the data type has a name, the name is used, otherwise the id is used.
- Parameters:
entity –
element –
setValue
- public void setValue(EntityInterface entity, Element element, SerializeFieldStrategy serializeFieldStrategy)
Set the value of the entity.
The setFieldStrategy decides if the value is to be set at all.
If the value is a reference, the setFieldStrategy decides whether the referenced entity is added as a deep Element tree (as a whole, so to speak) or just the ID of the referenced entity.
- Parameters:
entity –
element –
serializeFieldStrategy –
sparseEntityToElement
- public void sparseEntityToElement(Element element, EntityInterface entity, SerializeFieldStrategy serializeFieldStrategy)
Set all properties of the entity that are considered to be part of the sparse entity, e.g. name, description, etc, as
Attribute
of the given element.The setFieldStrategy decides which attributes are set if present and which are omitted in any case.
- Parameters:
element –
entity –
serializeFieldStrategy –
toElement
- public Element toElement(EntityInterface entity, SerializeFieldStrategy serializeFieldStrategy)