/** * No not fetch any information from external sources, e.g. do not fetch account data from resource, * do not fetch resource schema, etc. * Such operation returns only the data stored in midPoint repository. */ public static Collection<SelectorOptions<GetOperationOptions>> createNoFetchCollection() { return SelectorOptions.createCollection(createNoFetch()); }
private static GetOperationOptions getOptionsTypeToGetOptions(GetOperationOptionsType optionsType) { GetOperationOptions options = new GetOperationOptions(); options.setRetrieve(RetrieveOption.fromRetrieveOptionType(optionsType.getRetrieve())); options.setResolve(optionsType.isResolve()); options.setResolveNames(optionsType.isResolveNames()); options.setNoFetch(optionsType.isNoFetch()); options.setRaw(optionsType.isRaw()); options.setTolerateRawData(optionsType.isTolerateRawData()); options.setDoNotDiscovery(optionsType.isNoDiscovery()); // TODO relational value search query (but it might become obsolete) options.setAllowNotFound(optionsType.isAllowNotFound()); options.setPointInTimeType(PointInTimeType.toPointInTimeType(optionsType.getPointInTimeType())); options.setDefinitionProcessing(DefinitionProcessingOption.toDefinitionProcessingOption(optionsType.getDefinitionProcessing())); options.setStaleness(optionsType.getStaleness()); options.setDistinct(optionsType.isDistinct()); return options; }
/** * Avoid any smart processing of the data except for schema application. Do not synchronize the data, do not apply * any expressions, etc. */ public static Collection<SelectorOptions<GetOperationOptions>> createRawCollection() { return SelectorOptions.createCollection(createRaw()); }
/** * Whether to override default iteration method (in searchObjectsIterative) configured for particular DBMS. */ public static GetOperationOptions createIterationMethod(IterationMethodType value) { GetOperationOptions opts = new GetOperationOptions(); opts.setIterationMethod(value); return opts; }
/** * Requirement how stale or fresh the retrieved data should be. It specifies maximum age of the value in millisecods. * The default value is zero, which means that a fresh value must always be returned. This means that caches that do * not guarantee fresh value cannot be used. If non-zero value is specified then such caches may be used. In case that * Long.MAX_VALUE is specified then the caches are always used and fresh value is never retrieved. */ public static GetOperationOptions createStaleness(Long staleness) { GetOperationOptions opts = new GetOperationOptions(); opts.setStaleness(staleness); return opts; }
/** * No not fetch any information from external sources, e.g. do not fetch account data from resource, * do not fetch resource schema, etc. * Such operation returns only the data stored in midPoint repository. */ public static GetOperationOptions createNoFetch() { GetOperationOptions opts = new GetOperationOptions(); opts.setNoFetch(true); return opts; }
public static GetOperationOptions fromRestOptions(List<String> options, DefinitionProcessingOption definitionProcessing) { if (options == null || options.isEmpty()){ if (definitionProcessing != null) { return GetOperationOptions.createDefinitionProcessing(definitionProcessing); } return null; } GetOperationOptions rv = new GetOperationOptions(); for (String option : options) { if (GetOperationOptionsType.F_RAW.getLocalPart().equals(option)) { rv.setRaw(true); } if (GetOperationOptionsType.F_NO_FETCH.getLocalPart().equals(option)) { rv.setNoFetch(true); } if (GetOperationOptionsType.F_NO_DISCOVERY.getLocalPart().equals(option)) { rv.setDoNotDiscovery(true); } if (GetOperationOptionsType.F_RESOLVE_NAMES.getLocalPart().equals(option)) { rv.setResolveNames(true); } // Do NOT set executionPhase here! } rv.setDefinitionProcessing(definitionProcessing); return rv; }
protected ShadowAsserter<Void> assertModelShadowFutureNoFetch(String oid) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException { GetOperationOptions options = GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE); options.setNoFetch(true); PrismObject<ShadowType> repoShadow = getShadowModel(oid, options, true); ShadowAsserter<Void> asserter = ShadowAsserter.forShadow(repoShadow, "model(future,noFetch)"); asserter .display(); return asserter; }
public static Collection<SelectorOptions<GetOperationOptions>> createReadOnlyCollection() { return SelectorOptions.createCollection(createReadOnly()); }
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; }
/** * Specifies whether to return specific items. It is used for optimizations. * Some requests only needs a subset of items therefore fetching them all is a waste * of resources. Other requests may need expensive data that are not normally returned by default. * <p> * If no retrieve option is set in the entire options set then it * means that the whole object with a default set of properties has to be * returned. This is equivalent to specifying DEFAULT retrieve root option. * <p> * If there is at least one retrieve option in the set then the following rules apply: * <ul> * <li>Items marked as INCLUDE will be returned.</li> * <li>Any item marked as EXCLUDE may not be returned. (Note: Excluded items may still be returned if their retrieval is cheap.)</li> * <li>Items marked as DEFAULT will be returned if they would also be returned without any options (by default).</li> * <li>Items that are not marked (have no option or have null retrieve option) but their superitem is marked (have retrieve option) * behave in the same way as superitem. E.g. if a superitem is marked as * INCLUDE they will also be included in the result. This also applies transitively (e.g. superitem of superitem). * <li>If a superitem is marked as EXCLUDE and subitem is marked as INCLUDE then the behavior is undefined. Do not do this. Strange things may happen.</li> * <li>For items that are not marked in any way and for which the superitem is also not marked the "I do not care" behavior is assumed. * This means that they may be returned or they may be not. The implementation will return them if their retrieval is cheap * but they will be most likely omitted from the result.</li> * </ul> */ public static GetOperationOptions createDontRetrieve() { return createRetrieve(RetrieveOption.EXCLUDE); }
protected void assertNoRepoShadow(String oid) throws SchemaException { OperationResult result = new OperationResult("assertNoRepoShadow"); try { PrismObject<ShadowType> shadow = repositoryService.getObject(ShadowType.class, oid, GetOperationOptions.createRawCollection(), result); fail("Expected that shadow "+oid+" will not be in the repo. But it was: "+shadow); } catch (ObjectNotFoundException e) { // Expected assertFailure(result); } }
+" with OID "+oid+"; using task manager implementation "+taskManager.getClass().getName()); if (workflowManager != null && TaskType.class.isAssignableFrom(clazz) && !GetOperationOptions.isRaw(rootOptions) && !GetOperationOptions.isNoFetch(rootOptions)) { workflowManager.augmentTaskObject(object, options, task, result);
private boolean isRaw(Collection<SelectorOptions<GetOperationOptions>> options) { GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); return rootOptions == null ? false : GetOperationOptions.isRaw(rootOptions); }
private static PrismObject<? extends ObjectType> getObject(ObjectReferenceType reference, ModelService modelService, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException { String oid = reference.getOid(); QName typeName = reference.getType() != null ? reference.getType() : ObjectType.COMPLEX_TYPE; Class<? extends ObjectType> typeClass = ObjectTypes.getObjectTypeClass(typeName); return modelService.getObject(typeClass, oid, createNoFetchCollection(), task, result); } }
public static Collection<SelectorOptions<GetOperationOptions>> fromRestOptions(List<String> options, List<String> include, List<String> exclude, DefinitionProcessingOption definitionProcessing, PrismContext prismContext) { if (CollectionUtils.isEmpty(options) && CollectionUtils.isEmpty(include) && CollectionUtils.isEmpty(exclude)) { if (definitionProcessing != null) { return SelectorOptions.createCollection(GetOperationOptions.createDefinitionProcessing(definitionProcessing)); } return null; } Collection<SelectorOptions<GetOperationOptions>> rv = new ArrayList<>(); GetOperationOptions rootOptions = fromRestOptions(options, definitionProcessing); if (rootOptions != null) { rv.add(SelectorOptions.create(rootOptions)); } for (ItemPath includePath : ItemPathCollectionsUtil.pathListFromStrings(include, prismContext)) { rv.add(SelectorOptions.create(prismContext.toUniformPath(includePath), GetOperationOptions.createRetrieve())); } for (ItemPath excludePath : ItemPathCollectionsUtil.pathListFromStrings(exclude, prismContext)) { rv.add(SelectorOptions.create(prismContext.toUniformPath(excludePath), GetOperationOptions.createDontRetrieve())); } // Do NOT set executionPhase here! return rv; }
protected PrismObject<ShadowType> getShadowModelFuture(String accountOid) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException { return getShadowModel(accountOid, GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE), true); }
/** * Avoid any smart processing of the data except for schema application. Do not synchronize the data, do not apply * any expressions, etc. */ public static GetOperationOptions createRaw() { GetOperationOptions opts = new GetOperationOptions(); opts.setRaw(true); return opts; }
/** * Force to get object from the resource even if some of the error occurred. * If the any copy of the shadow is fetched, we can't delete this object * from the gui, for example */ public static GetOperationOptions createDoNotDiscovery() { GetOperationOptions opts = new GetOperationOptions(); opts.setDoNotDiscovery(true); return opts; }
/** * Resolve the object reference. This only makes sense with a (path-based) selector. */ public static GetOperationOptions createResolve() { GetOperationOptions opts = new GetOperationOptions(); opts.setResolve(true); return opts; }