use of org.apache.airavata.registry.core.experiment.catalog.resources.NotificationResource in project airavata by apache.
the class NotificationRegistry method getNotification.
public Notification getNotification(String notificationId) throws RegistryException {
NotificationResource notificationResource = new NotificationResource();
NotificationResource resource = (NotificationResource) notificationResource.get(ResourceType.NOTIFICATION, notificationId);
if (resource != null) {
return ThriftDataModelConversion.getNotification(resource);
}
return null;
}
use of org.apache.airavata.registry.core.experiment.catalog.resources.NotificationResource in project airavata by apache.
the class NotificationRegistry method deleteNotification.
public void deleteNotification(String notificationId) throws RegistryException {
NotificationResource notificationResource = new NotificationResource();
notificationResource.remove(ResourceType.NOTIFICATION, notificationId);
}
use of org.apache.airavata.registry.core.experiment.catalog.resources.NotificationResource in project airavata by apache.
the class NotificationRegistry method updateNotification.
public void updateNotification(Notification notification) throws RegistryException {
NotificationResource notificationResource = new NotificationResource();
notificationResource.setNotificationId(notification.getNotificationId());
notificationResource.setGatewayId(notification.getGatewayId());
notificationResource.setTitle(notification.getTitle());
notificationResource.setNotificationMessage(notification.getNotificationMessage());
notificationResource.setPriority(notification.getPriority().toString());
if (notification.getPublishedTime() != 0)
notificationResource.setPublishedTime(new Timestamp(notification.getPublishedTime()));
if (notification.getExpirationTime() != 0)
notificationResource.setExpirationTime(new Timestamp(notification.getExpirationTime()));
if (notification.getCreationTime() != 0)
notificationResource.setCreationTime(new Timestamp(notification.getCreationTime()));
else
notificationResource.setCreationTime(new Timestamp(System.currentTimeMillis()));
notificationResource.save();
}
use of org.apache.airavata.registry.core.experiment.catalog.resources.NotificationResource in project airavata by apache.
the class NotificationRegistry method getAllGatewayNotifications.
public List<Notification> getAllGatewayNotifications(String gatewayId) throws RegistryException {
List<Notification> notifications = new ArrayList<>();
NotificationResource notificationResource = new NotificationResource();
List<ExperimentCatResource> resources = notificationResource.getAllNotifications(gatewayId);
if (resources != null && !resources.isEmpty()) {
for (ExperimentCatResource e : resources) {
notifications.add(ThriftDataModelConversion.getNotification((NotificationResource) e));
}
}
Collections.sort(notifications, (o1, o2) -> (o2.getCreationTime() - o1.getCreationTime()) > 0 ? 1 : -1);
return notifications;
}
Aggregations