|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.clients.web.plugins.XMLTemplate
public class XMLTemplate
A XML template that exports data in a simple one-level XML format.
| Field Summary | |
|---|---|
private Writer |
exportStream
|
private Element |
itemElement
|
private String |
itemIdPrefix
|
private Item |
itemType
|
private static Pattern |
NEWLINE
|
private List<ExportedProperty> |
properties
|
private XMLOutputter |
xmlOut
|
| Constructor Summary | |
|---|---|
XMLTemplate(Writer exportStream,
List<ExportedProperty> properties,
Item itemType)
Create a new template. |
|
| Method Summary | |
|---|---|
void |
beginDocument()
Write XML start (<? |
void |
beginItem(int id)
Begin a new item element. |
void |
endDocument()
Close the document tags. |
void |
endItem()
Write the current item element to the export stream. |
private String |
escape(String data)
|
String |
getDefaultFileExtension()
Get the default file extension to give to files generated by this template. |
String |
getMimeType()
Get the MIME type to assign to files generated by this template. |
void |
writeAnnotations(ExportedProperty ep,
List<?> values,
String unit)
Add annotation values to the current item element. |
void |
writeCollection(ExportedProperty ep,
Collection<?> values)
Add collection values to the current item element. |
void |
writeHeaders()
Write property and annotation definitions. |
void |
writeProperty(ExportedProperty ep,
Object data)
Add the property value to the current item element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final XMLOutputter xmlOut
private final Writer exportStream
private final List<ExportedProperty> properties
private final Item itemType
private final String itemIdPrefix
private Element itemElement
private static final Pattern NEWLINE
| Constructor Detail |
|---|
public XMLTemplate(Writer exportStream,
List<ExportedProperty> properties,
Item itemType)
exportStream - The stream to write toproperties - All exported propertiesitemType - The type of items we are exporting| Method Detail |
|---|
public String getMimeType()
ExportTemplate
getMimeType in interface ExportTemplatepublic String getDefaultFileExtension()
ExportTemplate
getDefaultFileExtension in interface ExportTemplate
public void beginDocument()
throws IOException
beginDocument in interface ExportTemplateIOException - If there is an error
public void writeHeaders()
throws IOException
writeHeaders in interface ExportTemplateIOException - If there is an error
public void beginItem(int id)
throws IOException
beginItem in interface ExportTemplateid - Id of the new item.
IOException - If there is an error
public void writeAnnotations(ExportedProperty ep,
List<?> values,
String unit)
throws IOException
writeAnnotations in interface ExportTemplateep - Exported property the annotations belongs tovalues - Annotation values to be written.unit - The unit of the annotation values, or null
to not display write a unit
IOException - If there is an error
public void writeProperty(ExportedProperty ep,
Object data)
writeProperty in interface ExportTemplateep - The exported property the data belongs to.data - Data to be written.
public void writeCollection(ExportedProperty ep,
Collection<?> values)
throws IOException
writeCollection in interface ExportTemplateep - Exported property the values belong tovalues - The values to be written
IOException
public void endItem()
throws IOException
endItem in interface ExportTemplateIOException - If there is an error
public void endDocument()
throws IOException
endDocument in interface ExportTemplateIOException - If there is an errorprivate String escape(String data)
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||