Search in sources :

Example 16 with ActivationStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.

the class OperationalDataManager method applyAssignmentValueMetadataAdd.

private <F extends FocusType> void applyAssignmentValueMetadataAdd(LensContext<F> context, PrismContainerValue<AssignmentType> assignmentContainerValue, String desc, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException {
    AssignmentType assignmentType = assignmentContainerValue.asContainerable();
    MetadataType metadataType = assignmentType.getMetadata();
    if (metadataType == null) {
        metadataType = new MetadataType();
        assignmentType.setMetadata(metadataType);
    }
    transplantRequestMetadata(context, metadataType);
    ActivationType activationType = assignmentType.getActivation();
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(assignmentType.getLifecycleState(), activationType);
    if (activationType == null) {
        activationType = new ActivationType();
        assignmentType.setActivation(activationType);
    }
    activationType.setEffectiveStatus(effectiveStatus);
    applyCreateMetadata(context, metadataType, now, task);
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Adding operational data {} to assignment cval ({}):\nMETADATA:\n{}\nACTIVATION:\n{}", metadataType, desc, assignmentContainerValue.debugDump(1), activationType.asPrismContainerValue().debugDump(1));
    }
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 17 with ActivationStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertSideEffectiveDeltasOnly.

protected <F extends FocusType> void assertSideEffectiveDeltasOnly(String desc, ObjectDelta<F> focusDelta) {
    if (focusDelta == null) {
        return;
    }
    int expectedModifications = 0;
    // There may be metadata modification, we tolerate that
    Collection<? extends ItemDelta<?, ?>> metadataDelta = focusDelta.findItemDeltasSubPath(new ItemPath(UserType.F_METADATA));
    if (metadataDelta != null && !metadataDelta.isEmpty()) {
        expectedModifications += metadataDelta.size();
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ACTIVATION, ActivationType.F_ENABLE_TIMESTAMP)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ACTIVATION, ActivationType.F_DISABLE_TIMESTAMP)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ACTIVATION, ActivationType.F_ARCHIVE_TIMESTAMP)) != null) {
        expectedModifications++;
    }
    PropertyDelta<ActivationStatusType> effectiveStatusDelta = focusDelta.findPropertyDelta(new ItemPath(UserType.F_ACTIVATION, ActivationType.F_EFFECTIVE_STATUS));
    if (effectiveStatusDelta != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ITERATION)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ROLE_MEMBERSHIP_REF)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_DELEGATED_REF)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ITERATION_TOKEN)) != null) {
        expectedModifications++;
    }
    assertEquals("Unexpected modifications in " + desc + ": " + focusDelta, expectedModifications, focusDelta.getModifications().size());
}
Also used : ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 18 with ActivationStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertEffectualDeltas.

protected <F extends FocusType> void assertEffectualDeltas(ObjectDelta<F> focusDelta, String desc, ActivationStatusType expectedEfficientActivation, int expectedEffectualModifications) {
    if (focusDelta == null) {
        return;
    }
    int expectedModifications = expectedEffectualModifications;
    // There may be metadata modification, we tolerate that
    for (ItemDelta<?, ?> modification : focusDelta.getModifications()) {
        if (modification.getPath().containsName(ObjectType.F_METADATA)) {
            expectedModifications++;
        }
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ACTIVATION, ActivationType.F_ENABLE_TIMESTAMP)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ACTIVATION, ActivationType.F_DISABLE_TIMESTAMP)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ACTIVATION, ActivationType.F_ARCHIVE_TIMESTAMP)) != null) {
        expectedModifications++;
    }
    PropertyDelta<ActivationStatusType> effectiveStatusDelta = focusDelta.findPropertyDelta(new ItemPath(UserType.F_ACTIVATION, ActivationType.F_EFFECTIVE_STATUS));
    if (effectiveStatusDelta != null) {
        expectedModifications++;
        PrismAsserts.assertReplace(effectiveStatusDelta, expectedEfficientActivation);
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ROLE_MEMBERSHIP_REF)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_DELEGATED_REF)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ITERATION)) != null) {
        expectedModifications++;
    }
    if (focusDelta.findItemDelta(new ItemPath(FocusType.F_ITERATION_TOKEN)) != null) {
        expectedModifications++;
    }
    assertEquals("Unexpected modifications in " + desc + ": " + focusDelta, expectedModifications, focusDelta.getModifications().size());
}
Also used : ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 19 with ActivationStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.

the class TestDummyCaching method assertRepoShadowCacheActivation.

@Override
protected void assertRepoShadowCacheActivation(PrismObject<ShadowType> shadowRepo, ActivationStatusType expectedAdministrativeStatus) {
    ActivationType activationType = shadowRepo.asObjectable().getActivation();
    assertNotNull("No activation in repo shadow " + shadowRepo, activationType);
    ActivationStatusType administrativeStatus = activationType.getAdministrativeStatus();
    assertEquals("Wrong activation administrativeStatus in repo shadow " + shadowRepo, expectedAdministrativeStatus, administrativeStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)

Example 20 with ActivationStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.

the class TestMachineIntelligence method assertAssignment.

private void assertAssignment(UserType userType, ActivationStatusType administrativeStatus, XMLGregorianCalendar validTo) {
    List<AssignmentType> assignments = userType.getAssignment();
    assertEquals("Unexpected assignment in user, expected 1, found " + assignments.size(), 1, assignments.size());
    AssignmentType assignmentType = assignments.iterator().next();
    ActivationType assignmentActivation = assignmentType.getActivation();
    assertEquals(administrativeStatus, assignmentActivation.getAdministrativeStatus());
    assertEquals(administrativeStatus, assignmentActivation.getEffectiveStatus());
    if (validTo == null) {
        assertNull("Unexpected validTo value: " + assignmentActivation.getValidTo(), assignmentActivation.getValidTo());
    } else {
    //TODO:
    }
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Aggregations

ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)32 ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)24 Test (org.testng.annotations.Test)17 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)7 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)6 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)6 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 Task (com.evolveum.midpoint.task.api.Task)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)2 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)2 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)2 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)2 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)2 ArrayList (java.util.ArrayList)2 ModelExecuteOptions (com.evolveum.midpoint.model.api.ModelExecuteOptions)1 ModelProjectionContext (com.evolveum.midpoint.model.api.context.ModelProjectionContext)1 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)1