@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) {
throw new SystemException(e.getMessage(), e);
}
LOGGER.trace("Change after processing {} . Start synchronizing.", change.toString());
shadowCache.processSynchronization(ctx, change, parentResult);
}