|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.miningmart.m4.utils.M4Xml
Constructor Summary | |
M4Xml()
|
Method Summary | |
static java.lang.String |
createClosingTag(java.lang.String tagName)
|
static java.lang.Object |
createObjectFromXml(java.lang.String tag,
java.lang.String embedded)
This is a service method for importing from XML. |
static java.lang.String |
createOpeningTag(java.lang.String tagName)
|
static java.lang.String |
createXmlDescription(XmlInfo m4o,
M4InfoEntry entry,
java.io.Writer out,
java.util.Collection dependent)
Method creating an XML description of an attribute. |
static long |
export(XmlInfo m4d,
java.io.Writer out,
java.util.Collection dependent)
This method serializes a given object and writes the String using
a given Writer object. |
static void |
exportCase(Case m4Case,
java.io.Writer writer)
|
static java.util.Collection |
exportContainedObjects(XmlInfo m4d,
java.io.Writer out,
java.util.Collection dependent)
|
static java.lang.Long |
getExistingXmlId(XmlInfo object)
|
static Case |
importCase(java.io.InputStream in,
DB db,
java.lang.String xmlVersion)
Import a Case from the given input stream. |
static java.lang.String |
putInXmlTags(java.lang.String text,
java.lang.String xmlTag)
Simple service method. |
static java.lang.String |
serializeM4DataCollection(java.util.Collection col,
java.io.Writer out,
java.util.Collection dependent)
Service method to serialize an arbitrary Collection
of M4Data objects to XML. |
static long |
setNewXmlId(XmlInfo object)
|
static java.lang.String[] |
stripOuterTag(java.lang.String xml)
|
static java.lang.Long |
xmlImport(XmlInfo m4d,
java.lang.String description)
Sets the fields of this object according to the provided XML description |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public M4Xml()
Method Detail |
public static java.lang.Long getExistingXmlId(XmlInfo object)
public static long setNewXmlId(XmlInfo object)
public static void exportCase(Case m4Case, java.io.Writer writer) throws java.io.IOException
java.io.IOException
public static long export(XmlInfo m4d, java.io.Writer out, java.util.Collection dependent) throws java.io.IOException
String
using
a given Writer
object. All objects referenced by this object will
also be serialized (before) and be referenced by their XML ID.
To be able to reach all objects of a specified Case
it is necessary
to collect all objects referencing this
object. Thus the method
will add all objects not yet serialized and having a reference to (!)
this
object to the given Collection
.
out
- the Writer
to write the serialization
String
todependent
- a Collection
to be filled with objects referencing
this
object
this
object. Please note that this ID is
different from the object's M4 ID! A return value of 0
indicates
that the object was not exported but skipped, because it refers to the relational
level which is not to be exported.
java.io.IOException
public static java.util.Collection exportContainedObjects(XmlInfo m4d, java.io.Writer out, java.util.Collection dependent) throws java.io.IOException
out
- the Writer
object to write the serialization withdependent
- a Collection
of objects referencing the objects
already serialized
Collection
of String
s, each of which
is a reference to a primitive datatype, or an XML Id reference to an
M4Data
Java object this
object holds a foreign
key reference to.
java.io.IOException
public static java.lang.String createXmlDescription(XmlInfo m4o, M4InfoEntry entry, java.io.Writer out, java.util.Collection dependent) throws M4Exception, java.io.IOException
entry
- an M4InfoEntry
describing one of this
objects attributes and the corresponding getter and datatype.out
- a Writer
for writing serialization of referenced objects
to if not yet done.dependent
- a Collection
of objects referencing the objects
already serialized. Just to be used when calling export
for
another object referenced by this
object.
null
, if the value of the entry was null
.
M4Exception
java.io.IOException
public static java.lang.String serializeM4DataCollection(java.util.Collection col, java.io.Writer out, java.util.Collection dependent) throws M4Exception, java.io.IOException
Collection
of M4Data
objects to XML.
col
- the Collection
of XmlInfo
objectsout
- the Writer
of the serializationdependent
- the Collection
of dependent objects
String
describing the collection or null
if the Collection
was null
or empty
M4Exception
java.io.IOException
public static java.lang.String putInXmlTags(java.lang.String text, java.lang.String xmlTag)
text
- a text to put in XML tags.xmlTag
- the tag text without > and <
String
public static java.lang.String createOpeningTag(java.lang.String tagName)
public static java.lang.String createClosingTag(java.lang.String tagName)
public static Case importCase(java.io.InputStream in, DB db, java.lang.String xmlVersion) throws java.io.IOException, XmlException, M4Exception
java.io.IOException
XmlException
M4Exception
public static java.lang.Long xmlImport(XmlInfo m4d, java.lang.String description) throws M4Exception, XmlException
M4Exception
XmlException
public static java.lang.String[] stripOuterTag(java.lang.String xml)
xml
- an XML String
to be split into tag and embedded
String
String[3]
object with String[0]
: the tagString[1]
: the embedded String
String[2]
: the substring after the closing tag
String
could be split, and
null
otherwise.public static java.lang.Object createObjectFromXml(java.lang.String tag, java.lang.String embedded) throws XmlException
tag
- the name of the tag (case sensitive)embedded
- the text between the opening and closing tag
null
is never returned.
XmlException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |