Search in sources :

Example 1 with TaskErrorSelectableBeanImplOld

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

the class TaskErrorsTabPanel method initColumnsOld.

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

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

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<TaskErrorSelectableBeanImplOld<ObjectType>>> cellItem, String componentId, IModel<TaskErrorSelectableBeanImplOld<ObjectType>> 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"), TaskErrorSelectableBeanImplOld.F_STATUS));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.message"), TaskErrorSelectableBeanImplOld.F_MESSAGE));
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.recordType"), TaskErrorSelectableBeanImplOld.F_RECORD_TYPE));
    columns.add(new AjaxLinkColumn<>(createStringResource("pageTaskEdit.taskErros.realOwner"), TaskErrorSelectableBeanImplOld.F_REAL_OWNER_DESCRIPTION) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<TaskErrorSelectableBeanImplOld<ObjectType>> rowModel) {
            TaskErrorSelectableBeanImplOld<ObjectType> 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) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismObject(com.evolveum.midpoint.prism.PrismObject) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TaskErrorSelectableBeanImplOld(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld)

Example 2 with TaskErrorSelectableBeanImplOld

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

the class TaskErrorsPanel method initColumnsOld.

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

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

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<TaskErrorSelectableBeanImplOld<ObjectType>>> cellItem, String componentId, IModel<TaskErrorSelectableBeanImplOld<ObjectType>> 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"), TaskErrorSelectableBeanImplOld.F_STATUS));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.message"), TaskErrorSelectableBeanImplOld.F_MESSAGE));
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.recordType"), TaskErrorSelectableBeanImplOld.F_RECORD_TYPE));
    columns.add(new AjaxLinkColumn<>(createStringResource("pageTaskEdit.taskErros.realOwner"), TaskErrorSelectableBeanImplOld.F_REAL_OWNER_DESCRIPTION) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<TaskErrorSelectableBeanImplOld<ObjectType>> rowModel) {
            TaskErrorSelectableBeanImplOld<ObjectType> 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) 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) TaskErrorSelectableBeanImplOld(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld)

Example 3 with TaskErrorSelectableBeanImplOld

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

the class TaskErrorsPanel method initLayoutOld.

private void initLayoutOld() {
    SelectableBeanObjectDataProvider<? extends ObjectType> provider = new SelectableBeanObjectDataProvider<>(this, null) {

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

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

        @Override
        public SelectableBean<ObjectType> createDataObjectWrapper(ObjectType obj) {
            return new TaskErrorSelectableBeanImplOld<>(obj, getObjectWrapper().getOid());
        }

        @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(TaskErrorSelectableBeanImplOld.F_ERROR_TIMESTAMP)) {
                    ordering = ItemPath.create("operationExecution", "timestamp");
                } else {
                    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<ObjectType> getType() {
            return ObjectType.class;
        }
    };
    BoxedTablePanel<TaskErrorSelectableBeanImplOld<ObjectType>> table = new BoxedTablePanel<>(ID_TASK_ERRORS, provider, initColumnsOld());
    table.setOutputMarkupId(true);
    add(table);
}
Also used : QName(javax.xml.namespace.QName) SelectableBeanObjectDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider) ObjectOrdering(com.evolveum.midpoint.prism.query.ObjectOrdering) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) TaskErrorSelectableBeanImplOld(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld) 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 4 with TaskErrorSelectableBeanImplOld

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

the class TaskErrorsTabPanel method initLayoutOld.

private void initLayoutOld() {
    SelectableBeanObjectDataProvider<? extends ObjectType> provider = new SelectableBeanObjectDataProvider<>(this, null) {

        @Override
        public SelectableBean<ObjectType> createDataObjectWrapper(ObjectType obj) {
            return new TaskErrorSelectableBeanImplOld<>(obj, getModelObject().getOid());
        }

        @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(TaskErrorSelectableBeanImplOld.F_ERROR_TIMESTAMP)) {
                    ordering = ItemPath.create("operationExecution", "timestamp");
                } else {
                    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<ObjectType> getType() {
            return ObjectType.class;
        }
    };
    BoxedTablePanel<TaskErrorSelectableBeanImplOld<ObjectType>> table = new BoxedTablePanel<>(ID_TASK_ERRORS, provider, initColumnsOld());
    table.setOutputMarkupId(true);
    add(table);
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) QName(javax.xml.namespace.QName) SelectableBeanObjectDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider) ObjectOrdering(com.evolveum.midpoint.prism.query.ObjectOrdering) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) TaskErrorSelectableBeanImplOld(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld) OrderDirection(com.evolveum.midpoint.prism.query.OrderDirection) SortParam(org.apache.wicket.extensions.markup.html.repeater.util.SortParam) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

TaskErrorSelectableBeanImplOld (com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld)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 SelectableBeanObjectDataProvider (com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)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