Search in sources :

Example 6 with OrderDirection

use of com.evolveum.midpoint.prism.query.OrderDirection 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 7 with OrderDirection

use of com.evolveum.midpoint.prism.query.OrderDirection 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

OrderDirection (com.evolveum.midpoint.prism.query.OrderDirection)7 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)6 ObjectOrdering (com.evolveum.midpoint.prism.query.ObjectOrdering)6 QName (javax.xml.namespace.QName)6 SortParam (org.apache.wicket.extensions.markup.html.repeater.util.SortParam)6 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)4 SelectableBeanContainerDataProvider (com.evolveum.midpoint.web.component.data.SelectableBeanContainerDataProvider)4 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)2 GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 SelectableBeanObjectDataProvider (com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider)2 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)2 TaskErrorSelectableBeanImpl (com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImpl)2 TaskErrorSelectableBeanImplOld (com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld)2 AuditEventRecordType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType)2 CsvDownloadButtonPanel (com.evolveum.midpoint.gui.api.component.button.CsvDownloadButtonPanel)1 AjaxCompositedIconButton (com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton)1 ContainerableListPanel (com.evolveum.midpoint.gui.impl.component.ContainerableListPanel)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1