Search in sources :

Example 26 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType 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 27 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType 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)

Example 28 with ActivationType

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

the class TestActivation method assertValidity.

private <F extends FocusType> void assertValidity(PrismObject<F> focus, TimeIntervalStatusType expectedValidityStatus) {
    ActivationType activation = focus.asObjectable().getActivation();
    assertNotNull("No activation in " + focus, activation);
    assertEquals("Unexpected validity status in " + focus, expectedValidityStatus, activation.getValidityStatus());
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)

Example 29 with ActivationType

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

the class ResourceObjectConverter method convertFromSimulatedActivationAdministrativeStatus.

private static void convertFromSimulatedActivationAdministrativeStatus(ActivationType activationType, ActivationCapabilityType activationCapability, ResourceType resource, PrismObject<ShadowType> shadow, OperationResult parentResult) {
    ActivationStatusCapabilityType statusCapabilityType = CapabilityUtil.getEffectiveActivationStatus(activationCapability);
    if (statusCapabilityType == null) {
        return;
    }
    ResourceAttributeContainer attributesContainer = ShadowUtil.getAttributesContainer(shadow);
    ResourceAttribute<?> simulatedStatusAttribute = null;
    if (statusCapabilityType.getAttribute() != null) {
        simulatedStatusAttribute = attributesContainer.findAttribute(statusCapabilityType.getAttribute());
    }
    // LOGGER.trace("activation property: {}", activationProperty.dump());
    // if (activationProperty == null) {
    // LOGGER.debug("No simulated activation attribute was defined for the account.");
    // return null;
    // }
    Collection<Object> simulatedStatusAttributeValues = null;
    if (simulatedStatusAttribute != null) {
        simulatedStatusAttributeValues = simulatedStatusAttribute.getRealValues(Object.class);
    }
    convertFromSimulatedActivationAdministrativeStatusInternal(activationType, statusCapabilityType, resource, simulatedStatusAttributeValues, parentResult);
    LOGGER.trace("Detected simulated activation administrativeStatus attribute {} on {} with value {}, resolved into {}", SchemaDebugUtil.prettyPrint(statusCapabilityType.getAttribute()), ObjectTypeUtil.toShortString(resource), simulatedStatusAttributeValues, activationType == null ? "null" : activationType.getAdministrativeStatus());
    // will have two ways to set activation.
    if (statusCapabilityType.isIgnoreAttribute() == null || statusCapabilityType.isIgnoreAttribute()) {
        if (simulatedStatusAttribute != null) {
            attributesContainer.remove(simulatedStatusAttribute);
        }
    }
}
Also used : ActivationStatusCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)

Example 30 with ActivationType

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

the class ResourceObjectConverter method completeActivation.

/**
	 * Completes activation state by determining simulated activation if necessary.
	 */
private void completeActivation(ProvisioningContext ctx, PrismObject<ShadowType> resourceObject, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    ResourceType resourceType = ctx.getResource();
    ShadowType resourceObjectType = resourceObject.asObjectable();
    CapabilitiesType connectorCapabilities = ctx.getConnectorCapabilities(ReadCapabilityType.class);
    ActivationCapabilityType activationCapability = CapabilityUtil.getEffectiveCapability(connectorCapabilities, ActivationCapabilityType.class);
    if (resourceObjectType.getActivation() != null || CapabilityUtil.isCapabilityEnabled(activationCapability)) {
        ActivationType activationType = null;
        if (CapabilityUtil.hasNativeCapability(connectorCapabilities, ActivationCapabilityType.class)) {
            activationType = resourceObjectType.getActivation();
        } else if (CapabilityUtil.isCapabilityEnabled(activationCapability)) {
            activationType = convertFromSimulatedActivationAttributes(resourceType, resourceObject, activationCapability, parentResult);
        } else {
        // No activation capability, nothing to do
        }
        LOGGER.trace("Determined activation, administrativeStatus: {}, lockoutStatus: {}", activationType == null ? "null activationType" : activationType.getAdministrativeStatus(), activationType == null ? "null activationType" : activationType.getLockoutStatus());
        resourceObjectType.setActivation(activationType);
    } else {
        resourceObjectType.setActivation(null);
    }
}
Also used : ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)

Aggregations

ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)76 Test (org.testng.annotations.Test)48 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)40 AbstractUnitTest (com.evolveum.midpoint.tools.testng.AbstractUnitTest)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)10 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Task (com.evolveum.midpoint.task.api.Task)9 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)8 PrismObject (com.evolveum.midpoint.prism.PrismObject)7 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)7 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)7 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)6 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)6 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)6 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)5 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)4 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)4 ActivationLockoutStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)4 QName (javax.xml.namespace.QName)4