use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.
the class ActivationComputer method getEffectiveStatus.
public ActivationStatusType getEffectiveStatus(String lifecycleStatus, ActivationType activationType, TimeIntervalStatusType validityStatus, LifecycleStateModelType stateModel) {
ActivationStatusType forcedLifecycleActivationStatus = getForcedLifecycleActivationStatus(lifecycleStatus, stateModel);
if (forcedLifecycleActivationStatus != null) {
return forcedLifecycleActivationStatus;
}
if (activationType == null) {
return ActivationStatusType.ENABLED;
}
ActivationStatusType administrativeStatus = activationType.getAdministrativeStatus();
if (administrativeStatus != null) {
// Explicit administrative status overrides everything
return administrativeStatus;
}
if (validityStatus == null) {
// No administrative status, no validity. Return default.
return ActivationStatusType.ENABLED;
}
switch(validityStatus) {
case AFTER:
case BEFORE:
return ActivationStatusType.DISABLED;
case IN:
return ActivationStatusType.ENABLED;
}
// This should not happen
return null;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.
the class ActivationComputer method computeEffective.
public void computeEffective(String lifecycleStatus, ActivationType activationType, XMLGregorianCalendar referenceTime, LifecycleStateModelType stateModel) {
ActivationStatusType effectiveStatus = getForcedLifecycleActivationStatus(lifecycleStatus, stateModel);
ActivationStatusType administrativeStatus = activationType.getAdministrativeStatus();
if (effectiveStatus == null && administrativeStatus != null) {
// Explicit administrative status overrides everything
effectiveStatus = administrativeStatus;
}
TimeIntervalStatusType validityStatus = getValidityStatus(activationType);
if (effectiveStatus == null) {
if (validityStatus == null) {
// No administrative status, no validity. Defaults to enabled.
effectiveStatus = ActivationStatusType.ENABLED;
} else {
switch(validityStatus) {
case AFTER:
case BEFORE:
effectiveStatus = ActivationStatusType.DISABLED;
break;
case IN:
effectiveStatus = ActivationStatusType.ENABLED;
break;
}
}
}
activationType.setEffectiveStatus(effectiveStatus);
activationType.setValidityStatus(validityStatus);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.
the class InactivateShadowAction method handle.
@Override
public <F extends FocusType> void handle(@NotNull LensContext<F> context, SynchronizationSituation<F> situation, Map<QName, Object> parameters, Task task, OperationResult parentResult) {
ActivationStatusType desiredStatus = ActivationStatusType.DISABLED;
ItemPath pathAdminStatus = SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS;
LensProjectionContext projectionContext = context.getProjectionContextsIterator().next();
PrismObject<ShadowType> objectCurrent = projectionContext.getObjectCurrent();
if (objectCurrent != null) {
PrismProperty<Object> administrativeStatusProp = objectCurrent.findProperty(pathAdminStatus);
if (administrativeStatusProp != null) {
if (desiredStatus.equals(administrativeStatusProp.getRealValue())) {
// Desired status already set, nothing to do
return;
}
}
}
ObjectDelta<ShadowType> activationDelta = getPrismContext().deltaFactory().object().createModificationReplaceProperty(ShadowType.class, projectionContext.getOid(), pathAdminStatus, desiredStatus);
projectionContext.setPrimaryDelta(activationDelta);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.
the class UserAsserter method assertAdministrativeStatus.
public UserAsserter<RA> assertAdministrativeStatus(ActivationStatusType expected) {
ActivationType activation = getActivation();
if (activation == null) {
if (expected == null) {
return this;
} else {
fail("No activation in " + desc());
}
}
assertEquals("Wrong activation administrativeStatus in " + desc(), expected, activation.getAdministrativeStatus());
return this;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType in project midpoint by Evolveum.
the class ActivationConverter method determineActivationStatus.
/**
* Determines activation status for resource object. Uses either native or simulated value.
*/
private ActivationStatusType determineActivationStatus(PrismObject<ShadowType> resourceObject, ActivationCapabilityType activationCapability, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
ActivationType existingActivation = resourceObject.asObjectable().getActivation();
ActivationStatusType nativeValue = existingActivation != null ? existingActivation.getAdministrativeStatus() : null;
ActivationStatusCapabilityType statusCapability = CapabilityUtil.getEnabledActivationStatusStrict(activationCapability);
if (statusCapability == null) {
if (nativeValue != null) {
LOGGER.trace("The status capability is disabled. Ignoring native value: {}", nativeValue);
}
// TODO Reconsider this. Maybe we should return native value.
return null;
}
if (statusCapability.getAttribute() == null) {
LOGGER.trace("Simulated activation status is not configured. Using native value: {}", nativeValue);
return nativeValue;
}
Collection<Object> simulatingAttributeValues = getSimulatingAttributeValues(resourceObject, statusCapability.getAttribute());
TwoStateSimulatedToRealConverter<ActivationStatusType> converter = new TwoStateSimulatedToRealConverter<>(statusCapability.getEnableValue(), statusCapability.getDisableValue(), ActivationStatusType.ENABLED, ActivationStatusType.DISABLED, "activation status", ctx);
ActivationStatusType status = converter.convert(simulatingAttributeValues, result);
LOGGER.trace("Detected simulated activation administrativeStatus attribute {} on {} with value {}, resolved into {}", lazy(() -> SchemaDebugUtil.prettyPrint(statusCapability.getAttribute())), ctx.getResource(), simulatingAttributeValues, status);
if (!Boolean.FALSE.equals(statusCapability.isIgnoreAttribute())) {
removeSimulatingAttribute(resourceObject, statusCapability.getAttribute());
}
return status;
}
Aggregations