Search in sources :

Example 1 with ReportOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.

the class PageCreatedReports method deleteSelectedPerformed.

private void deleteSelectedPerformed(AjaxRequestTarget target, ReportDeleteDialogDto.Operation op, ReportOutputType single) {
    List<ReportOutputType> selected = getSelectedData();
    if (single != null) {
        selected.clear();
        selected.add(single);
    }
    if (selected.isEmpty()) {
        return;
    }
    ReportDeleteDialogDto dto = new ReportDeleteDialogDto(op, selected);
    deleteModel.setObject(dto);
    getPageBase().showMainPopup(getDeleteDialogPanel(), target);
}
Also used : ReportDeleteDialogDto(com.evolveum.midpoint.web.page.admin.reports.dto.ReportDeleteDialogDto) ReportOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType)

Example 2 with ReportOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.

the class PageCreatedReports method initColumns.

//TODO - consider adding Author name, File Type and ReportType to columns
private List<IColumn<SelectableBean<ReportOutputType>, String>> initColumns(final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior) {
    List<IColumn<SelectableBean<ReportOutputType>, String>> columns = new ArrayList<>();
    IColumn column;
    column = new CheckBoxHeaderColumn();
    columns.add(column);
    column = new PropertyColumn(createStringResource("pageCreatedReports.table.name"), "name", "value.name");
    columns.add(column);
    column = new PropertyColumn(createStringResource("pageCreatedReports.table.description"), "value.description");
    columns.add(column);
    column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(createStringResource("pageCreatedReports.table.time"), "createTimestamp") {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> rowModel) {
            cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {

                @Override
                public Date getObject() {
                    ReportOutputType object = rowModel.getObject().getValue();
                    MetadataType metadata = object != null ? object.getMetadata() : null;
                    if (metadata == null) {
                        return null;
                    }
                    return XmlTypeConverter.toDate(metadata.getCreateTimestamp());
                }
            }, DateLabelComponent.LONG_MEDIUM_STYLE));
        }
    };
    columns.add(column);
    column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(new Model(), null) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> model) {
            DownloadButtonPanel panel = new DownloadButtonPanel(componentId) {

                @Override
                protected void deletePerformed(AjaxRequestTarget target) {
                    deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SINGLE, model.getObject().getValue());
                }

                @Override
                protected void downloadPerformed(AjaxRequestTarget target) {
                    currentReport = model.getObject().getValue();
                    PageCreatedReports.this.downloadPerformed(target, model.getObject().getValue(), ajaxDownloadBehavior);
                }
            };
            cellItem.add(panel);
        }
    };
    columns.add(column);
    column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {

        @Override
        public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
            cellItem.add(new Label(componentId));
        }
    };
    columns.add(column);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ReportOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) InlineMenuable(com.evolveum.midpoint.web.component.data.column.InlineMenuable) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DownloadButtonPanel(com.evolveum.midpoint.web.page.admin.reports.component.DownloadButtonPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 3 with ReportOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.

the class ReportCreateHandlerPanel method initLayout.

private void initLayout(final PageTaskEdit parentPage) {
    final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior = new AjaxDownloadBehaviorFromStream() {

        @Override
        protected InputStream initStream() {
            String outputOid = getModelObject().getReportOutputOid();
            if (outputOid == null) {
                return null;
            }
            Task task = parentPage.createSimpleTask(OPERATION_LOAD_REPORT_OUTPUT);
            PrismObject<ReportOutputType> reportObject = WebModelServiceUtils.loadObject(ReportOutputType.class, outputOid, parentPage, task, task.getResult());
            if (reportObject != null) {
                return PageCreatedReports.createReport(reportObject.asObjectable(), this, parentPage);
            } else {
                return null;
            }
        }
    };
    parentPage.getForm().add(ajaxDownloadBehavior);
    WebMarkupContainer reportParametersContainer = new WebMarkupContainer(ID_REPORT_PARAMETERS_CONTAINER);
    TextArea reportParameters = new TextArea<>(ID_REPORT_PARAMETERS, new PropertyModel<>(getModel(), ReportCreateHandlerDto.F_REPORT_PARAMS));
    reportParameters.setEnabled(false);
    reportParametersContainer.add(reportParameters);
    add(reportParametersContainer);
    WebMarkupContainer downloadContainer = new WebMarkupContainer(ID_DOWNLOAD_CONTAINER);
    AjaxButton download = new AjaxButton(ID_DOWNLOAD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            ajaxDownloadBehavior.initiate(target);
        }
    };
    downloadContainer.add(download);
    downloadContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().getReportOutputOid() != null;
        }
    });
    add(downloadContainer);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Task(com.evolveum.midpoint.task.api.Task) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) AjaxDownloadBehaviorFromStream(com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromStream) TextArea(org.apache.wicket.markup.html.form.TextArea) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ReportOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 4 with ReportOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.

the class RReportOutput method toJAXB.

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

Example 5 with ReportOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.

the class ReportCreateTaskHandler method saveReportOutputType.

private void saveReportOutputType(String filePath, ReportType reportType, Task task, OperationResult parentResult) throws Exception {
    String fileName = FilenameUtils.getBaseName(filePath);
    String reportOutputName = fileName + " - " + reportType.getExport().value();
    ReportOutputType reportOutputType = new ReportOutputType();
    prismContext.adopt(reportOutputType);
    reportOutputType.setFilePath(filePath);
    reportOutputType.setReportRef(MiscSchemaUtil.createObjectReference(reportType.getOid(), ReportType.COMPLEX_TYPE));
    reportOutputType.setName(new PolyStringType(reportOutputName));
    reportOutputType.setDescription(reportType.getDescription() + " - " + reportType.getExport().value());
    reportOutputType.setExportType(reportType.getExport());
    ObjectDelta<ReportOutputType> objectDelta = null;
    Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
    OperationResult subResult = null;
    objectDelta = ObjectDelta.createAddDelta((PrismObject<ReportOutputType>) reportOutputType.asPrismObject());
    deltas.add(objectDelta);
    subResult = parentResult.createSubresult(ReportCreateTaskHandler.class.getName() + "createRepourtOutput");
    modelService.executeChanges(deltas, null, task, subResult);
    String outputOid = objectDelta.getOid();
    LOGGER.debug("Created report output with OID {}", outputOid);
    PrismProperty<String> outputOidProperty = prismContext.getSchemaRegistry().findPropertyDefinitionByElementName(ReportConstants.REPORT_OUTPUT_OID_PROPERTY_NAME).instantiate();
    outputOidProperty.setRealValue(outputOid);
    task.setExtensionPropertyImmediate(outputOidProperty, subResult);
    subResult.computeStatus();
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismObject(com.evolveum.midpoint.prism.PrismObject) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ReportOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta)

Aggregations

ReportOutputType (com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 Task (com.evolveum.midpoint.task.api.Task)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 AjaxDownloadBehaviorFromStream (com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromStream)1 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 ObjectDataProvider (com.evolveum.midpoint.web.component.data.ObjectDataProvider)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1 InlineMenuable (com.evolveum.midpoint.web.component.data.column.InlineMenuable)1 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 DownloadButtonPanel (com.evolveum.midpoint.web.page.admin.reports.component.DownloadButtonPanel)1 ReportDeleteDialogDto (com.evolveum.midpoint.web.page.admin.reports.dto.ReportDeleteDialogDto)1 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)1 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1