Search in sources :

Example 11 with MapReportElement

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);
    }
}
Also used : MapReportElement(org.activityinfo.legacy.shared.reports.model.MapReportElement) Marshaller(javax.xml.bind.Marshaller) Report(org.activityinfo.legacy.shared.reports.model.Report) Slice(org.activityinfo.legacy.shared.reports.model.layers.PiechartMapLayer.Slice) FileOutputStream(java.io.FileOutputStream) BubbleMapLayer(org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer) JAXBContext(javax.xml.bind.JAXBContext) PiechartMapLayer(org.activityinfo.legacy.shared.reports.model.layers.PiechartMapLayer) Test(org.junit.Test)

Aggregations

MapReportElement (org.activityinfo.legacy.shared.reports.model.MapReportElement)11 Test (org.junit.Test)7 MapContent (org.activityinfo.legacy.shared.reports.content.MapContent)6 BubbleMapLayer (org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer)4 FileOutputStream (java.io.FileOutputStream)3 SiteDTO (org.activityinfo.legacy.shared.model.SiteDTO)2 BubbleMapMarker (org.activityinfo.legacy.shared.reports.content.BubbleMapMarker)2 IconMapMarker (org.activityinfo.legacy.shared.reports.content.IconMapMarker)2 AdministrativeLevelClustering (org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering)2 PiechartMapLayer (org.activityinfo.legacy.shared.reports.model.layers.PiechartMapLayer)2 PolygonMapLayer (org.activityinfo.legacy.shared.reports.model.layers.PolygonMapLayer)2 AiLatLng (org.activityinfo.model.type.geo.AiLatLng)2 PdfReportRenderer (org.activityinfo.server.report.renderer.itext.PdfReportRenderer)2 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1 GenerateElement (org.activityinfo.legacy.shared.command.GenerateElement)1 GetBaseMaps (org.activityinfo.legacy.shared.command.GetBaseMaps)1 BaseMapResult (org.activityinfo.legacy.shared.command.result.BaseMapResult)1