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);
}
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:
}
}
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());
}
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);
}
}
}
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);
}
}
Aggregations