Search in sources :

Example 1 with ReportType

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

the class PageReport method loadReport.

private ReportDto loadReport() {
    StringValue reportOid = getPageParameters().get(OnePageParameterEncoder.PARAMETER);
    Task task = createSimpleTask(OPERATION_LOAD_REPORT);
    OperationResult result = task.getResult();
    PrismObject<ReportType> prismReport = WebModelServiceUtils.loadObject(ReportType.class, reportOid.toString(), this, task, result);
    if (prismReport == null) {
        LOGGER.error("Couldn't load report.");
        throw new RestartResponseException(PageReports.class);
    }
    return new ReportDto(prismReport.asObjectable());
//        return prismReport;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RestartResponseException(org.apache.wicket.RestartResponseException) ReportDto(com.evolveum.midpoint.web.page.admin.reports.dto.ReportDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) StringValue(org.apache.wicket.util.string.StringValue) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 2 with ReportType

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

the class PageReports method initColumns.

private List<IColumn<ReportType, String>> initColumns() {
    List<IColumn<ReportType, String>> columns = new ArrayList<IColumn<ReportType, String>>();
    IColumn column;
    column = new LinkColumn<SelectableBean<ReportType>>(createStringResource("PageReports.table.name"), ReportType.F_NAME.getLocalPart(), "value.name") {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> rowModel) {
            ReportType report = rowModel.getObject().getValue();
            if (report != null) {
                reportTypeFilterPerformed(target, report.getOid());
            }
        }

        @Override
        public boolean isEnabled(IModel<SelectableBean<ReportType>> rowModel) {
            return rowModel.getObject().getValue() != null && rowModel.getObject().getValue().isParent();
        }
    };
    columns.add(column);
    column = new PropertyColumn(createStringResource("PageReports.table.description"), "value.description");
    columns.add(column);
    column = new DoubleButtonColumn<SelectableBean<ReportType>>(new Model(), null) {

        @Override
        public String getFirstCap() {
            return PageReports.this.createStringResource("PageReports.button.run").getString();
        }

        @Override
        public String getSecondCap() {
            return PageReports.this.createStringResource("PageReports.button.configure").getString();
        }

        @Override
        public String getFirstColorCssClass() {
            if (getRowModel().getObject().getValue() != null && getRowModel().getObject().getValue().isParent()) {
                return BUTTON_COLOR_CLASS.PRIMARY.toString();
            } else {
                return BUTTON_COLOR_CLASS.PRIMARY.toString() + " " + BUTTON_DISABLED;
            }
        }

        @Override
        public void firstClicked(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> model) {
            runReportPerformed(target, model.getObject().getValue());
        }

        @Override
        public void secondClicked(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> model) {
            configurePerformed(target, model.getObject().getValue());
        }

        @Override
        public boolean isFirstButtonEnabled(IModel<SelectableBean<ReportType>> rowModel) {
            return getRowModel().getObject().getValue() != null && rowModel.getObject().getValue().isParent();
        }
    };
    columns.add(column);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 3 with ReportType

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

the class PageReports method runReportPerformed.

protected void runReportPerformed(AjaxRequestTarget target, ReportType report) {
    RunReportPopupPanel runReportPopupPanel = new RunReportPopupPanel(getMainPopupBodyId(), report) {

        private static final long serialVersionUID = 1L;

        protected void runConfirmPerformed(AjaxRequestTarget target, ReportType reportType, PrismContainer<ReportParameterType> reportParam) {
            OperationResult result = new OperationResult(OPERATION_RUN_REPORT);
            try {
                Task task = createSimpleTask(OPERATION_RUN_REPORT);
                getReportManager().runReport(reportType.asPrismObject(), reportParam, task, result);
            } catch (Exception ex) {
                result.recordFatalError(ex);
            } finally {
                result.computeStatusIfUnknown();
            }
            showResult(result);
            target.add(getFeedbackPanel(), get(createComponentPath(ID_MAIN_FORM)));
            hideMainPopup(target);
        }

        ;
    };
    showMainPopup(runReportPopupPanel, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Task(com.evolveum.midpoint.task.api.Task) PrismContainer(com.evolveum.midpoint.prism.PrismContainer) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RunReportPopupPanel(com.evolveum.midpoint.web.page.admin.reports.component.RunReportPopupPanel) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 4 with ReportType

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

the class RReport method toJAXB.

@Override
public ReportType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
    ReportType object = new ReportType();
    RUtil.revive(object, prismContext);
    RReport.copyToJAXB(this, object, prismContext, options);
    return object;
}
Also used : ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 5 with ReportType

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

the class ReportCreateTaskHandler method getSubreportParameters.

private Map<String, Object> getSubreportParameters(SubreportType subreportType, Task task, OperationResult subResult) throws SchemaException, ObjectNotFoundException {
    Map<String, Object> reportParams = new HashMap<String, Object>();
    ReportType reportType = objectResolver.resolve(subreportType.getReportRef(), ReportType.class, null, "resolve subreport", task, subResult);
    Map<String, Object> parameters = prepareReportParameters(reportType, subResult);
    reportParams.putAll(parameters);
    JasperReport jasperReport = ReportTypeUtil.loadJasperReport(reportType);
    reportParams.put(subreportType.getName(), jasperReport);
    Map<String, Object> subReportParams = processSubreportParameters(reportType, task, subResult);
    reportParams.putAll(subReportParams);
    return reportParams;
}
Also used : HashMap(java.util.HashMap) PrismObject(com.evolveum.midpoint.prism.PrismObject) JasperReport(net.sf.jasperreports.engine.JasperReport) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

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