private ResourceObjectEvent createRequest(OperationStatus status,
ResourceOperationDescription operationDescription,
Task task,
OperationResult result) {
ResourceObjectEvent event = new ResourceObjectEvent(lightweightIdentifierGenerator);
event.setAccountOperationDescription(operationDescription);
event.setOperationStatus(status);
event.setChangeType(operationDescription.getObjectDelta().getChangeType());
String accountOid = operationDescription.getObjectDelta().getOid();
PrismObject<UserType> user = findRequestee(accountOid, task, result, operationDescription.getObjectDelta().isDelete());
if (user != null) {
event.setRequestee(new SimpleObjectRefImpl(notificationsUtil, user.asObjectable()));
}
if (task != null && task.getOwner() != null) {
event.setRequester(new SimpleObjectRefImpl(notificationsUtil, task.getOwner()));
} else {
LOGGER.warn("No owner for task {}, therefore no requester will be set for event {}", task, event.getId());
}
if (task != null && task.getChannel() != null) {
event.setChannel(task.getChannel());
} else if (operationDescription.getSourceChannel() != null) {
event.setChannel(operationDescription.getSourceChannel());
}
return event;
}