Search in sources :

Example 6 with PagingType

use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.

the class PagingConvertor method createPagingType.

public static PagingType createPagingType(ObjectPaging paging) {
    if (paging == null) {
        return null;
    }
    PagingType pagingType = new PagingType();
    pagingType.setOrderDirection(toOrderDirectionType(paging.getDirection()));
    pagingType.setMaxSize(paging.getMaxSize());
    pagingType.setOffset(paging.getOffset());
    if (paging.getOrderBy() != null) {
        pagingType.setOrderBy(new ItemPathType(paging.getOrderBy()));
    }
    return pagingType;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType)

Example 7 with PagingType

use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.

the class TestQueryConvertor method testConvertQueryNullFilter.

@Test
public void testConvertQueryNullFilter() throws Exception {
    ObjectQuery query = ObjectQuery.createObjectQuery(ObjectPaging.createPaging(0, 10));
    QueryType queryType = QueryJaxbConvertor.createQueryType(query, getPrismContext());
    assertNotNull(queryType);
    assertNull(queryType.getFilter());
    PagingType paging = queryType.getPaging();
    assertNotNull(paging);
    assertEquals(new Integer(0), paging.getOffset());
    assertEquals(new Integer(10), paging.getMaxSize());
}
Also used : PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) Test(org.testng.annotations.Test)

Example 8 with PagingType

use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.

the class PagingTypeFactory method createPaging.

public static PagingType createPaging(int offset, int maxSize, OrderDirectionType order, String orderBy) {
    PagingType paging = new PagingType();
    paging.setOffset(offset);
    paging.setMaxSize(maxSize);
    if (order != null && StringUtils.isNotEmpty(orderBy)) {
        paging.setOrderBy(fillPropertyReference(orderBy));
        paging.setOrderDirection(order);
    }
    return paging;
}
Also used : PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType)

Example 9 with PagingType

use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.

the class ContainerableListPanel method setDefaultSorting.

protected void setDefaultSorting(ISelectableDataProvider<C, PO> provider) {
    if (provider instanceof SortableDataProvider && isCollectionViewPanel() && getObjectCollectionView().getPaging() != null && getObjectCollectionView().getPaging().getOrderBy() != null) {
        PagingType paging = getObjectCollectionView().getPaging();
        boolean ascending = !OrderDirectionType.DESCENDING.equals(paging.getOrderDirection());
        ItemPath orderBy = paging.getOrderBy().getItemPath();
        ItemName name = orderBy.lastName();
        if (name == null) {
            return;
        }
        ((SortableDataProvider) provider).setSort(new SortParam(name.getLocalPart(), ascending));
    }
}
Also used : PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType) ItemName(com.evolveum.midpoint.prism.path.ItemName) SortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) SortParam(org.apache.wicket.extensions.markup.html.repeater.util.SortParam)

Example 10 with PagingType

use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.

the class TestQueryConverter method testConvertQueryNullFilter.

@Test
public void testConvertQueryNullFilter() throws Exception {
    ObjectQuery query = getQueryFactory().createQuery(getQueryFactory().createPaging(0, 10));
    QueryType queryType = getQueryConverter().createQueryType(query);
    assertNotNull(queryType);
    assertNull(queryType.getFilter());
    PagingType paging = queryType.getPaging();
    assertNotNull(paging);
    assertEquals(Integer.valueOf(0), paging.getOffset());
    assertEquals(Integer.valueOf(10), paging.getMaxSize());
}
Also used : PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) Test(org.testng.annotations.Test) AbstractUnitTest(com.evolveum.midpoint.tools.testng.AbstractUnitTest)

Aggregations

PagingType (com.evolveum.prism.xml.ns._public.query_3.PagingType)10 QueryType (com.evolveum.prism.xml.ns._public.query_3.QueryType)6 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)3 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)3 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 Test (org.testng.annotations.Test)3 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)2 Collection (java.util.Collection)2 Holder (javax.xml.ws.Holder)2 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)1 AbstractUnitTest (com.evolveum.midpoint.tools.testng.AbstractUnitTest)1 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)1 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)1 File (java.io.File)1 SortParam (org.apache.wicket.extensions.markup.html.repeater.util.SortParam)1 SortableDataProvider (org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider)1