Class XMLFormatter
java.lang.Object
org.apache.openjpa.persistence.jest.XMLFormatter
- All Implemented Interfaces:
ObjectFormatter<Document>
Marshals a root instance and its persistent closure as an XML element.
The closure is resolved against the persistence context that contains the root instance.
The XML document adheres to the
jest-instance.xsd schema.- Author:
- Pinaki Poddar
-
Field Summary
FieldsFields inherited from interface org.apache.openjpa.persistence.jest.ObjectFormatter
dateFormat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencode(jakarta.persistence.metamodel.Metamodel model) Encodes the given meta-model into a new XML document according to JEST Domain XML Schema.encode(Collection<OpenJPAStateManager> sms, jakarta.persistence.metamodel.Metamodel model) Encodes the closure of given collection of managed instance into a new XML document according to JEST Instance XML Schema.Gets the mime type produced by this formatter.newDocument(String rootTag) Create a new document with the given tag as the root element.voidwrite(Document doc, OutputStream out) voidwriteOut(jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) Encodes the given domain model, then write it into the given output stream.writeOut(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) Encodes thepersistent closureof the given collection of objects, then write it into the given output stream.
-
Field Details
-
_xsd
-
_loc
-
-
Constructor Details
-
XMLFormatter
public XMLFormatter()
-
-
Method Details
-
getMimeType
Description copied from interface:ObjectFormatterGets the mime type produced by this formatter.- Specified by:
getMimeTypein interfaceObjectFormatter<Document>
-
encode
public Document encode(Collection<OpenJPAStateManager> sms, jakarta.persistence.metamodel.Metamodel model) Encodes the closure of given collection of managed instance into a new XML document according to JEST Instance XML Schema.- Specified by:
encodein interfaceObjectFormatter<Document>- Parameters:
sm- a collection of managed instances.parent- the parent node to which the new node be attached.- Returns:
- an encoded object e.g. a XML or HTML Document or a JSON object.
-
encode
Encodes the given meta-model into a new XML document according to JEST Domain XML Schema.- Specified by:
encodein interfaceObjectFormatter<Document>- Parameters:
model- a persistent domain model. Must not be null.- Returns:
- an encoded object e.g. a XML or HTML Document or a JSON object.
-
newDocument
Create a new document with the given tag as the root element.- Parameters:
rootTag- the tag of the root element- Returns:
- the document element of a new document
-
writeOut
public Document writeOut(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException Description copied from interface:ObjectFormatterEncodes thepersistent closureof the given collection of objects, then write it into the given output stream.- Specified by:
writeOutin interfaceObjectFormatter<Document>- Parameters:
objs- the collection of objects to be formatted.model- a meta-model of managed types, provided for easier introspection if necessarytitle- TODOdesc- TODOuri- TODO- Throws:
IOException
-
writeOut
public Document writeOut(jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException Description copied from interface:ObjectFormatterEncodes the given domain model, then write it into the given output stream.- Specified by:
writeOutin interfaceObjectFormatter<Document>- Parameters:
model- a meta-model of managed types- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-