use of org.activityinfo.legacy.shared.reports.model.MapReportElement in project activityinfo by bedatadriven.
the class ReadWriteReportTest method readWriteReportTest.
@Test
public void readWriteReportTest() throws Throwable {
Report report = new Report();
MapReportElement map = new MapReportElement();
map.getLayers().add(new BubbleMapLayer());
PiechartMapLayer pielayer = new PiechartMapLayer();
Slice slice1 = new Slice();
slice1.setColor("FF00AA");
slice1.setIndicatorId(1);
Slice slice2 = new Slice();
slice2.setColor("00FFAA");
slice2.setIndicatorId(2);
pielayer.getSlices().add(slice1);
pielayer.getSlices().add(slice2);
map.getLayers().add(pielayer);
report.getElements().add(map);
Report.class.getPackage();
JAXBContext jc = JAXBContext.newInstance(Report.class.getPackage().getName());
Marshaller marshaller = jc.createMarshaller();
marshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
try (FileOutputStream fo = TestOutput.open(getClass(), "SomeXmlTest", ".xml")) {
marshaller.marshal(report, fo);
}
}
Aggregations