use of org.activityinfo.legacy.shared.exception.ParseException in project activityinfo by bedatadriven.
the class CreateReportHandler method execute.
@Override
public CommandResult execute(CreateReport cmd, User user) {
// verify that the XML is valid
try {
ReportDefinition reportDef = new ReportDefinition();
String xml = ReportParserJaxb.createXML(cmd.getReport());
reportDef.setXml(xml);
if (cmd.getDatabaseId() != null) {
reportDef.setDatabase(em.getReference(Database.class, cmd.getDatabaseId()));
}
reportDef.setTitle(cmd.getReport().getTitle());
reportDef.setDescription(cmd.getReport().getDescription());
reportDef.setOwner(user);
reportDef.setVisibility(1);
em.persist(reportDef);
return new CreateResult(reportDef.getId());
} catch (JAXBException e) {
throw new ParseException(e.getMessage());
}
}
Aggregations