summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml56
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java64
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java57
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java94
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java117
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml23
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java91
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java26
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java61
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java65
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml24
11 files changed, 678 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml
new file mode 100644
index 0000000000..597b017b0f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>notifications-rest-services</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-application-config-manager</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <!-- CXF -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-notification-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java
new file mode 100644
index 0000000000..41376b040f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.rest.mapping;
+
+import com.datastax.driver.core.utils.UUIDs;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.notification.dao.types.NotificationEntity;
+import org.openecomp.sdc.notification.dtos.NotificationsStatus;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.notifications.types.NotificationEntityDto;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class MapNotificationsStatusToDto
+ extends MappingBase<NotificationsStatus, NotificationsStatusDto> {
+
+ private static final DateFormat formatter =
+ DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.SHORT);
+
+ @Override
+ public void doMapping(NotificationsStatus source, NotificationsStatusDto target) {
+
+ target.setLastScanned(source.getLastScanned());
+ target.setNewEntries(source.getNewEntries());
+ target.setEndOfPage(source.getEndOfPage());
+ target.setNumOfNotSeenNotifications(source.getNumOfNotSeenNotifications());
+ List<NotificationEntityDto> entityDtos = new ArrayList<>();
+ source.getNotifications()
+ .forEach(notification -> entityDtos.add(new NotificationEntityDto(notification.isRead(),
+ notification.getEventId(), notification.getEventType(),
+ JsonUtil.json2Object(notification.getEventAttributes(), Map.class),
+ extractDate(notification))));
+ target.setNotifications(entityDtos);
+ }
+
+ private String extractDate(NotificationEntity notification) {
+ return formatter.format(UUIDs.unixTimestamp
+ (notification
+ .getEventId()));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java
new file mode 100644
index 0000000000..558453b7b6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.rest.mapping;
+
+import com.datastax.driver.core.utils.UUIDs;
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.notification.dao.types.NotificationEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.notifications.types.NotificationEntityDto;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class MapNotificationsToDto extends MappingBase<List<NotificationEntity>, NotificationsStatusDto> {
+ private static final DateFormat formatter =
+ DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.SHORT);
+ @Override
+ public void doMapping(List<NotificationEntity> source, NotificationsStatusDto target) {
+ List<NotificationEntityDto> entityDtos = new ArrayList<>();
+ if(CollectionUtils.isNotEmpty(source)) {
+ source.forEach(notification -> entityDtos.add(new NotificationEntityDto(notification.isRead(),
+ notification.getEventId(), notification.getEventType(), JsonUtil.json2Object(notification.getEventAttributes(), Map.class),
+ extractDate(notification))));
+ target.setNotifications(entityDtos);
+ target.setLastScanned(source.get(0).getEventId());
+ }
+ }
+
+ private String extractDate(NotificationEntity notification) {
+ return formatter.format(UUIDs.unixTimestamp
+ (notification
+ .getEventId()));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java
new file mode 100644
index 0000000000..97199f604f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.rest.services;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.lang.reflect.InvocationTargetException;
+import java.util.UUID;
+
+import static org.openecomp.sdcrests.common.RestConstants.LAST_DELIVERED_QUERY_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+@Path("/v1.0/notifications")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Notifications")
+@Validated
+public interface Notifications {
+ String LIMIT_QUERY_PARAM = "NOTIFICATION_ROWS_LIMIT";
+ String END_OF_PAGE_QUERY_PARAM = "END_OF_PAGE_EVENT_ID";
+
+ @GET
+ @ApiOperation(value = "Retrive all user notifications",
+ response = NotificationsStatusDto.class,
+ responseContainer = "List")
+ Response getNotifications(
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
+ @QueryParam(LAST_DELIVERED_QUERY_PARAM) UUID lastDelvered,
+ @QueryParam(END_OF_PAGE_QUERY_PARAM) UUID endOfPage);
+
+ @PUT
+ @Path("/{notificationId}")
+ @ApiOperation(value = "Mark notification as read",
+ response = UpdateNotificationResponseStatus.class)
+ Response markAsRead(
+ @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
+ throws InvocationTargetException, IllegalAccessException;
+
+ @PUT
+ @Path("/last-seen/{notificationId}")
+ @ApiOperation(value = "Update Last Seen Notification",
+ response = UpdateNotificationResponseStatus.class)
+ Response updateLastSeenNotification(
+ @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
+ throws InvocationTargetException, IllegalAccessException;
+
+ @GET
+ @Path("/worker")
+ @ApiOperation(value = "Retrive user not delivered notifications",
+ response = NotificationsStatusDto.class,
+ responseContainer = "List")
+ Response getNewNotificationsByOwnerId(
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
+ @QueryParam(LAST_DELIVERED_QUERY_PARAM) String eventId,
+ @QueryParam(LIMIT_QUERY_PARAM) String limit);
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java
new file mode 100644
index 0000000000..8ff0ac0eea
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java
@@ -0,0 +1,117 @@
+package org.openecomp.sdcrests.notifications.rest.services.impl;
+
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.context.MdcUtil;
+import org.openecomp.sdc.logging.types.LoggerServiceName;
+import org.openecomp.sdc.notification.dao.types.NotificationEntity;
+import org.openecomp.sdc.notification.dtos.NotificationsStatus;
+import org.openecomp.sdc.notification.exceptons.NotificationNotExistException;
+import org.openecomp.sdc.notification.factories.NotificationsServiceFactory;
+import org.openecomp.sdc.notification.services.NotificationsService;
+import org.openecomp.sdcrests.notifications.rest.mapping.MapNotificationsStatusToDto;
+import org.openecomp.sdcrests.notifications.rest.mapping.MapNotificationsToDto;
+import org.openecomp.sdcrests.notifications.rest.services.Notifications;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+
+/**
+ * @author Avrahamg
+ * @since June 22, 2017
+ */
+@Named
+@Service("notifications")
+@Scope(value = "prototype")
+public class NotificationsImpl implements Notifications {
+
+ private static int selectionLimit = 10;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NotificationsImpl.class);
+ private NotificationsService notificationsService = NotificationsServiceFactory.getInstance().createInterface();
+
+ @Override
+ public Response getNotifications(String user, UUID lastDelivered, UUID endOfPage) {
+ MdcUtil.initMdc(LoggerServiceName.notifications.toString());
+ NotificationsStatus notificationsStatus = notificationsService
+ .getNotificationsStatus(user, lastDelivered, selectionLimit, endOfPage);
+ MapNotificationsStatusToDto converter = new MapNotificationsStatusToDto();
+ NotificationsStatusDto notificationsStatusDto = new NotificationsStatusDto();
+ converter.doMapping(notificationsStatus, notificationsStatusDto);
+
+ return Response.ok(notificationsStatusDto).build();
+ }
+
+ @Override
+ public Response updateLastSeenNotification(String notificationId, String user)
+ throws InvocationTargetException, IllegalAccessException {
+ UpdateNotificationResponseStatus
+ updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+ try {
+ notificationsService.updateLastSeenNotification(user, UUID.fromString(notificationId));
+ } catch (Exception ex) {
+ LOGGER.error(
+ String.format(Messages.FAILED_TO_UPDATE_LAST_SEEN_NOTIFICATION.getErrorMessage(),
+ user), ex);
+ updateNotificationResponseStatus.addStructureError(notificationId,
+ new ErrorMessage(ErrorLevel.ERROR,
+ Messages.FAILED_TO_UPDATE_LAST_SEEN_NOTIFICATION.getErrorMessage()));
+ }
+ return Response.ok(updateNotificationResponseStatus).build();
+ }
+
+ @Override
+ public Response markAsRead(String notificationId, String user)
+ throws InvocationTargetException, IllegalAccessException {
+
+ UpdateNotificationResponseStatus
+ updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+ try {
+ notificationsService.markAsRead(user, notificationId);
+ } catch (NotificationNotExistException ex) {
+ LOGGER.error(Messages.FAILED_TO_MARK_NOTIFICATION_AS_READ.getErrorMessage(), ex);
+ updateNotificationResponseStatus.addStructureError(
+ notificationId, new ErrorMessage(ErrorLevel.ERROR, Messages
+ .FAILED_TO_MARK_NOTIFICATION_AS_READ
+ .getErrorMessage()));
+ }
+ return Response.ok(updateNotificationResponseStatus).build();
+ }
+
+ @Override
+ public Response getNewNotificationsByOwnerId(String user, String eventId, String limitStr) {
+ MdcUtil.initMdc(LoggerServiceName.notifications.toString());
+
+ int limit = selectionLimit;
+
+ if (Objects.nonNull(limitStr)) {
+ try {
+ limit = Integer.parseInt(limitStr);
+ }
+ catch (NumberFormatException f) {
+ LOGGER.error("Non numeric selection list size value specified: " + limitStr);
+ }
+ }
+
+ List<NotificationEntity> notifications = Objects.isNull(eventId)
+ ? notificationsService.getNotificationsByOwnerId(user, limit)
+ : notificationsService.getNewNotificationsByOwnerId(user, UUID.fromString(eventId), limit);
+
+ MapNotificationsToDto converter = new MapNotificationsToDto();
+ NotificationsStatusDto notificationsStatusDto = new NotificationsStatusDto();
+ converter.doMapping(notifications, notificationsStatusDto);
+
+ return Response.ok(notificationsStatusDto).build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml
new file mode 100644
index 0000000000..4a3300ad12
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>notifications-rest-types</artifactId>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java
new file mode 100644
index 0000000000..d41deb3a4d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.types;
+
+import java.util.Map;
+import java.util.UUID;
+
+public class NotificationEntityDto {
+ private boolean read;
+ private UUID eventId;
+ private String dateTime;
+ private String eventType;
+ private Map<String, Object> eventAttributes;
+
+ public NotificationEntityDto() {
+ }
+ public NotificationEntityDto(boolean read, UUID eventId, String eventType,
+ Map<String, Object> eventAttributes) {
+ this.read = read;
+ this.eventId = eventId;
+ this.eventType = eventType;
+ this.eventAttributes = eventAttributes;
+ }
+
+ public NotificationEntityDto(boolean read, UUID eventId,String eventType,
+ Map<String, Object> eventAttributes, String dateTime) {
+ this.read = read;
+ this.eventId = eventId;
+ this.dateTime = dateTime;
+ this.eventType = eventType;
+ this.eventAttributes = eventAttributes;
+ }
+
+ public boolean isRead() {
+ return read;
+ }
+
+ public void setRead(boolean read) {
+ this.read = read;
+ }
+
+ public UUID getEventId() {
+ return eventId;
+ }
+
+ public void setEventId(UUID eventId) {
+ this.eventId = eventId;
+ }
+
+ public String getEventType() {
+ return eventType;
+ }
+
+ public void setEventType(String eventType) {
+ this.eventType = eventType;
+ }
+
+ public Map<String, Object> getEventAttributes() {
+ return eventAttributes;
+ }
+
+ public void setEventAttributes(Map<String, Object> eventAttributes) {
+ this.eventAttributes = eventAttributes;
+ }
+
+ public String getDateTime() {
+ return dateTime;
+ }
+
+ public void setDateTime(String dateTime) {
+ this.dateTime = dateTime;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java
new file mode 100644
index 0000000000..a0273d51e0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.types;
+
+public enum NotificationResponseStatus {
+ Success,
+ Failure
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java
new file mode 100644
index 0000000000..182245cc12
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java
@@ -0,0 +1,61 @@
+package org.openecomp.sdcrests.notifications.types;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * @author avrahamg
+ * @since June 29, 2017
+ */
+public class NotificationsStatusDto {
+ private List<NotificationEntityDto> notifications;
+ private List<UUID> newEntries = new ArrayList<>();
+ private UUID lastScanned;
+ private UUID endOfPage;
+ private long numOfNotSeenNotifications;
+
+ public NotificationsStatusDto() {
+ }
+
+ public List<NotificationEntityDto> getNotifications() {
+ return notifications;
+ }
+
+ public void setNotifications(
+ List<NotificationEntityDto> notifications) {
+ this.notifications = notifications;
+ }
+
+ public List<UUID> getNewEntries() {
+ return newEntries;
+ }
+
+ public void setNewEntries(List<UUID> newEntries) {
+ this.newEntries = newEntries;
+ }
+
+ public UUID getLastScanned() {
+ return lastScanned;
+ }
+
+ public void setLastScanned(UUID lastScanned) {
+ this.lastScanned = lastScanned;
+ }
+
+ public UUID getEndOfPage() {
+ return endOfPage;
+ }
+
+ public void setEndOfPage(UUID endOfPage) {
+ this.endOfPage = endOfPage;
+ }
+
+ public long getNumOfNotSeenNotifications() {
+ return numOfNotSeenNotifications;
+ }
+
+ public void setNumOfNotSeenNotifications(long numOfNotSeenNotifications) {
+ this.numOfNotSeenNotifications = numOfNotSeenNotifications;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java
new file mode 100644
index 0000000000..9e985726dc
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.types;
+
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.openecomp.sdcrests.notifications.types.NotificationResponseStatus.Failure;
+import static org.openecomp.sdcrests.notifications.types.NotificationResponseStatus.Success;
+
+/**
+ * Created by TALIO on 4/27/2016.
+ */
+public class UpdateNotificationResponseStatus {
+ private Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ private NotificationResponseStatus status = Success;
+
+ public Map<String, List<ErrorMessage>> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(Map<String, List<ErrorMessage>> errors) {
+ this.errors = errors;
+ }
+
+ public NotificationResponseStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(NotificationResponseStatus status) {
+ this.status = status;
+ }
+
+ public void addStructureError(String notificationId, ErrorMessage errorMessage) {
+ List<ErrorMessage> errorList =
+ errors.computeIfAbsent(notificationId, k -> new ArrayList<>());
+ errorList.add(errorMessage);
+ if (ErrorLevel.ERROR.equals(errorMessage.getLevel())) {
+ status = Failure;
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml
new file mode 100644
index 0000000000..d35c5afbee
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest</artifactId>
+
+ <packaging>pom</packaging>
+
+
+ <modules>
+ <module>notifications-rest-types</module>
+ <module>notifications-rest-services</module>
+ </modules>
+
+</project> \ No newline at end of file