Search in sources :

Example 61 with ResourceShadowDiscriminator

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

the class AssignmentProcessor method getConstructionMapKey.

private <F extends FocusType> ResourceShadowDiscriminator getConstructionMapKey(LensContext<F> context, Construction<F> construction, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
    String resourceOid = construction.getResource(task, result).getOid();
    String intent = construction.getIntent();
    ShadowKindType kind = construction.getKind();
    ResourceType resource = LensUtil.getResourceReadOnly(context, resourceOid, provisioningService, task, result);
    intent = LensUtil.refineProjectionIntent(kind, intent, resource, prismContext);
    ResourceShadowDiscriminator rat = new ResourceShadowDiscriminator(resourceOid, kind, intent);
    return rat;
}
Also used : ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator)

Example 62 with ResourceShadowDiscriminator

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

the class AssignmentProcessor method propagateLegalDecisionToHigherOrders.

private <F extends ObjectType> void propagateLegalDecisionToHigherOrders(LensContext<F> context, LensProjectionContext refProjCtx) {
    ResourceShadowDiscriminator refDiscr = refProjCtx.getResourceShadowDiscriminator();
    if (refDiscr == null) {
        return;
    }
    for (LensProjectionContext aProjCtx : context.getProjectionContexts()) {
        ResourceShadowDiscriminator aDiscr = aProjCtx.getResourceShadowDiscriminator();
        if (aDiscr != null && refDiscr.equivalent(aDiscr) && (refDiscr.getOrder() < aDiscr.getOrder())) {
            aProjCtx.setLegal(refProjCtx.isLegal());
            aProjCtx.setLegalOld(refProjCtx.isLegalOld());
            aProjCtx.setExists(refProjCtx.isExists());
        }
    }
}
Also used : LensProjectionContext(com.evolveum.midpoint.model.impl.lens.LensProjectionContext) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator)

Example 63 with ResourceShadowDiscriminator

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

the class TestEditSchema method test260EditShadowSchemaKindIntent.

@Test
public void test260EditShadowSchemaKindIntent() throws Exception {
    final String TEST_NAME = "test260EditShadowSchemaKindIntent";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ResourceShadowDiscriminator discr = new ResourceShadowDiscriminator(RESOURCE_DUMMY_OID, ShadowKindType.ACCOUNT, null);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    PrismObjectDefinition<ShadowType> editDef = modelInteractionService.getEditShadowDefinition(discr, AuthorizationPhaseType.REQUEST, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismPropertyDefinition<PolyString> nameDef = editDef.findPropertyDefinition(ShadowType.F_NAME);
    assertNotNull("No definition for name in shadow", nameDef);
    assertEquals("Wrong shadow name displayName", "ObjectType.name", nameDef.getDisplayName());
    assertTrue("additionalName not readable", nameDef.canRead());
    PrismPropertyDefinition<Object> attrFullNameDef = editDef.findPropertyDefinition(dummyResourceCtl.getAttributeFullnamePath());
    assertNotNull("No definition for fullname attribute in shadow", attrFullNameDef);
    assertEquals("Wrong shadow fullname attribute displayName", "Full Name", attrFullNameDef.getDisplayName());
    assertTrue("additionalName not readable", attrFullNameDef.canRead());
    assertSteadyResources();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator) PrismObject(com.evolveum.midpoint.prism.PrismObject) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test)

Example 64 with ResourceShadowDiscriminator

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

the class ProvisioningContext method spawn.

/**
	 * Creates a context for a different object class on the same resource.
	 */
public ProvisioningContext spawn(ShadowKindType kind, String intent) {
    ProvisioningContext ctx = spawnSameResource();
    ctx.shadowCoordinates = new ResourceShadowDiscriminator(getResourceOid(), kind, intent);
    return ctx;
}
Also used : ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator)

Example 65 with ResourceShadowDiscriminator

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

the class ProvisioningContext method spawn.

/**
	 * Creates a context for a different object class on the same resource.
	 */
public ProvisioningContext spawn(QName objectClassQName) throws SchemaException {
    ProvisioningContext ctx = spawnSameResource();
    ctx.shadowCoordinates = new ResourceShadowDiscriminator(getResourceOid(), null, null);
    ctx.shadowCoordinates.setObjectClass(objectClassQName);
    return ctx;
}
Also used : ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator)

Aggregations

ResourceShadowDiscriminator (com.evolveum.midpoint.schema.ResourceShadowDiscriminator)78 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)41 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)34 Task (com.evolveum.midpoint.task.api.Task)30 Test (org.testng.annotations.Test)30 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)28 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)18 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)17 ResourceObjectShadowChangeDescription (com.evolveum.midpoint.provisioning.api.ResourceObjectShadowChangeDescription)17 ModelProjectionContext (com.evolveum.midpoint.model.api.context.ModelProjectionContext)11 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)10 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)10 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)9 ModelExecuteOptions (com.evolveum.midpoint.model.api.ModelExecuteOptions)9 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)9 AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)8 MockLensDebugListener (com.evolveum.midpoint.model.impl.util.mock.MockLensDebugListener)8 PrismObject (com.evolveum.midpoint.prism.PrismObject)8 QName (javax.xml.namespace.QName)7 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)6