Search in sources :

Example 61 with GetOperationOptions

use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.

the class GetHelper method processNoFetchGet.

@NotNull
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 {
    LOGGER.trace("Processing noFetch get for {}", repositoryShadow);
    GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options);
    if (!isRaw(rootOptions)) {
        // Even with noFetch we still want to delete expired pending operations. And even delete
        // the shadow if needed.
        repositoryShadow = refreshHelper.refreshShadowQuick(ctx, repositoryShadow, now, task, parentResult);
    }
    if (repositoryShadow == null) {
        ObjectNotFoundException e = new ObjectNotFoundException("Resource object not found");
        parentResult.recordFatalError(e);
        throw e;
    }
    // TODO do we really want to do this in raw mode (MID-7419)?
    // must be done before futurizeShadow
    shadowCaretaker.updateShadowState(ctx, repositoryShadow);
    PrismObject<ShadowType> resultShadow = commonHelper.futurizeShadow(ctx, repositoryShadow, null, options, now);
    shadowCaretaker.applyAttributesDefinition(ctx, resultShadow);
    return resultShadow;
}
Also used : GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) NotNull(org.jetbrains.annotations.NotNull)

Example 62 with GetOperationOptions

use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.

the class QShadowMapping method toSchemaObject.

@Override
public ShadowType toSchemaObject(Tuple row, QShadow entityPath, Collection<SelectorOptions<GetOperationOptions>> options) throws SchemaException {
    ShadowType shadowType = super.toSchemaObject(row, entityPath, options);
    // FIXME: we store it because provisioning now sends it to repo, but it should be transient
    shadowType.asPrismObject().removeContainer(ShadowType.F_ASSOCIATION);
    GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options);
    if (GetOperationOptions.isRaw(rootOptions)) {
        // If raw=true, we populate attributes with types cached in repository
        Jsonb rowAttributes = row.get(entityPath.attributes);
        applyShadowAttributesDefinitions(shadowType, rowAttributes);
    }
    List<SelectorOptions<GetOperationOptions>> retrieveOptions = SelectorOptions.filterRetrieveOptions(options);
    if (retrieveOptions.isEmpty()) {
        return shadowType;
    }
    if (loadIndexOnly(retrieveOptions)) {
        addIndexOnlyAttributes(shadowType, row, entityPath, retrieveOptions);
    }
    return shadowType;
}
Also used : GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) Jsonb(com.evolveum.midpoint.repo.sqale.jsonb.Jsonb) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Aggregations

GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)62 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)33 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)32 Task (com.evolveum.midpoint.task.api.Task)23 Collection (java.util.Collection)16 Test (org.testng.annotations.Test)12 PrismObject (com.evolveum.midpoint.prism.PrismObject)11 NotNull (org.jetbrains.annotations.NotNull)11 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)10 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)10 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)10 QName (javax.xml.namespace.QName)9 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)8 com.evolveum.midpoint.util.exception (com.evolveum.midpoint.util.exception)7 List (java.util.List)7 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)6 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)6 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)6 UniformItemPath (com.evolveum.midpoint.prism.path.UniformItemPath)5 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)5