use of io.lumeer.engine.api.event.ReloadResourceVariables in project engine by Lumeer.
the class PusherFacade method reloadResourceVariablesNotification.
public void reloadResourceVariablesNotification(@Observes final ReloadResourceVariables reloadResourceVariables) {
if (isEnabled()) {
try {
Organization organization = organizationDao.getOrganizationById(reloadResourceVariables.getOrganizationId());
Project project = projectDao.getProjectById(reloadResourceVariables.getProjectId());
ObjectWithParent object = new ObjectWithParent(getAppId(), organization.getId(), organization.getId(), project.getId());
Set<String> users = permissionAdapter.getProjectUsersByRole(organization, project, RoleType.TechConfig);
List<Event> events = users.stream().map(userId -> new Event(eventChannel(userId), ResourceVariable.class.getSimpleName() + RELOAD_EVENT_SUFFIX, object)).collect(Collectors.toList());
sendNotificationsBatch(events);
} catch (Exception e) {
log.log(Level.WARNING, "Unable to send push notification: ", e);
}
}
}
Aggregations