use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class EmbeddedDashboardConfig method createFromXml.
/**
* Create line chart settings object from XML document
*
* @param xml XML document
* @return deserialized object
* @throws Exception if the object cannot be fully deserialized
*/
public static EmbeddedDashboardConfig createFromXml(final String xml) throws Exception {
Serializer serializer = new Persister();
EmbeddedDashboardConfig config = serializer.read(EmbeddedDashboardConfig.class, xml);
// fix configuration if it was saved in old format
if ((config.objectId != 0) && (config.dashboardObjects.length == 0)) {
config.dashboardObjects = new long[1];
config.dashboardObjects[0] = config.objectId;
config.objectId = 0;
}
return config;
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class EmbeddedDashboardConfig method createXml.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig#createXml()
*/
@Override
public String createXml() throws Exception {
Serializer serializer = new Persister();
Writer writer = new StringWriter();
serializer.write(this, writer);
return writer.toString();
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class LabelConfig method createFromXml.
/**
* Create label configuration object from XML document
*
* @param xml XML document
* @return deserialized object
* @throws Exception if the object cannot be fully deserialized
*/
public static LabelConfig createFromXml(final String xml) throws Exception {
Serializer serializer = new Persister();
LabelConfig config = serializer.read(LabelConfig.class, xml);
// Update from old versions
if ((config.foreground != null) && config.foreground.startsWith("0x")) {
config.setTitleForeground("#" + config.foreground.substring(2));
config.foreground = null;
}
if ((config.background != null) && config.background.startsWith("0x")) {
config.setTitleBackground("#" + config.background.substring(2));
config.background = null;
}
return config;
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class LogParser method createXml.
/**
* Create XML from configuration.
*
* @return XML document
* @throws Exception if the schema for the object is not valid
*/
public String createXml() throws Exception {
Serializer serializer = new Persister();
Writer writer = new StringWriter();
serializer.write(this, writer);
return writer.toString();
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class DashboardElementLayout method createXml.
/**
* @return
* @throws Exception
*/
public String createXml() throws Exception {
Serializer serializer = new Persister();
StringWriter writer = new StringWriter();
serializer.write(this, writer);
return writer.toString();
}
Aggregations