Class XmlConverter
java.lang.Object
com.aquima.interactions.profile.xml.XmlConverter
Utility class to export a profile to XML, and to fill a profile with the values from an (exported) XML.
- Since:
- 5.0
- Author:
- O. Kerpershoek
-
Constructor Summary
ConstructorsConstructorDescriptionXmlConverter
(IMetaModel model) Constructs a profile XML converter for the specified meta model using the default XML delegate.XmlConverter
(IMetaModel model, IXmlDelegate xmlDelegate) Constructs a profile XML converter for the specified meta model and XML delegate. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance
acquireInstance
(IProfile profile, IXmlNode entityNode) protected IPrimitiveValue
convertValue
(Map<String, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> instanceLookupMap, IAttributeDefinition attrDefinition, String strValue) protected List
<com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> createInstances
(IProfile profile, IXmlNode[] entityNodes, Map<String, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> instancesLookup) protected XmlNewElement
exportAttribute
(IAttributeValue attributeValue) protected XmlNewElement
exportInstance
(IEntityInstance instance) This method converts the profile to an XML string (UTF-8 encoded with header).exportXmlElement
(IProfile profile, String typeId) This method converts the profile to an XML element.protected IValue
getValue
(Map<String, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> instanceLookupMap, IAttributeDefinition attrDefinition, IXmlNode attributeNode) protected void
importInstance
(Map<String, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> instanceLookupMap, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance xmlInstance) void
This method uses the XML node passed to it, and imports the instance and values definitions into the profile.void
This method parses the xml file passed, and imports the instance and values definitions into the profile.protected boolean
isSingletonInstance
(IntegerValue instanceId)
-
Constructor Details
-
XmlConverter
Constructs a profile XML converter for the specified meta model using the default XML delegate.- Parameters:
model
- The meta model definition for the XML converter (mandatory).- See Also:
-
XmlConverter
Constructs a profile XML converter for the specified meta model and XML delegate.- Parameters:
model
- The meta model definition for the XML converter (mandatory).xmlDelegate
- The XML delegate that should be used in the import and export methods (mandatory).
-
-
Method Details
-
exportXml
This method converts the profile to an XML string (UTF-8 encoded with header). An optional type-id parameter may be provided to identify the profile XML. When the type id parameter is provided, an additional event tag will be included in the XML with this value.- Parameters:
profile
- The profile that should be converted to XML.typeId
- Optional parameter that can be used to specify the type of the profile XML.- Returns:
- String containing the XML representation of the profile contents.
- Throws:
AppException
- This exception is thrown when the export failed due to a definition error (for instance an unknown entity).
-
exportXmlElement
This method converts the profile to an XML element. An optional type-id parameter may be provided to identify the profile XML. When the type id parameter is provided, an additional event tag will be included in the XML with this value.- Parameters:
profile
- The profile that should be converted to XML.typeId
- Optional parameter that can be used to specify the type of the profile XML.- Returns:
- IXMLElement containing the XML representation of the profile contents.
- Throws:
AppException
- This exception is thrown when the export failed due to a definition error (for instance an unknown entity).
-
exportInstance
-
exportAttribute
-
importXml
This method parses the xml file passed, and imports the instance and values definitions into the profile. An empty xml file passed to this method will be ignored.- Parameters:
profile
- The profile that should be used to import the xml in (mandatory).xml
- The string containing a profile export (optional).- Throws:
AppException
- This exception is thrown when the import failed due to a definition error (for instance an unknown entity).
-
importXml
This method uses the XML node passed to it, and imports the instance and values definitions into the profile.- Parameters:
profile
- The profile that should be used to import the xml in (mandatory).profileNode
- The XML node containing a profile export (mandatory).- Throws:
AppException
- This exception is thrown when the import failed due to a definition error (for instance an unknown entity).
-
importInstance
-
getValue
protected IValue getValue(Map<String, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> instanceLookupMap, IAttributeDefinition attrDefinition, IXmlNode attributeNode) -
convertValue
protected IPrimitiveValue convertValue(Map<String, com.aquima.interactions.profile.xml.XmlConverter.XmlEntityInstance> instanceLookupMap, IAttributeDefinition attrDefinition, String strValue) -
createInstances
-
acquireInstance
-
isSingletonInstance
-