Search in sources :

Example 6 with NotificationRegistrationEntity

use of org.finra.herd.model.jpa.NotificationRegistrationEntity in project herd by FINRAOS.

the class NotificationRegistrationStatusServiceImpl method updateNotificationRegistrationStatus.

@NamespacePermission(fields = "#namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
public NotificationRegistrationStatusUpdateResponse updateNotificationRegistrationStatus(String namespace, String notificationName, NotificationRegistrationStatusUpdateRequest notificationRegistrationStatusUpdateRequest) {
    Assert.hasText(namespace, "The namespace must be specified");
    Assert.hasText(notificationName, "The notification name must be specified");
    String notificationRegistrationStatus = notificationRegistrationStatusUpdateRequest.getNotificationRegistrationStatus();
    Assert.hasText(notificationRegistrationStatus, "The notification registration status must be specified");
    NotificationRegistrationEntity notificationRegistration = notificationRegistrationDaoHelper.getNotificationRegistration(namespace.trim(), notificationName.trim());
    NotificationRegistrationStatusEntity notificationRegistrationStatusEntity = notificationRegistrationStatusDaoHelper.getNotificationRegistrationStatusEntity(notificationRegistrationStatus.trim());
    notificationRegistration.setNotificationRegistrationStatus(notificationRegistrationStatusEntity);
    NotificationRegistrationStatusUpdateResponse notificationRegistrationStatusUpdateResponse = new NotificationRegistrationStatusUpdateResponse();
    notificationRegistrationStatusUpdateResponse.setNotificationRegistrationKey(new NotificationRegistrationKey(notificationRegistration.getNamespace().getCode(), notificationRegistration.getName()));
    notificationRegistrationStatusUpdateResponse.setNotificationRegistrationStatus(notificationRegistrationStatusEntity.getCode());
    return notificationRegistrationStatusUpdateResponse;
}
Also used : NotificationRegistrationStatusEntity(org.finra.herd.model.jpa.NotificationRegistrationStatusEntity) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Aggregations

NotificationRegistrationEntity (org.finra.herd.model.jpa.NotificationRegistrationEntity)6 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)5 Test (org.junit.Test)4 BusinessObjectDataNotificationRegistrationEntity (org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity)3 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1 NotificationRegistrationStatusUpdateResponse (org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse)1 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)1 NotificationRegistrationStatusEntity (org.finra.herd.model.jpa.NotificationRegistrationStatusEntity)1 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1