Search in sources :

Example 11 with ReportType

use of com.buschmais.jqassistant.core.plugin.schema.v1.ReportType in project midpoint by Evolveum.

the class ReportDto method getObject.

public PrismObject<ReportType> getObject() {
    if (reportType == null) {
        reportType = new ReportType();
        //TODO FIXME temporary every new report will be set as parent report
        reportType.setParent(Boolean.TRUE);
    }
    reportType.setName(new PolyStringType(name));
    reportType.setExport(exportType);
    reportType.setTemplate(jasperReportDto.getTemplate());
    reportType.setTemplateStyle(templateStyle);
    reportType.setDescription(description);
    reportType.setVirtualizer(virtualizer);
    reportType.setVirtualizerKickOn(virtualizerKickOn);
    reportType.setMaxPages(maxPages);
    reportType.setTimeout(timeout);
    return reportType.asPrismObject();
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 12 with ReportType

use of com.buschmais.jqassistant.core.plugin.schema.v1.ReportType in project midpoint by Evolveum.

the class PageReport method onSavePerformed.

protected void onSavePerformed(AjaxRequestTarget target) {
    Task task = createSimpleTask(OPERATION_SAVE_REPORT);
    OperationResult result = task.getResult();
    try {
        //TODO TODO TODO
        PrismObject<ReportType> newReport = model.getObject().getObject();
        ObjectDelta<ReportType> delta = null;
        if (newReport.getOid() == null) {
            getPrismContext().adopt(newReport);
            delta = ObjectDelta.createAddDelta(newReport);
            delta.setPrismContext(getPrismContext());
        } else {
            PrismObject<ReportType> oldReport = WebModelServiceUtils.loadObject(ReportType.class, newReport.getOid(), this, task, result);
            if (oldReport != null) {
                delta = oldReport.diff(newReport);
            }
        }
        if (delta != null) {
            getPrismContext().adopt(delta);
            getModelService().executeChanges(WebComponentUtil.createDeltaCollection(delta), null, task, result);
        }
    } catch (Exception e) {
        result.recordFatalError("Couldn't save report.", e);
    } finally {
        result.computeStatusIfUnknown();
    }
    if (WebComponentUtil.isSuccessOrHandledError(result)) {
        showResult(result);
        redirectBack();
    } else {
        showResult(result);
        target.add(getFeedbackPanel());
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException)

Example 13 with ReportType

use of com.buschmais.jqassistant.core.plugin.schema.v1.ReportType in project jqa-core-framework by buschmais.

the class ReportPluginRepositoryImpl method getReportPlugins.

private Map<String, ReportPlugin> getReportPlugins(List<JqassistantPlugin> plugins) throws PluginRepositoryException {
    Map<String, ReportPlugin> reportPlugins = new HashMap<>();
    for (JqassistantPlugin plugin : plugins) {
        ReportType reportType = plugin.getReport();
        if (reportType != null) {
            for (IdClassType classType : reportType.getClazz()) {
                ReportPlugin reportPlugin = createInstance(classType.getValue());
                if (reportPlugin != null) {
                    try {
                        reportPlugin.initialize();
                    } catch (ReportException e) {
                        throw new PluginRepositoryException("Cannot initialize report plugin " + reportPlugin, e);
                    }
                    String id = classType.getId();
                    if (id == null) {
                        id = reportPlugin.getClass().getSimpleName();
                    }
                    reportPlugins.put(id, reportPlugin);
                }
            }
        }
    }
    return reportPlugins;
}
Also used : IdClassType(com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType) PluginRepositoryException(com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException) ReportPlugin(com.buschmais.jqassistant.core.report.api.ReportPlugin) HashMap(java.util.HashMap) JqassistantPlugin(com.buschmais.jqassistant.core.plugin.schema.v1.JqassistantPlugin) ReportException(com.buschmais.jqassistant.core.report.api.ReportException) ReportType(com.buschmais.jqassistant.core.plugin.schema.v1.ReportType)

Example 14 with ReportType

use of com.buschmais.jqassistant.core.plugin.schema.v1.ReportType in project midpoint by Evolveum.

the class TestCsvReportMultiNode method test102ExportAuditRecordsInsideTwoTimestamps.

@Test
public void test102ExportAuditRecordsInsideTwoTimestamps() throws Exception {
    List<AuditEventRecordType> auditRecords = getAllAuditRecords(getTestTask(), getTestTask().getResult());
    SearchFilterType filter = PrismContext.get().getQueryConverter().createSearchFilterType(PrismContext.get().queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_TIMESTAMP).ge(auditRecords.get(500).getTimestamp()).and().item(AuditEventRecordType.F_TIMESTAMP).le(auditRecords.get(1300).getTimestamp()).buildFilter());
    modifyObjectReplaceProperty(ObjectCollectionType.class, OBJECT_COLLECTION_ALL_AUDIT_RECORDS.oid, ObjectCollectionType.F_FILTER, getTestTask(), getTestTask().getResult(), filter);
    auditTest();
    PrismObject<ReportType> report = getObject(ReportType.class, REPORT_AUDIT_COLLECTION_WITH_DEFAULT_COLUMN.oid);
    List<String> rows = basicCheckOutputFile(report, -1, 8, null);
    assertTrue(rows.size() > 800 && rows.size() <= 810, "Unexpected number of rows in report. Expected:800-810, Actual:" + rows.size());
}
Also used : SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType) Test(org.testng.annotations.Test)

Aggregations

ReportType (com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)13 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 Task (com.evolveum.midpoint.task.api.Task)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 Test (org.testng.annotations.Test)3 PrismContainer (com.evolveum.midpoint.prism.PrismContainer)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 AuditEventRecordType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType)2 SearchFilterType (com.evolveum.prism.xml.ns._public.query_3.SearchFilterType)2 HashMap (java.util.HashMap)2 JasperReport (net.sf.jasperreports.engine.JasperReport)2 RestartResponseException (org.apache.wicket.RestartResponseException)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 StringValue (org.apache.wicket.util.string.StringValue)2 PluginRepositoryException (com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException)1 IdClassType (com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType)1 JqassistantPlugin (com.buschmais.jqassistant.core.plugin.schema.v1.JqassistantPlugin)1 ReportType (com.buschmais.jqassistant.core.plugin.schema.v1.ReportType)1 ReportException (com.buschmais.jqassistant.core.report.api.ReportException)1 ReportPlugin (com.buschmais.jqassistant.core.report.api.ReportPlugin)1