Search in sources :

Example 1 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class TestRefinedSchema method test100EntitlementRefinedObjectClasses.

@Test
public void test100EntitlementRefinedObjectClasses() {
    // WHEN
    Collection<? extends ResourceObjectTypeDefinition> entitlementROcDefs = refinedSchema.getObjectTypeDefinitions(ShadowKindType.ENTITLEMENT);
    display("entitlement rOcDefs", entitlementROcDefs);
    // THEN
    for (ResourceObjectTypeDefinition entitlementROcDef : entitlementROcDefs) {
        assertEquals("Wrong kind in " + entitlementROcDef, ShadowKindType.ENTITLEMENT, entitlementROcDef.getKind());
    }
    assertEquals("Wrong number of entitlement rOcDefs", 6, entitlementROcDefs.size());
}
Also used : ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) Test(org.testng.annotations.Test)

Example 2 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class TestRefinedSchema method test101EntitlementRefinedObjectClassesModel.

@Test
public void test101EntitlementRefinedObjectClassesModel() {
    // WHEN
    Collection<? extends ResourceObjectTypeDefinition> entitlementROcDefs = refinedSchemaModel.getObjectTypeDefinitions(ShadowKindType.ENTITLEMENT);
    display("entitlement rOcDefs", entitlementROcDefs);
    // THEN
    for (ResourceObjectTypeDefinition entitlementROcDef : entitlementROcDefs) {
        assertEquals("Wrong kind in " + entitlementROcDef, ShadowKindType.ENTITLEMENT, entitlementROcDef.getKind());
    }
    assertEquals("Wrong number of entitlement rOcDefs", 6, entitlementROcDefs.size());
}
Also used : ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) Test(org.testng.annotations.Test)

Example 3 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class CorrelationServiceImpl method getFullCorrelationContext.

@NotNull
private FullCorrelationContext getFullCorrelationContext(ShadowType shadow, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException, ConfigurationException, ObjectNotFoundException {
    String resourceOid = ShadowUtil.getResourceOidRequired(shadow);
    ResourceType resource = beans.provisioningService.getObject(ResourceType.class, resourceOid, null, task, result).asObjectable();
    // We expect that the shadow is classified + reasonably fresh (= not legacy), so it has kind+intent present.
    ShadowKindType kind = MiscUtil.requireNonNull(shadow.getKind(), () -> new IllegalStateException("No kind in " + shadow));
    String intent = MiscUtil.requireNonNull(shadow.getIntent(), () -> new IllegalStateException("No intent in " + shadow));
    // TODO check for "unknown" ?
    // We'll look for type definition in the future (after synchronization is integrated into it).
    ResourceSchema schema = ResourceSchemaFactory.getCompleteSchema(resource);
    ResourceObjectTypeDefinition typeDefinition = schema.findObjectTypeDefinitionRequired(kind, intent);
    for (ObjectSynchronizationType config : resource.getSynchronization().getObjectSynchronization()) {
        if (config.getKind() == kind && intent.equals(config.getIntent())) {
            return new FullCorrelationContext(shadow, resource, typeDefinition, config, MiscUtil.requireNonNull(config.getCorrelationDefinition().getCorrelators(), () -> new IllegalStateException("No correlators in " + config)));
        }
    }
    throw new IllegalStateException("No " + kind + "/" + intent + " (kind/intent) definition in " + resource + " (for " + shadow + ")");
}
Also used : ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class AbstractSecurityTest method assertGlobalStateUntouched.

protected void assertGlobalStateUntouched() throws SchemaException {
    ResourceSchema refinedSchema = ResourceSchemaFactory.getCompleteSchema(getDummyResourceObject());
    ResourceObjectTypeDefinition rOcDef = refinedSchema.findDefaultOrAnyObjectTypeDefinition(ShadowKindType.ACCOUNT);
    assertAttributeFlags(rOcDef, SchemaConstants.ICFS_UID, true, false, false);
    assertAttributeFlags(rOcDef, SchemaConstants.ICFS_NAME, true, true, true);
    assertAttributeFlags(rOcDef, new QName("location"), true, true, true);
    assertAttributeFlags(rOcDef, new QName("weapon"), true, true, true);
}
Also used : ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) QName(javax.xml.namespace.QName)

Example 5 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class RefinedResourceSchemaAsserter method defaultDefinition.

public ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> defaultDefinition(ShadowKindType kind) {
    ResourceObjectTypeDefinition objectClassDefinition = getSchema().findDefaultOrAnyObjectTypeDefinition(kind);
    ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> asserter = new ResourceObjectDefinitionAsserter<>(objectClassDefinition, this, "default definition for kind " + kind + " in " + desc());
    copySetupTo(asserter);
    return asserter;
}
Also used : ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)

Aggregations

ResourceObjectTypeDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)32 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)14 QName (javax.xml.namespace.QName)8 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)6 ArrayList (java.util.ArrayList)5 Test (org.testng.annotations.Test)5 ResourceObjectDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectDefinition)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 Task (com.evolveum.midpoint.task.api.Task)4 ShadowKindType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 ResourceAttributeDefinition (com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition)3 List (java.util.List)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 Definition (com.evolveum.midpoint.prism.Definition)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 ResourceAssociationDefinition (com.evolveum.midpoint.schema.processor.ResourceAssociationDefinition)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 NotNull (org.jetbrains.annotations.NotNull)2 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)1