Search in sources :

Example 1 with TaskErrorSelectableBeanImpl

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl in project midpoint by Evolveum.

the class TaskErrorsTabPanel method initLayoutNew.

private void initLayoutNew() {
    var provider = new SelectableBeanContainerDataProvider<OperationExecutionType>(this, Model.of(), null, true) {

        @Override
        protected String getDefaultSortParam() {
            return TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP;
        }

        @Override
        protected SortOrder getDefaultSortOrder() {
            return SortOrder.DESCENDING;
        }

        @Override
        public SelectableBean<OperationExecutionType> createDataObjectWrapper(OperationExecutionType obj) {
            return new TaskErrorSelectableBeanImpl(obj);
        }

        @Override
        public ObjectQuery getQuery() {
            return createContentQuery(getModelObject().getOid(), getPageBase());
        }

        @NotNull
        @Override
        protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
            if (sortParam != null && sortParam.getProperty() != null) {
                OrderDirection order = sortParam.isAscending() ? OrderDirection.ASCENDING : OrderDirection.DESCENDING;
                ItemPath ordering;
                if (sortParam.getProperty().equals(TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP)) {
                    ordering = ItemPath.create(OperationExecutionType.F_TIMESTAMP);
                } else if (sortParam.getProperty().equals("name")) {
                    // TODO why is this "name" and not TaskErrorSelectableBeanImpl.F_OBJECT_REF_NAME?
                    ordering = ItemPath.create(PrismConstants.T_PARENT, ObjectType.F_NAME);
                } else {
                    // TODO this is actually not used
                    ordering = ItemPath.create(new QName(SchemaConstantsGenerated.NS_COMMON, sortParam.getProperty()));
                }
                return Collections.singletonList(getPrismContext().queryFactory().createOrdering(ordering, order));
            } else {
                return Collections.emptyList();
            }
        }

        @Override
        public Class<OperationExecutionType> getType() {
            return OperationExecutionType.class;
        }
    };
    BoxedTablePanel<?> table = new BoxedTablePanel<>(ID_TASK_ERRORS, provider, initColumns());
    table.setOutputMarkupId(true);
    add(table);
}
Also used : QName(javax.xml.namespace.QName) SelectableBeanContainerDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanContainerDataProvider) TaskErrorSelectableBeanImpl(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl) OperationExecutionType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationExecutionType) ObjectOrdering(com.evolveum.midpoint.prism.query.ObjectOrdering) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) OrderDirection(com.evolveum.midpoint.prism.query.OrderDirection) SortParam(org.apache.wicket.extensions.markup.html.repeater.util.SortParam) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 2 with TaskErrorSelectableBeanImpl

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl in project midpoint by Evolveum.

the class TaskErrorsPanel method initLayoutNew.

private void initLayoutNew() {
    var provider = new SelectableBeanContainerDataProvider<OperationExecutionType>(this, Model.of(), null, true) {

        @Override
        protected String getDefaultSortParam() {
            return TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP;
        }

        @Override
        protected SortOrder getDefaultSortOrder() {
            return SortOrder.DESCENDING;
        }

        @Override
        public SelectableBean<OperationExecutionType> createDataObjectWrapper(OperationExecutionType obj) {
            return new TaskErrorSelectableBeanImpl(obj);
        }

        @Override
        public ObjectQuery getQuery() {
            return createContentQuery(getObjectWrapper().getOid(), getPageBase());
        }

        @NotNull
        @Override
        protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
            if (sortParam != null && sortParam.getProperty() != null) {
                OrderDirection order = sortParam.isAscending() ? OrderDirection.ASCENDING : OrderDirection.DESCENDING;
                ItemPath ordering;
                if (sortParam.getProperty().equals(TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP)) {
                    ordering = ItemPath.create(OperationExecutionType.F_TIMESTAMP);
                } else if (sortParam.getProperty().equals("name")) {
                    // TODO why is this "name" and not TaskErrorSelectableBeanImplNew.F_OBJECT_REF_NAME?
                    ordering = ItemPath.create(PrismConstants.T_PARENT, ObjectType.F_NAME);
                } else {
                    // TODO this is actually not used
                    ordering = ItemPath.create(new QName(SchemaConstantsGenerated.NS_COMMON, sortParam.getProperty()));
                }
                return Collections.singletonList(getPrismContext().queryFactory().createOrdering(ordering, order));
            } else {
                return Collections.emptyList();
            }
        }

        @Override
        public Class<OperationExecutionType> getType() {
            return OperationExecutionType.class;
        }
    };
    BoxedTablePanel<?> table = new BoxedTablePanel<>(ID_TASK_ERRORS, provider, initColumnsNew());
    table.setOutputMarkupId(true);
    add(table);
}
Also used : QName(javax.xml.namespace.QName) SelectableBeanContainerDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanContainerDataProvider) TaskErrorSelectableBeanImpl(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl) ObjectOrdering(com.evolveum.midpoint.prism.query.ObjectOrdering) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) OrderDirection(com.evolveum.midpoint.prism.query.OrderDirection) SortParam(org.apache.wicket.extensions.markup.html.repeater.util.SortParam) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 3 with TaskErrorSelectableBeanImpl

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl in project midpoint by Evolveum.

the class TaskErrorsPanel method initColumnsNew.

private List<IColumn<TaskErrorSelectableBeanImpl, String>> initColumnsNew() {
    List<IColumn<TaskErrorSelectableBeanImpl, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.objectName"), TaskErrorSelectableBeanImpl.F_OBJECT_REF_NAME) {

        @Override
        public String getSortProperty() {
            return "name";
        }
    });
    columns.add(new AbstractColumn<>(createStringResource("pageTaskEdit.taskErros.timestamp"), TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<TaskErrorSelectableBeanImpl>> cellItem, String componentId, IModel<TaskErrorSelectableBeanImpl> rowModel) {
            Label label = new Label(componentId, (IModel<String>) () -> WebComponentUtil.getShortDateTimeFormattedValue(rowModel.getObject().getErrorTimestamp(), getPageBase()));
            cellItem.add(label);
        }
    });
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.status"), TaskErrorSelectableBeanImpl.F_STATUS));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.message"), TaskErrorSelectableBeanImpl.F_MESSAGE));
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.recordType"), TaskErrorSelectableBeanImpl.F_RECORD_TYPE));
    columns.add(new AjaxLinkColumn<>(createStringResource("pageTaskEdit.taskErros.realOwner"), TaskErrorSelectableBeanImpl.F_REAL_OWNER_DESCRIPTION) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<TaskErrorSelectableBeanImpl> rowModel) {
            TaskErrorSelectableBeanImpl object = rowModel.getObject();
            PrismObject<ObjectType> realOwner = object.getRealOwner();
            WebComponentUtil.dispatchToObjectDetailsPage(realOwner.getCompileTimeClass(), realOwner.getOid(), TaskErrorsPanel.this, false);
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) TaskErrorSelectableBeanImpl(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PrismObject(com.evolveum.midpoint.prism.PrismObject) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Example 4 with TaskErrorSelectableBeanImpl

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl in project midpoint by Evolveum.

the class TaskErrorsTabPanel method initColumns.

private List<IColumn<TaskErrorSelectableBeanImpl, String>> initColumns() {
    List<IColumn<TaskErrorSelectableBeanImpl, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.objectName"), TaskErrorSelectableBeanImpl.F_OBJECT_REF_NAME) {

        @Override
        public String getSortProperty() {
            return "name";
        }
    });
    columns.add(new AbstractColumn<>(createStringResource("pageTaskEdit.taskErros.timestamp"), TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<TaskErrorSelectableBeanImpl>> cellItem, String componentId, IModel<TaskErrorSelectableBeanImpl> rowModel) {
            Label label = new Label(componentId, (IModel<String>) () -> WebComponentUtil.getShortDateTimeFormattedValue(rowModel.getObject().getErrorTimestamp(), getPageBase()));
            cellItem.add(label);
        }
    });
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.status"), TaskErrorSelectableBeanImpl.F_STATUS));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.message"), TaskErrorSelectableBeanImpl.F_MESSAGE));
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.recordType"), TaskErrorSelectableBeanImpl.F_RECORD_TYPE));
    columns.add(new AjaxLinkColumn<>(createStringResource("pageTaskEdit.taskErros.realOwner"), TaskErrorSelectableBeanImpl.F_REAL_OWNER_DESCRIPTION) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<TaskErrorSelectableBeanImpl> rowModel) {
            TaskErrorSelectableBeanImpl object = rowModel.getObject();
            PrismObject<ObjectType> realOwner = object.getRealOwner();
            WebComponentUtil.dispatchToObjectDetailsPage(realOwner.getCompileTimeClass(), realOwner.getOid(), TaskErrorsTabPanel.this, false);
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) TaskErrorSelectableBeanImpl(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PrismObject(com.evolveum.midpoint.prism.PrismObject) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Aggregations

TaskErrorSelectableBeanImpl (com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 ObjectOrdering (com.evolveum.midpoint.prism.query.ObjectOrdering)2 OrderDirection (com.evolveum.midpoint.prism.query.OrderDirection)2 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)2 SelectableBeanContainerDataProvider (com.evolveum.midpoint.web.component.data.SelectableBeanContainerDataProvider)2 ArrayList (java.util.ArrayList)2 QName (javax.xml.namespace.QName)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 SortParam (org.apache.wicket.extensions.markup.html.repeater.util.SortParam)2 Label (org.apache.wicket.markup.html.basic.Label)2 IModel (org.apache.wicket.model.IModel)2 OperationExecutionType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationExecutionType)1