use of io.gravitee.rest.api.model.notification.PortalNotificationConfigEntity in project gravitee-management-rest-api by gravitee-io.
the class ApplicationNotificationResource method update.
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Permissions({ @Permission(value = RolePermission.APPLICATION_NOTIFICATION, acls = RolePermissionAction.UPDATE) })
public Response update(@PathParam("applicationId") String applicationId, @NotNull(message = "Input must not be null.") NotificationInput notification) {
// Does application exists ?
applicationService.findById(applicationId);
final PortalNotificationConfigEntity portalConfig = portalNotificationConfigService.findById(getAuthenticatedUser(), NotificationReferenceType.APPLICATION, applicationId);
portalConfig.setHooks(notification.getHooks());
portalNotificationConfigService.save(portalConfig);
genericNotificationConfigService.findByReference(NotificationReferenceType.APPLICATION, applicationId).forEach(genericConfig -> {
genericConfig.setHooks(notification.getHooks());
genericNotificationConfigService.update(genericConfig);
});
return Response.ok(notification.getHooks()).build();
}
use of io.gravitee.rest.api.model.notification.PortalNotificationConfigEntity in project gravitee-management-rest-api by gravitee-io.
the class PortalNotificationConfigServiceImpl method convert.
private PortalNotificationConfigEntity convert(PortalNotificationConfig portalNotificationConfig) {
PortalNotificationConfigEntity entity = new PortalNotificationConfigEntity();
entity.setConfigType(NotificationConfigType.PORTAL);
entity.setReferenceType(portalNotificationConfig.getReferenceType().name());
entity.setReferenceId(portalNotificationConfig.getReferenceId());
entity.setUser(portalNotificationConfig.getUser());
entity.setHooks(portalNotificationConfig.getHooks());
return entity;
}
use of io.gravitee.rest.api.model.notification.PortalNotificationConfigEntity in project gravitee-management-rest-api by gravitee-io.
the class ApplicationNotificationSettingsResource method convert.
private PortalNotificationConfigEntity convert(GenericNotificationConfigEntity generic) {
PortalNotificationConfigEntity portalNotificationConfigEntity = new PortalNotificationConfigEntity();
portalNotificationConfigEntity.setConfigType(generic.getConfigType());
portalNotificationConfigEntity.setReferenceType(generic.getReferenceType());
portalNotificationConfigEntity.setReferenceId(generic.getReferenceId());
portalNotificationConfigEntity.setUser(getAuthenticatedUser());
portalNotificationConfigEntity.setHooks(generic.getHooks());
return portalNotificationConfigEntity;
}
use of io.gravitee.rest.api.model.notification.PortalNotificationConfigEntity in project gravitee-management-rest-api by gravitee-io.
the class PortalNotificationSettingsResource method convert.
private PortalNotificationConfigEntity convert(GenericNotificationConfigEntity generic) {
PortalNotificationConfigEntity portalNotificationConfigEntity = new PortalNotificationConfigEntity();
portalNotificationConfigEntity.setConfigType(generic.getConfigType());
portalNotificationConfigEntity.setReferenceType(generic.getReferenceType());
portalNotificationConfigEntity.setReferenceId(generic.getReferenceId());
portalNotificationConfigEntity.setUser(getAuthenticatedUser());
portalNotificationConfigEntity.setHooks(generic.getHooks());
return portalNotificationConfigEntity;
}
use of io.gravitee.rest.api.model.notification.PortalNotificationConfigEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiNotificationSettingsResource method convert.
private PortalNotificationConfigEntity convert(GenericNotificationConfigEntity generic) {
PortalNotificationConfigEntity portalNotificationConfigEntity = new PortalNotificationConfigEntity();
portalNotificationConfigEntity.setConfigType(generic.getConfigType());
portalNotificationConfigEntity.setReferenceType(generic.getReferenceType());
portalNotificationConfigEntity.setReferenceId(generic.getReferenceId());
portalNotificationConfigEntity.setUser(getAuthenticatedUser());
portalNotificationConfigEntity.setHooks(generic.getHooks());
return portalNotificationConfigEntity;
}
Aggregations