|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--uk.ac.ebi.intact.util.XmlBuilder
This utility class provides operations for generating XML, typically in the form of Document or Element objects. The main purpose of having XML genration as a seperate facility is to allow generation of "partial" XML documents which are only completed when necessary. Tools such as Castor only provide the means to generate a complete XML document, which can become very memory-intensive for large data sets.
| Field Summary | |
static int |
CONTRACT_NODES
identifies a contract request |
static int |
EXPAND_NODES
Identifies an expand request |
| Constructor Summary | |
XmlBuilder()
Note that this default constructor will build a default IntactHelper object with default configuration settings. |
|
XmlBuilder(IntactHelper helper)
Sets up an XML builder with suitable persistent store access. |
|
| Method Summary | |
org.w3c.dom.Element |
buildCompactElem(java.lang.Object item)
Provides a 'compact' expansion of an object. |
org.w3c.dom.Element |
buildFullElem(java.lang.Object obj)
Provides a 'complete' expansion of an object. |
org.w3c.dom.Element |
buildPartialElem(java.lang.Object obj,
java.util.Collection fieldsToIgnore)
Provides a 'partial' expansion of an object. |
org.w3c.dom.Document |
buildXml(java.util.Collection items)
This method builds an XML Document for a Collection of objects. |
org.w3c.dom.Document |
buildXml(java.lang.Object obj)
Convenience method to build a Document for one object only. |
org.w3c.dom.Document |
modifyDoc(org.w3c.dom.Document dc,
java.util.Collection ids,
int mode)
This method allows for modification of a given Document. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int EXPAND_NODES
public static final int CONTRACT_NODES
| Constructor Detail |
public XmlBuilder(IntactHelper helper)
throws IntactException
helper - The intact helper instance used by the caller - this allows the builder to
use the same data store access configurations.
IntactException - thrown if no helper object was supplied
public XmlBuilder()
throws IntactException
IntactHlper
instance is used.
IntactException - thrown if even a default helper object could not be created.| Method Detail |
public org.w3c.dom.Document buildXml(java.lang.Object obj)
throws javax.xml.parsers.ParserConfigurationException
obj - The object for which we want a Document built
javax.xml.parsers.ParserConfigurationException - thrown if t6here was a problem parsing
public org.w3c.dom.Document buildXml(java.util.Collection items)
throws javax.xml.parsers.ParserConfigurationException
modifyDoc
method. It is assumed that all objects passed as parameters will have a non-null
AC attribute set to allow for cacheing.
items - The group of objects for which an XML format is required
javax.xml.parsers.ParserConfigurationException - thrown if it was not possible to create a document builder
public org.w3c.dom.Document modifyDoc(org.w3c.dom.Document dc,
java.util.Collection ids,
int mode)
throws javax.xml.parsers.ParserConfigurationException
dc - The Document to be expandedids - A Collection of the items (identified by AC) to be expandedmode - The mode of operation to be carried out (eg expand, contract etc)
javax.xml.parsers.ParserConfigurationException - thrown if a document builder could not be created
public org.w3c.dom.Element buildCompactElem(java.lang.Object item)
throws javax.xml.parsers.ParserConfigurationException
NB the 'Timestamp' considered here is the java.sql.Timestamp class - this may, therefore, be intact-specific.
item - The object to expand
javax.xml.parsers.ParserConfigurationException - thrown if a document builder could not be created
java.lang.NullPointerException - if a null object parameter is supplied
public org.w3c.dom.Element buildFullElem(java.lang.Object obj)
throws javax.xml.parsers.ParserConfigurationException
obj - The object to expand
javax.xml.parsers.ParserConfigurationException - thrown if a document builder could not be created
java.lang.NullPointerException - If the argument object is null
public org.w3c.dom.Element buildPartialElem(java.lang.Object obj,
java.util.Collection fieldsToIgnore)
throws javax.xml.parsers.ParserConfigurationException
obj - The object to expandfieldsToIgnore - The object fields which should not be expanded. Expected to be Strings.
javax.xml.parsers.ParserConfigurationException - thron if a document builder could not be created
java.lang.NullPointerException - If the argument object is null
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||