@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."); }
@Override public void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType, Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result) throws FaultMessage { notNullArgument(objectType, "Object type must not be null."); Task task = createTaskInstance(SEARCH_OBJECTS); auditLogin(task); OperationResult operationResult = task.getResult(); try { Class objectClass = ObjectTypes.getObjectTypeFromTypeQName(objectType).getClassDefinition(); Collection<SelectorOptions<GetOperationOptions>> options = MiscSchemaUtil.optionsTypeToOptions(optionsType); ObjectQuery q = QueryJaxbConvertor.createObjectQuery(objectClass, query, prismContext); List<PrismObject<? extends ObjectType>> list = (List)model.searchObjects(objectClass, q, options, task, operationResult); handleOperationResult(operationResult, result); ObjectListType listType = new ObjectListType(); for (PrismObject<? extends ObjectType> o : list) { listType.getObject().add(o.asObjectable()); } objectListHolder.value = listType; } catch (Exception ex) { LoggingUtils.logException(LOGGER, "# MODEL searchObjects() failed", ex); throwFault(ex, operationResult); } finally { auditLogout(task); } }
ModelWebService extends AbstractModelWebService implements ModelPortType, ModelPort { @Override public void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType, Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result) throws FaultMessage { notNullArgument(objectType, "Object type must not be null."); Task task = createTaskInstance(SEARCH_OBJECTS); auditLogin(task); OperationResult operationResult = task.getResult(); try { Class objectClass = ObjectTypes.getObjectTypeFromTypeQName(objectType).getClassDefinition(); Collection<SelectorOptions<GetOperationOptions>> options = MiscSchemaUtil.optionsTypeToOptions(optionsType); ObjectQuery q = QueryJaxbConvertor.createObjectQuery(objectClass, query, prismContext); List<PrismObject<? extends ObjectType>> list = (List)model.searchObjects(objectClass, q, options, task, operationResult); handleOperationResult(operationResult, result); ObjectListType listType = new ObjectListType(); for (PrismObject<? extends ObjectType> o : list) { listType.getObject().add(o.asObjectable()); } objectListHolder.value = listType; } catch (Exception ex) { LoggingUtils.logException(LOGGER, "# MODEL searchObjects() failed", ex); throwFault(ex, operationResult); } finally { auditLogout(task); } } }
ModelWebService extends AbstractModelWebService implements ModelPortType, ModelPort { @Override public void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType, Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result) throws FaultMessage { notNullArgument(objectType, "Object type must not be null."); Task task = createTaskInstance(SEARCH_OBJECTS); auditLogin(task); OperationResult operationResult = task.getResult(); try { Class objectClass = ObjectTypes.getObjectTypeFromTypeQName(objectType).getClassDefinition(); Collection<SelectorOptions<GetOperationOptions>> options = MiscSchemaUtil.optionsTypeToOptions(optionsType); ObjectQuery q = QueryJaxbConvertor.createObjectQuery(objectClass, query, prismContext); List<PrismObject<? extends ObjectType>> list = (List)model.searchObjects(objectClass, q, options, task, operationResult); handleOperationResult(operationResult, result); ObjectListType listType = new ObjectListType(); for (PrismObject<? extends ObjectType> o : list) { listType.getObject().add(o.asObjectable()); } objectListHolder.value = listType; } catch (Exception ex) { LoggingUtils.logException(LOGGER, "# MODEL searchObjects() failed", ex); throwFault(ex, operationResult); } finally { auditLogout(task); } }  }
ModelWebService extends AbstractModelWebService implements ModelPortType, ModelPort { @Override public void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType, Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result) throws FaultMessage { notNullArgument(objectType, "Object type must not be null."); Task task = createTaskInstance(SEARCH_OBJECTS); auditLogin(task); OperationResult operationResult = task.getResult(); try { Class objectClass = ObjectTypes.getObjectTypeFromTypeQName(objectType).getClassDefinition(); Collection<SelectorOptions<GetOperationOptions>> options = MiscSchemaUtil.optionsTypeToOptions(optionsType); ObjectQuery q = QueryJaxbConvertor.createObjectQuery(objectClass, query, prismContext); List<PrismObject<? extends ObjectType>> list = (List)model.searchObjects(objectClass, q, options, task, operationResult); handleOperationResult(operationResult, result); ObjectListType listType = new ObjectListType(); for (PrismObject<? extends ObjectType> o : list) { listType.getObject().add(o.asObjectable()); } objectListHolder.value = listType; } catch (Exception ex) { LoggingUtils.logException(LOGGER, "# MODEL searchObjects() failed", ex); throwFault(ex, operationResult); } finally { auditLogout(task); } }  @Override void getObject(QName objectType, String oid, SelectorQualifiedGetOptionsType optionsType,
			Holder<ObjectType> objectHolder, Holder<OperationResultType> resultHolder); @Override void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType,
                  Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result); @Override ObjectDeltaOperationListType executeChanges(ObjectDeltaListType deltaList, ModelExecuteOptionsType optionsType); @Override void findShadowOwner(String accountOid, Holder<UserType> userHolder, Holder<OperationResultType> result); @Override OperationResultType testResource(String resourceOid); @Override ExecuteScriptsResponseType executeScripts(ExecuteScriptsType parameters); static PipelineDataType prepareXmlData(List<PipelineItem> output,
			ScriptingExpressionEvaluationOptionsType options); FaultMessage createIllegalArgumentFault(String message); void throwFault(Throwable ex, OperationResult result); @Override TaskType importFromResource(String resourceOid, QName objectClass); @Override TaskType notifyChange(ResourceObjectShadowChangeDescriptionType changeDescription); }
ModelWebService extends AbstractModelWebService implements ModelPortType, ModelPort { @Override public void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType, Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result) throws FaultMessage { notNullArgument(objectType, "Object type must not be null."); Task task = createTaskInstance(SEARCH_OBJECTS); auditLogin(task); OperationResult operationResult = task.getResult(); try { Class objectClass = ObjectTypes.getObjectTypeFromTypeQName(objectType).getClassDefinition(); Collection<SelectorOptions<GetOperationOptions>> options = MiscSchemaUtil.optionsTypeToOptions(optionsType); ObjectQuery q = QueryJaxbConvertor.createObjectQuery(objectClass, query, prismContext); List<PrismObject<? extends ObjectType>> list = (List)model.searchObjects(objectClass, q, options, task, operationResult); handleOperationResult(operationResult, result); ObjectListType listType = new ObjectListType(); for (PrismObject<? extends ObjectType> o : list) { listType.getObject().add(o.asObjectable()); } objectListHolder.value = listType; } catch (Exception ex) { LoggingUtils.logException(LOGGER, "# MODEL searchObjects() failed", ex); throwFault(ex, operationResult); } finally { auditLogout(task); } }  @Override void getObject(QName objectType, String oid, SelectorQualifiedGetOptionsType optionsType,
			Holder<ObjectType> objectHolder, Holder<OperationResultType> resultHolder); @Override void searchObjects(QName objectType, QueryType query, SelectorQualifiedGetOptionsType optionsType,
                  Holder<ObjectListType> objectListHolder, Holder<OperationResultType> result); @Override ObjectDeltaOperationListType executeChanges(ObjectDeltaListType deltaList, ModelExecuteOptionsType optionsType); @Override void findShadowOwner(String accountOid, Holder<UserType> userHolder, Holder<OperationResultType> result); @Override OperationResultType testResource(String resourceOid); @Override ExecuteScriptsResponseType executeScripts(ExecuteScriptsType parameters); static PipelineDataType prepareXmlData(List<PipelineItem> output,
			ScriptingExpressionEvaluationOptionsType options); FaultMessage createIllegalArgumentFault(String message); void throwFault(Throwable ex, OperationResult result); @Override TaskType importFromResource(String resourceOid, QName objectClass); @Override TaskType notifyChange(ResourceObjectShadowChangeDescriptionType changeDescription);  }