use of com.evolveum.prism.xml.ns._public.types_3.ChangeTypeType in project midpoint by Evolveum.
the class ShadowCaretaker method determineShadowStateInternal.
/**
* If emergency situations the context can be null.
*/
@NotNull
private ShadowLifecycleStateType determineShadowStateInternal(@Nullable ProvisioningContext ctx, @NotNull PrismObject<ShadowType> shadow, @NotNull XMLGregorianCalendar now) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
ShadowType shadowBean = shadow.asObjectable();
ChangeTypeType pendingLifecycleOperation = findPreviousPendingLifecycleOperationInGracePeriod(ctx, shadow, now);
if (ShadowUtil.isDead(shadowBean)) {
if (pendingLifecycleOperation == ChangeTypeType.DELETE) {
return ShadowLifecycleStateType.CORPSE;
} else {
return ShadowLifecycleStateType.TOMBSTONE;
}
}
if (ShadowUtil.isExists(shadowBean)) {
if (pendingLifecycleOperation == ChangeTypeType.DELETE) {
return ShadowLifecycleStateType.REAPING;
} else if (pendingLifecycleOperation == ChangeTypeType.ADD) {
return ShadowLifecycleStateType.GESTATING;
} else {
return ShadowLifecycleStateType.LIVE;
}
}
// as proposed, even if they are active in fact. So be careful with this.
if (SchemaConstants.LIFECYCLE_PROPOSED.equals(shadowBean.getLifecycleState())) {
return ShadowLifecycleStateType.PROPOSED;
} else {
return ShadowLifecycleStateType.CONCEIVED;
}
}
use of com.evolveum.prism.xml.ns._public.types_3.ChangeTypeType in project midpoint by Evolveum.
the class ShadowCaretaker method findPreviousPendingLifecycleOperationInGracePeriod.
public ChangeTypeType findPreviousPendingLifecycleOperationInGracePeriod(@Nullable ProvisioningContext ctx, @NotNull PrismObject<ShadowType> shadow, @NotNull XMLGregorianCalendar now) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
List<PendingOperationType> pendingOperations = shadow.asObjectable().getPendingOperation();
if (pendingOperations.isEmpty()) {
return null;
}
Duration gracePeriod = ctx != null ? ProvisioningUtil.getGracePeriod(ctx) : null;
ChangeTypeType found = null;
for (PendingOperationType pendingOperation : pendingOperations) {
ObjectDeltaType delta = pendingOperation.getDelta();
if (delta == null) {
continue;
}
ChangeTypeType changeType = delta.getChangeType();
if (ChangeTypeType.MODIFY.equals(changeType)) {
continue;
}
if (ProvisioningUtil.isOverPeriod(now, gracePeriod, pendingOperation)) {
continue;
}
if (changeType == ChangeTypeType.DELETE) {
// DELETE always wins
return changeType;
} else {
// If there is an ADD then let's check for delete.
found = changeType;
}
}
return found;
}
Aggregations