use of org.apache.airavata.model.workspace.Notification in project airavata by apache.
the class AiravataServerHandler method getNotification.
// No security check
@Override
public Notification getNotification(AuthzToken authzToken, String gatewayId, String notificationId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
RegistryService.Client regClient = registryClientPool.getResource();
try {
Notification result = regClient.getNotification(gatewayId, notificationId);
registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error("Error while retrieving notification", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retreiving notification. More info : " + e.getMessage());
registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
use of org.apache.airavata.model.workspace.Notification in project airavata by apache.
the class RegistryServerHandler method getAllNotifications.
@Override
public List<Notification> getAllNotifications(String gatewayId) throws RegistryServiceException, TException {
try {
experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId);
List<Object> objectList = experimentCatalog.get(ExperimentCatalogModelType.NOTIFICATION, null, gatewayId);
List<Notification> notifications = new ArrayList<>();
for (Object o : objectList) notifications.add((Notification) o);
return notifications;
} catch (RegistryException e) {
logger.error("Error while getting all notifications", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while getting all notifications. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.model.workspace.Notification 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