@Override public String debugDump() { return debugDump(0); }
private void applyDefinitions(ResourceEventDescription eventDescription, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException { if (eventDescription.getCurrentShadow() != null){ shadowCache.applyDefinition(eventDescription.getCurrentShadow(), parentResult); } if (eventDescription.getOldShadow() != null){ shadowCache.applyDefinition(eventDescription.getOldShadow(), parentResult); } if (eventDescription.getDelta() != null){ shadowCache.applyDefinition(eventDescription.getDelta(), null, parentResult); } }
@Override public void notifyEvent(ResourceEventDescription eventDescription, Task task, OperationResult parentResult) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ObjectNotFoundException, GenericConnectorException, ObjectAlreadyExistsException, ExpressionEvaluationException { Validate.notNull(eventDescription, "Event description must not be null."); Validate.notNull(task, "Task must not be null."); Validate.notNull(parentResult, "Operation result must not be null"); LOGGER.trace("Received event notification with the description: {}", eventDescription.debugDump()); if (eventDescription.getCurrentShadow() == null && eventDescription.getDelta() == null){ throw new IllegalStateException("Neither current shadow, nor delta specified. It is required to have at least one of them specified."); } applyDefinitions(eventDescription, parentResult); PrismObject<ShadowType> shadow = null; shadow = eventDescription.getShadow(); ProvisioningContext ctx = provisioningContextFactory.create(shadow, task, parentResult); ctx.assertDefinition(); Collection<ResourceAttribute<?>> identifiers = ShadowUtil.getPrimaryIdentifiers(shadow); Change change = new Change(identifiers, eventDescription.getCurrentShadow(), eventDescription.getOldShadow(), eventDescription.getDelta()); ObjectClassComplexTypeDefinition objectClassDefinition = ShadowUtil.getObjectClassDefinition(shadow); change.setObjectClassDefinition(objectClassDefinition); LOGGER.trace("Start to precess change: {}", change.toString()); try { shadowCache.processChange(ctx, change, null, parentResult); } catch (EncryptionException e) { // TODO: better handling throw new SystemException(e.getMessage(), e); } LOGGER.trace("Change after processing {} . Start synchronizing.", change.toString()); shadowCache.processSynchronization(ctx, change, parentResult); }
public void notifyChange(ResourceObjectShadowChangeDescriptionType changeDescription, OperationResult parentResult, Task task) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ObjectNotFoundException, GenericConnectorException, ObjectAlreadyExistsException, ExpressionEvaluationException{ ResourceEventDescription eventDescription = new ResourceEventDescription(); if (!StringUtils.isEmpty(oldShadowOid)){ oldShadow = getObject(ShadowType.class, oldShadowOid, SelectorOptions.createCollection(GetOperationOptions.createDoNotDiscovery()), task, parentResult); eventDescription.setOldShadow(oldShadow); LOGGER.trace("old object resolved to: {}", oldShadow.debugDump()); } else{ eventDescription.setCurrentShadow(currentShadow); deltas.add(delta); ModelImplUtils.encrypt(deltas, protector, null, parentResult); eventDescription.setDelta(delta); eventDescription.setSourceChannel(changeDescription.getChannel());
LOGGER.trace("SYNCHRONIZATION change notification\n{} ", eventDescription.debugDump()); if (filterProtectedObjects && eventDescription.isProtected()) { LOGGER.trace("Skipping dispatching of {} because it is protected", eventDescription); return;
public PrismObject<ShadowType> getShadow() { PrismObject<ShadowType> shadow; if (getCurrentShadow() != null) { shadow = getCurrentShadow(); } else if (getOldShadow() != null) { shadow = getOldShadow(); } else if (getDelta() != null && getDelta().isAdd()) { if (getDelta().getObjectToAdd() == null) { throw new IllegalStateException("Found ADD delta, but no object to add was specified."); } shadow = getDelta().getObjectToAdd(); } else { throw new IllegalStateException("Resource event description does not contain neither old shadow, nor current shadow, nor shadow in delta"); } return shadow; } }