Skip to content
Permalink
Browse files
Adding get notification status by notofocation id api
  • Loading branch information
DImuthuUpe committed Sep 7, 2021
1 parent 0198ca6 commit 83ce467dd6450c6a4c88fc10e025cbdc3fad8ee0
Showing 3 changed files with 28 additions and 0 deletions.
@@ -20,5 +20,9 @@
import org.apache.airavata.datalake.orchestrator.registry.persistance.entity.notification.NotificationStatusEntity;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface NotificationStatusEntityRepository extends JpaRepository<NotificationStatusEntity, String> {

public List<NotificationStatusEntity> findByNotificationId(String notificationId);
}
@@ -85,4 +85,18 @@ public void listNotificationStatus(NotificationStatusListRequest request, Stream
responseObserver.onNext(responseBuilder.build());
responseObserver.onCompleted();
}

@Override
public void fetchNotificationStatus(NotificationStatusFetchRequest request, StreamObserver<NotificationStatusListResponse> responseObserver) {
List<NotificationStatusEntity> allEntities = notificationStatusRepository.findByNotificationId(request.getNotificationId());
DozerBeanMapper mapper = new DozerBeanMapper();
NotificationStatusListResponse.Builder responseBuilder = NotificationStatusListResponse.newBuilder();
for (NotificationStatusEntity e : allEntities) {
NotificationStatus.Builder builder = NotificationStatus.newBuilder();
mapper.map(e, builder);
responseBuilder.addStatuses(builder.build());
}
responseObserver.onNext(responseBuilder.build());
responseObserver.onCompleted();
}
}
@@ -80,6 +80,10 @@ message NotificationStatusListResponse {
repeated NotificationStatus statuses = 1;
}

message NotificationStatusFetchRequest {
string notificationId = 1;
}

service NotificationService {

rpc registerNotification (NotificationRegisterRequest) returns (NotificationRegisterResponse) {
@@ -105,4 +109,10 @@ service NotificationService {
get: "/v1.0/api/dataorch/notification/status"
};
}

rpc fetchNotificationStatus(NotificationStatusFetchRequest) returns (NotificationStatusListResponse) {
option (google.api.http) = {
get: "/v1.0/api/dataorch/notification/status/{notificationId}"
};
}
}

0 comments on commit 83ce467

Please sign in to comment.