2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdcrests.notifications.rest.services;
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
27 import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
28 import org.springframework.validation.annotation.Validated;
30 import javax.validation.constraints.NotNull;
31 import javax.ws.rs.Consumes;
32 import javax.ws.rs.GET;
33 import javax.ws.rs.HeaderParam;
34 import javax.ws.rs.PUT;
35 import javax.ws.rs.Path;
36 import javax.ws.rs.PathParam;
37 import javax.ws.rs.Produces;
38 import javax.ws.rs.QueryParam;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
41 import java.lang.reflect.InvocationTargetException;
42 import java.util.UUID;
44 import static org.openecomp.sdcrests.common.RestConstants.LAST_DELIVERED_QUERY_PARAM;
45 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
46 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
48 @Path("/v1.0/notifications")
49 @Produces(MediaType.APPLICATION_JSON)
50 @Consumes(MediaType.APPLICATION_JSON)
51 @Api(value = "Notifications")
53 public interface Notifications {
54 String LIMIT_QUERY_PARAM = "NOTIFICATION_ROWS_LIMIT";
55 String END_OF_PAGE_QUERY_PARAM = "END_OF_PAGE_EVENT_ID";
58 @ApiOperation(value = "Retrive all user notifications",
59 response = NotificationsStatusDto.class,
60 responseContainer = "List")
61 Response getNotifications(
62 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
63 @QueryParam(LAST_DELIVERED_QUERY_PARAM) UUID lastDelvered,
64 @QueryParam(END_OF_PAGE_QUERY_PARAM) UUID endOfPage);
67 @Path("/{notificationId}")
68 @ApiOperation(value = "Mark notification as read",
69 response = UpdateNotificationResponseStatus.class)
71 @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
72 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
73 throws InvocationTargetException, IllegalAccessException;
76 @Path("/last-seen/{notificationId}")
77 @ApiOperation(value = "Update Last Seen Notification",
78 response = UpdateNotificationResponseStatus.class)
79 Response updateLastSeenNotification(
80 @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
81 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
82 throws InvocationTargetException, IllegalAccessException;
86 @ApiOperation(value = "Retrive user not delivered notifications",
87 response = NotificationsStatusDto.class,
88 responseContainer = "List")
89 Response getNewNotificationsByOwnerId(
90 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
91 @QueryParam(LAST_DELIVERED_QUERY_PARAM) String eventId,
92 @QueryParam(LIMIT_QUERY_PARAM) String limit);