Search in sources :

Example 1 with Notification

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;
    }
}
Also used : RegistryService(org.apache.airavata.registry.api.RegistryService) SharingRegistryService(org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService) Notification(org.apache.airavata.model.workspace.Notification) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) CredentialStoreException(org.apache.airavata.credential.store.exception.CredentialStoreException) AiravataException(org.apache.airavata.common.exception.AiravataException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException)

Example 2 with Notification

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;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) Notification(org.apache.airavata.model.workspace.Notification)

Example 3 with Notification

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;
}
Also used : NotificationResource(org.apache.airavata.registry.core.experiment.catalog.resources.NotificationResource) Notification(org.apache.airavata.model.workspace.Notification) ExperimentCatResource(org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource)

Aggregations

Notification (org.apache.airavata.model.workspace.Notification)3 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)2 AiravataException (org.apache.airavata.common.exception.AiravataException)1 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)1 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)1 RegistryService (org.apache.airavata.registry.api.RegistryService)1 ExperimentCatResource (org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource)1 NotificationResource (org.apache.airavata.registry.core.experiment.catalog.resources.NotificationResource)1 SharingRegistryService (org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService)1 TException (org.apache.thrift.TException)1