use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.
the class ExportAction method createQuery.
private QueryType createQuery(int from) throws IOException, SAXException, JAXBException {
QueryType query = new QueryType();
query.setFilter(loadQuery());
PagingType paging = new PagingType();
paging.setOffset(from);
paging.setMaxSize(SEARCH_PAGE_SIZE);
paging.setOrderBy(ModelClientUtil.createItemPathType("name"));
paging.setOrderDirection(OrderDirectionType.ASCENDING);
query.setPaging(paging);
return query;
}
use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method listUsers.
protected Collection<UserType> listUsers() throws SAXException, IOException, FaultMessage {
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
// let's say we want to get first 3 users, sorted alphabetically by user name
// holds search query + paging options
QueryType queryType = new QueryType();
PagingType pagingType = new PagingType();
pagingType.setMaxSize(3);
pagingType.setOrderBy(ModelClientUtil.createItemPathType("name"));
pagingType.setOrderDirection(OrderDirectionType.ASCENDING);
queryType.setPaging(pagingType);
modelPort.searchObjects(ModelClientUtil.getTypeQName(UserType.class), queryType, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
return (Collection) objectList.getObject();
}
use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.
the class Main method listUsers.
private static Collection<UserType> listUsers(ModelPortType modelPort) throws SAXException, IOException, FaultMessage {
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
// let's say we want to get first 3 users, sorted alphabetically by user name
// holds search query + paging options
QueryType queryType = new QueryType();
PagingType pagingType = new PagingType();
pagingType.setMaxSize(3);
pagingType.setOrderBy(ModelClientUtil.createItemPathType("name"));
pagingType.setOrderDirection(OrderDirectionType.ASCENDING);
queryType.setPaging(pagingType);
modelPort.searchObjects(ModelClientUtil.getTypeQName(UserType.class), queryType, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
return (Collection) objectList.getObject();
}
use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.
the class ModelInteractionServiceImpl method checkOrdering.
private ObjectQuery checkOrdering(ObjectQuery query, ItemPath defaultOrderBy) {
if (query != null) {
if (query.getPaging() == null) {
ObjectPaging paging = ObjectQueryUtil.convertToObjectPaging(new PagingType(), prismContext);
paging.setOrdering(defaultOrderBy, OrderDirection.ASCENDING);
query.setPaging(paging);
} else if (query.getPaging().getPrimaryOrderingPath() == null) {
query.getPaging().setOrdering(defaultOrderBy, OrderDirection.ASCENDING);
}
return query;
} else {
return prismContext.queryFactory().createQuery(prismContext.queryFactory().createPaging(defaultOrderBy, OrderDirection.ASCENDING));
}
}
use of com.evolveum.prism.xml.ns._public.query_3.PagingType in project midpoint by Evolveum.
the class ModelWebServiceTest method badPagingSearch.
@Test(expectedExceptions = FaultMessage.class)
public void badPagingSearch() throws FaultMessage, SchemaException, IOException, JAXBException {
PagingType paging = new PagingType();
paging.setMaxSize(-1);
paging.setOffset(-1);
final UserType expectedUser = (UserType) PrismTestUtil.parseObject(new File(TEST_FOLDER_CONTROLLER, "./addObject/add-user-without-name.xml")).asObjectable();
setSecurityContext(expectedUser);
try {
QueryType queryType = new QueryType();
queryType.setPaging(paging);
modelService.searchObjects(UserType.COMPLEX_TYPE, queryType, null, new Holder<ObjectListType>(), new Holder<OperationResultType>());
} catch (FaultMessage ex) {
ModelTUtil.assertIllegalArgumentFault(ex);
} finally {
SecurityContextHolder.getContext().setAuthentication(null);
}
Assert.fail("Illegal argument exception was not thrown.");
}
Aggregations