use of com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType in project midpoint by Evolveum.
the class AbstractActivationComputerTest method testCompute.
protected void testCompute(String lifecycleState, XMLGregorianCalendar now, ActivationStatusType administrativeStatus, XMLGregorianCalendar validFrom, XMLGregorianCalendar validTo, ActivationStatusType expectedEffective, TimeIntervalStatusType expectedValidity) throws SchemaException, IOException {
// GIVEN
Clock clock = createClock(now);
ActivationComputer activationComputer = createActivationComputer(clock);
ActivationType activationType = createActivationType(administrativeStatus, validFrom, validTo);
// WHEN
activationComputer.computeEffective(lifecycleState, activationType, createLifecycleModel());
// THEN
assertEquals("Unexpected effective status", expectedEffective, activationType.getEffectiveStatus());
assertEquals("Unexpected validity status", expectedValidity, activationType.getValidityStatus());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType 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.TimeIntervalStatusType 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);
}
Aggregations