private boolean isRaw(Collection<SelectorOptions<GetOperationOptions>> options) { GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); return rootOptions == null ? false : GetOperationOptions.isRaw(rootOptions); }
private <O extends ObjectType> void authorizeOptions(GetOperationOptions rootOptions, PrismObject<O> object, ObjectDelta<O> delta, AuthorizationPhaseType phase, Task task, OperationResult result) throws SchemaException, SecurityViolationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException { if (GetOperationOptions.isRaw(rootOptions)) { securityEnforcer.authorize(ModelAuthorizationAction.RAW_OPERATION.getUrl(), phase, AuthorizationParameters.Builder.buildObjectDelta(object, delta), null, task, 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 <T extends ObjectType> void validateObject(PrismObject<T> object, GetOperationOptions options, OperationResult result) { try { if (InternalsConfig.readEncryptionChecks) { CryptoUtil.checkEncrypted(object); } if (!InternalsConfig.consistencyChecks) { return; } Class<T> type = object.getCompileTimeClass(); boolean tolerateRaw = GetOperationOptions.isTolerateRawData(options); if (type == ResourceType.class || ShadowType.class.isAssignableFrom(type) || type == ReportType.class) { // We tolerate raw values for resource and shadows in case the user has requested so tolerateRaw = GetOperationOptions.isRaw(options); } if (hasError(object, result)) { // If there is an error then the object might not be complete. // E.g. we do not have a complete dynamic schema to apply to the object // Tolerate some raw meat in that case. tolerateRaw = true; } if (InternalsConfig.consistencyChecks) { object.checkConsistence(true, !tolerateRaw, ConsistencyCheckScope.THOROUGH); } } catch (RuntimeException e) { result.recordFatalError(e); throw e; } }
@Override public <T extends ObjectType> PrismObject<T> getObject(Class<T> type, String oid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws SchemaException, ObjectNotFoundException { OperationResult result = parentResult.createMinorSubresult(DOT_INTERFACE + ".getObject"); result.addParam("objectType", type); result.addParam("oid", oid); result.addArbitraryObjectCollectionAsParam("options", options); result.addContext(OperationResult.CONTEXT_IMPLEMENTATION_CLASS, TaskManagerQuartzImpl.class); try { if (TaskType.class.isAssignableFrom(type)) { GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); if (GetOperationOptions.isRaw(rootOptions)) { //noinspection unchecked return (PrismObject<T>) repositoryService.getObject(TaskType.class, oid, options, result); } else { //noinspection unchecked return (PrismObject<T>) getTaskAsObject(oid, options, result); } } else if (NodeType.class.isAssignableFrom(type)) { //noinspection unchecked return (PrismObject<T>) repositoryService.getObject(NodeType.class, oid, options, result); // TODO add transient attributes just like in searchObject } else { throw new IllegalArgumentException("Unsupported object type: " + type); } } finally { result.computeStatusIfUnknown(); } }
private PrismObject<ShadowType> processNoFetchGet(ProvisioningContext ctx, PrismObject<ShadowType> repositoryShadow, Collection<SelectorOptions<GetOperationOptions>> options, XMLGregorianCalendar now, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException, EncryptionException { LOGGER.trace("Processing noFetch get for {}", repositoryShadow); GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); if (!GetOperationOptions.isRaw(rootOptions)) { // Even with noFetch we still want to delete expired pending operations. And even delete // the shadow if needed. repositoryShadow = refreshShadowQick(ctx, repositoryShadow, now, task, parentResult); } if (repositoryShadow == null) { ObjectNotFoundException e = new ObjectNotFoundException("Resource object not found"); parentResult.recordFatalError(e); throw e; } PrismObject<ShadowType> resultShadow = futurizeShadow(ctx, repositoryShadow, null, options, now); shadowCaretaker.applyAttributesDefinition(ctx, resultShadow); return resultShadow; }
rootOptions = SelectorOptions.findRootOptions(options); if (GetOperationOptions.isRaw(rootOptions)) { // MID-2218 QNameUtil.setTemporarilyTolerateUndeclaredPrefixes(true);
if (GetOperationOptions.isRaw(rootOptions)) { // MID-2218 QNameUtil.setTemporarilyTolerateUndeclaredPrefixes(true);
if (searchProvider == null || searchProvider == ObjectTypes.ObjectManager.MODEL || GetOperationOptions.isRaw(rootOptions)) { searchProvider = ObjectTypes.ObjectManager.REPOSITORY; if (GetOperationOptions.isRaw(rootOptions)) { // MID-2218 QNameUtil.setTemporarilyTolerateUndeclaredPrefixes(true); case TASK_MANAGER: list = taskManager.searchObjects(type, processedQuery, options, result); if (workflowManager != null && TaskType.class.isAssignableFrom(type) && !GetOperationOptions.isRaw(rootOptions) && !GetOperationOptions.isNoFetch(rootOptions)) { workflowManager.augmentTaskObjectList(list, options, task, result); if (searchProvider == ObjectTypes.ObjectManager.REPOSITORY && !GetOperationOptions.isRaw(rootOptions)) { for (PrismObject<T> object : list) { if (object.asObjectable() instanceof ResourceType || object.asObjectable() instanceof ShadowType) {
final GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); ObjectTypes.ObjectManager searchProvider = ObjectTypes.getObjectManagerForClass(type); if (searchProvider == null || searchProvider == ObjectTypes.ObjectManager.MODEL || GetOperationOptions.isRaw(rootOptions)) { searchProvider = ObjectTypes.ObjectManager.REPOSITORY; if (workflowManager != null && TaskType.class.isAssignableFrom(type) && !GetOperationOptions.isRaw(rootOptions) && !GetOperationOptions.isNoFetch(rootOptions)) { workflowManager.augmentTaskObject(object, options, task, result);
if (GetOperationOptions.isRaw(rootOptions) || objectManager == null || objectManager == ObjectTypes.ObjectManager.MODEL) { objectManager = ObjectTypes.ObjectManager.REPOSITORY;
if (GetOperationOptions.isRaw(rootOptions)) { LOGGER.debug("Loading definitions for shadow attributes.");
if (GetOperationOptions.isRaw(rootOptions)) { try { resultingObject = (PrismObject<T>) cacheRepositoryService.getObject(ResourceType.class, oid, if (!GetOperationOptions.isRaw(rootOptions)) { resultingObject = resultingObject.cloneIfImmutable(); resultingObject.asObjectable().setFetchResult(result.createOperationResultType());
if (!ShadowType.class.isAssignableFrom(type) || GetOperationOptions.isNoFetch(rootOptions) || GetOperationOptions.isRaw(rootOptions)) { int count = getCacheRepositoryService().countObjects(type, query, options, parentResult); result.computeStatus();
projContext.getObjectTypeClass(), projectionObjectOid, options, task, result); if (LOGGER.isTraceEnabled()) { if (!GetOperationOptions.isNoFetch(rootOptions) && !GetOperationOptions.isRaw(rootOptions)) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Full shadow loaded for {}:\n{}", projContext.getHumanReadableName(), objectOld.debugDump(1));
XMLGregorianCalendar now = clock.currentTimeXMLGregorianCalendar(); if (GetOperationOptions.isNoFetch(rootOptions) || GetOperationOptions.isRaw(rootOptions)) { return processNoFetchGet(ctx, repositoryShadow, options, now, task, parentResult);