protected Collection<SelectorOptions<GetOperationOptions>> createSearchOptionsFromTask(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult) { SelectorQualifiedGetOptionsType opts = getRealValue(coordinatorTask.getExtensionProperty(SchemaConstants.MODEL_EXTENSION_SEARCH_OPTIONS)); return MiscSchemaUtil.optionsTypeToOptions(opts, prismContext); }
public Collection<SelectorOptions<GetOperationOptions>> createGetOptions(SelectorQualifiedGetOptionsType optionsBean, boolean noFetch) { LOGGER.trace("optionsBean = {}, noFetch = {}", optionsBean, noFetch); Collection<SelectorOptions<GetOperationOptions>> rv = MiscSchemaUtil.optionsTypeToOptions(optionsBean, prismContext); if (noFetch) { if (rv == null) { return SelectorOptions.createCollection(GetOperationOptions.createNoFetch()); } GetOperationOptions root = SelectorOptions.findRootOptions(rv); if (root != null) { root.setNoFetch(true); } else { rv.add(SelectorOptions.create(GetOperationOptions.createNoFetch())); } } return rv; }
@Override public ObjectListType processReport(String query, RemoteReportParametersType parameters, SelectorQualifiedGetOptionsType options) { try { Map<QName, Object> parametersMap = getParamsMap(parameters); ObjectQuery q = reportService.parseQuery(query, parametersMap); Collection<PrismObject<? extends ObjectType>> resultList = reportService.searchObjects(q, MiscSchemaUtil.optionsTypeToOptions(options, prismContext)); return createObjectListType(resultList); } catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) { // TODO Auto-generated catch block throw new Fault(e); } }
@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, prismContext); ObjectQuery q = prismContext.getQueryConverter().createObjectQuery(objectClass, query); 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 public void getObject(QName objectType, String oid, SelectorQualifiedGetOptionsType optionsType, Holder<ObjectType> objectHolder, Holder<OperationResultType> resultHolder) throws FaultMessage { notNullArgument(objectType, "Object type must not be null."); notEmptyArgument(oid, "Oid must not be null or empty."); Task task = createTaskInstance(GET_OBJECT); auditLogin(task); OperationResult operationResult = task.getResult(); try { Class objectClass = ObjectTypes.getObjectTypeFromTypeQName(objectType).getClassDefinition(); Collection<SelectorOptions<GetOperationOptions>> options = MiscSchemaUtil.optionsTypeToOptions(optionsType, prismContext); PrismObject<? extends ObjectType> object = model.getObject(objectClass, oid, options, task, operationResult); handleOperationResult(operationResult, resultHolder); objectHolder.value = object.asObjectable(); return; } catch (Exception ex) { LoggingUtils.logException(LOGGER, "# MODEL getObject() failed", ex); throwFault(ex, operationResult); } finally { auditLogout(task); } }