private boolean matches(PrismReferenceValue refVal, PrismObject<ShadowType> linkTarget) throws ObjectNotFoundException, SchemaException { ShadowType linkTargetType = linkTarget.asObjectable(); if (resourceOid != null) { if (!resourceOid.equals(linkTargetType.getResourceRef().getOid())) { return false; } } if (dead != null) { if (dead && !ShadowUtil.isDead(linkTargetType)) { return false; } else if (!dead && ShadowUtil.isDead(linkTargetType)) { return false; } } // TODO: more criteria return true; }
public void addDeadShadowDeltas(PrismObject<ShadowType> repoShadow, AsynchronousOperationResult asyncResult, List<ItemDelta> shadowModifications) { LOGGER.trace("Marking shadow {} as dead", repoShadow); if (ShadowUtil.isExists(repoShadow.asObjectable())) { shadowModifications.add(createShadowPropertyReplaceDelta(repoShadow, ShadowType.F_EXISTS, Boolean.FALSE)); } if (!ShadowUtil.isDead(repoShadow.asObjectable())) { shadowModifications.add(createShadowPropertyReplaceDelta(repoShadow, ShadowType.F_DEAD, Boolean.TRUE)); } }
public PrismObject<ShadowType> eliminateDeadShadows(List<PrismObject<ShadowType>> shadows, OperationResult result) { if (shadows == null || shadows.isEmpty()) { return null; } PrismObject<ShadowType> liveShadow = null; for (PrismObject<ShadowType> shadow: shadows) { ShadowType shadowType = shadow.asObjectable(); if (!ShadowUtil.isDead(shadowType)) { if (liveShadow == null) { liveShadow = shadow; } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace("More than one live conflicting shadow found {} and {}:\n{}", liveShadow, shadow, DebugUtil.debugDump(shadows, 1)); } // TODO: handle "more than one shadow" case MID-4490 String msg = "Found more than one live conflicting shadows: "+liveShadow+" and " + shadow; result.recordFatalError(msg); throw new IllegalStateException(msg); } } } return liveShadow; }
public ShadowState determineShadowState(ProvisioningContext ctx, PrismObject<ShadowType> shadow, XMLGregorianCalendar now) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException { ShadowType shadowType = shadow.asObjectable(); ChangeTypeType pendingLifecycleOperation = findPreviousPendingLifecycleOperationInGracePeriod(ctx, shadow, now); if (ShadowUtil.isDead(shadowType)) { if (pendingLifecycleOperation == ChangeTypeType.DELETE) { return ShadowState.CORPSE; } else { return ShadowState.TOMBSTONE; } } if (ShadowUtil.isExists(shadowType)) { if (pendingLifecycleOperation == ChangeTypeType.DELETE) { return ShadowState.REAPING; } else if (pendingLifecycleOperation == ChangeTypeType.ADD) { return ShadowState.GESTATION; } else { return ShadowState.LIFE; } } if (SchemaConstants.LIFECYCLE_PROPOSED.equals(shadowType.getLifecycleState())) { return ShadowState.PROPOSED; } else { return ShadowState.CONCEPTION; } }
@Nullable public PrismObject<ShadowType> refreshShadow(PrismObject<ShadowType> repoShadow, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException, EncryptionException { ShadowType shadowType = repoShadow.asObjectable(); List<PendingOperationType> pendingOperations = shadowType.getPendingOperation(); boolean isDead = ShadowUtil.isDead(shadowType); if (!isDead && pendingOperations.isEmpty()) { LOGGER.trace("Skipping refresh of {} because shadow is not dead and there are no pending operations", repoShadow); return repoShadow; } LOGGER.trace("Refreshing {}, dead={}, {} pending operations", repoShadow, isDead, pendingOperations.size()); ProvisioningContext ctx = ctxFactory.create(repoShadow, task, parentResult); ctx.assertDefinition(); List<PendingOperationType> sortedOperations = shadowCaretaker.sortPendingOperations(shadowType.getPendingOperation()); repoShadow = refreshShadowAsyncStatus(ctx, repoShadow, sortedOperations, task, parentResult); repoShadow = refreshShadowRetryOperations(ctx, repoShadow, sortedOperations, task, parentResult); XMLGregorianCalendar now = clock.currentTimeXMLGregorianCalendar(); repoShadow = cleanUpDeadShadow(ctx, repoShadow, now, task, parentResult); return repoShadow; }
if (!ShadowUtil.isDead(shadowType)) { throw new IllegalStateException("Deleted "+shadow+" not dead");
private List<PrismObject<ShadowType>> assertLiveShadows(int expected, OperationResult result) throws SchemaException { List<PrismObject<ShadowType>> shadowsAfter = getJacksShadows(result); display("Shadows for 'jack' on dummy resource", shadowsAfter); PrismObject<ShadowType> liveShadowAfter = null; for (PrismObject<ShadowType> shadowAfter : shadowsAfter) { if (!ShadowUtil.isDead(shadowAfter.asObjectable())) { if (liveShadowAfter == null) { liveShadowAfter = shadowAfter; } else { fail("More than one live shadow "+liveShadowAfter + ", " + shadowAfter); } } } if (expected == 0 && liveShadowAfter != null) { fail("Unexpected live shadow: "+liveShadowAfter); } if (expected == 1 && liveShadowAfter == null) { fail("No live shadow"); } return shadowsAfter; }
public void determineFullShadowFlag(PrismObject<ShadowType> loadedShadow) { ShadowType shadowType = loadedShadow.asObjectable(); if (ShadowUtil.isDead(shadowType) || !ShadowUtil.isExists(shadowType)) { setFullShadow(false); return; } OperationResultType fetchResult = shadowType.getFetchResult(); if (fetchResult != null && (fetchResult.getStatus() == OperationResultStatusType.PARTIAL_ERROR || fetchResult.getStatus() == OperationResultStatusType.FATAL_ERROR) && (getObjectAny().asObjectable().getFailedOperationType() == null || getObjectAny().asObjectable().getFailedOperationType() != FailedOperationTypeType.ADD)) { // todo what about other kinds of status? [e.g. in-progress] setFullShadow(false); } else { setFullShadow(true); } }
if (ShadowUtil.isDead(repoShadowType)) {
Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException, EncryptionException { ShadowType shadowType = repoShadow.asObjectable(); if (ShadowUtil.isDead(shadowType)) { return repoShadow;
XMLGregorianCalendar now, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException, EncryptionException { ShadowType shadowType = repoShadow.asObjectable(); if (!ShadowUtil.isDead(shadowType)) { return repoShadow;
intent = LensUtil.refineProjectionIntent(kind, intent, resource, prismContext); boolean thombstone = false; if (ShadowUtil.isDead(accountType)) { thombstone = true; existingShadow.debugDump(1), newShadow.debugDump(1)); if (!ShadowUtil.isDead(newShadow.asObjectable())) { throw new PolicyViolationException("Projection "+rsd+" already exists in context (existing "+existingShadow+", new "+projection);
if (SynchronizationSituationType.DELETED.equals(currentSynchronizationSituation) && ShadowUtil.isDead(currentShadow.asObjectable())) { LOGGER.trace("Skipping update of synchronization situation for deleted dead shadow"); result.recordSuccess();
if (!ShadowUtil.isDead(currentShadowType) || ShadowUtil.isExists(currentShadowType)) { shadowManager.markShadowTombstone(currentShadow, parentResult);
} else { projectionContext.setExists(ShadowUtil.isExists(shadow.asObjectable())); if (ShadowUtil.isDead(shadow.asObjectable())) { projectionContext.markTombstone(); LOGGER.trace("Loading dead shadow {} for projection", shadow, projectionContext.getHumanReadableName());
} else { projContext.setExists(false); if (ShadowUtil.isDead(objectOld.asObjectable())) { projContext.markTombstone();
if (ProvisioningUtil.hasPendingAddOperation(repositoryShadow) || ShadowUtil.isDead(repositoryShadow.asObjectable())) { if (ProvisioningUtil.isFuturePointInTime(options)) {