aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/item-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/item-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/item-rest')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml55
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java88
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java41
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java20
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java270
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml34
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java85
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java54
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java40
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java43
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java28
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java52
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java94
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml22
21 files changed, 1042 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
new file mode 100644
index 0000000000..6b96a4d328
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
@@ -0,0 +1,55 @@
+<?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>item-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>item-rest-services</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-item-permissions-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest-types</artifactId>
+ <version>${project.version}</version>
+ </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>openecomp-sdc-conflict-manager</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/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
new file mode 100644
index 0000000000..7d7b0854d9
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
@@ -0,0 +1,88 @@
+package org.openecomp.sdcrests.item.rest;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.item.types.ActivityLogDto;
+import org.openecomp.sdcrests.item.types.RevisionDto;
+import org.openecomp.sdcrests.item.types.VersionActionRequestDto;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.item.types.VersionRequestDto;
+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.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+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/items/{itemId}/versions")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Item Versions")
+@Validated
+public interface Versions {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "Lists item versions",
+ response = VersionDto.class,
+ responseContainer = "List")
+ Response list(@PathParam("itemId") String itemId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/{versionId}")
+ @ApiOperation(value = "Creates a new item version")
+ Response create(VersionRequestDto request,
+ @PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{versionId}")
+ @ApiOperation(value = "Gets item version", response = VersionDto.class)
+ Response get(@PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{versionId}/activity-logs")
+ @ApiOperation(value = "Gets item version activity log",
+ response = ActivityLogDto.class,
+ responseContainer = "List")
+ Response getActivityLog(@ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{versionId}/revisions")
+ @ApiOperation(value = "Gets item version revisions", response = RevisionDto.class,
+ responseContainer = "List")
+ Response listRevisions(@PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{versionId}/actions")
+ @ApiOperation(value = "Acts on item version")
+ Response actOn(VersionActionRequestDto request,
+ @PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java
new file mode 100644
index 0000000000..307b555720
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.item.rest.mapping;
+
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdcrests.item.types.ActivityLogDto;
+import org.openecomp.sdcrests.item.types.ActivityStatus;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapActivityLogEntityToDto
+ extends MappingBase<ActivityLogEntity, ActivityLogDto> {
+
+
+ @Override
+ public void doMapping(ActivityLogEntity source, ActivityLogDto target) {
+ target.setId(source.getId());
+ target.setTimestamp(source.getTimestamp());
+ target.setType(source.getType().name());
+ target.setComment(source.getComment());
+ target.setUser(source.getUser());
+ target.setStatus(new ActivityStatus(source.isSuccess(), source.getMessage()));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java
new file mode 100644
index 0000000000..26bd58d950
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdcrests.item.rest.mapping;
+
+import org.openecomp.sdc.versioning.types.Item;
+import org.openecomp.sdcrests.item.types.ItemDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapItemToDto extends MappingBase<Item, ItemDto> {
+ @Override
+ public void doMapping(Item source, ItemDto target) {
+ target.setId(source.getId());
+ target.setType(source.getType());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java
new file mode 100644
index 0000000000..861f571c5f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdcrests.item.rest.mapping;
+
+import org.openecomp.sdc.versioning.dao.types.Revision;
+import org.openecomp.sdcrests.item.types.RevisionDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapRevisionToDto extends MappingBase<Revision, RevisionDto> {
+ @Override
+ public void doMapping(Revision source, RevisionDto target) {
+ target.setId(source.getId());
+ target.setMessage(source.getMessage());
+ target.setUser(source.getUser());
+ target.setTime(source.getTime());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java
new file mode 100644
index 0000000000..5fbd9a9e8d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdcrests.item.rest.mapping;
+
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapVersionToDto extends MappingBase<Version, VersionDto> {
+ @Override
+ public void doMapping(Version source, VersionDto target) {
+ target.setId(source.getId());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setBaseId(source.getBaseId());
+ target.setStatus(source.getStatus());
+ target.setState(source.getState());
+ target.setCreationTime(source.getCreationTime());
+ target.setModificationTime(source.getModificationTime());
+ target.setAdditionalInfo(source.getAdditionalInfo());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
new file mode 100644
index 0000000000..466734208d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
@@ -0,0 +1,270 @@
+/*-
+ * ============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.item.rest.services;
+
+import org.openecomp.sdc.activitylog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.conflicts.ConflictsManager;
+import org.openecomp.sdc.conflicts.ConflictsManagerFactory;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManager;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory;
+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.dtos.Event;
+import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory;
+import org.openecomp.sdc.notification.services.NotificationPropagationManager;
+import org.openecomp.sdc.versioning.ItemManager;
+import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.RevisionIdNotFoundErrorBuilder;
+import org.openecomp.sdc.versioning.types.NotificationEventTypes;
+import org.openecomp.sdcrests.item.rest.Versions;
+import org.openecomp.sdcrests.item.rest.mapping.MapActivityLogEntityToDto;
+import org.openecomp.sdcrests.item.rest.mapping.MapRevisionToDto;
+import org.openecomp.sdcrests.item.rest.mapping.MapVersionToDto;
+import org.openecomp.sdcrests.item.types.ActivityLogDto;
+import org.openecomp.sdcrests.item.types.CommitRequestDto;
+import org.openecomp.sdcrests.item.types.RevisionDto;
+import org.openecomp.sdcrests.item.types.RevisionRequestDto;
+import org.openecomp.sdcrests.item.types.VersionActionRequestDto;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.item.types.VersionRequestDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME;
+
+@Named
+@Service("versions")
+@Scope(value = "prototype")
+public class VersionsImpl implements Versions {
+
+ private static final String COMMIT_ITEM_ACTION = "Commit_Item";
+ private static final Logger LOGGER = LoggerFactory.getLogger(VersionsImpl.class);
+
+ private ItemPermissionsManager permissionsManager =
+ ItemPermissionsManagerFactory.getInstance().createInterface();
+ private ItemManager itemManager =
+ ItemManagerFactory.getInstance().createInterface();
+ private VersioningManager versioningManager =
+ VersioningManagerFactory.getInstance().createInterface();
+ private ConflictsManager conflictsManager =
+ ConflictsManagerFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+ private NotificationPropagationManager notifier =
+ NotificationPropagationManagerFactory.getInstance().createInterface();
+
+ @Override
+ public Response list(String itemId, String user) {
+ GenericCollectionWrapper<VersionDto> results = new GenericCollectionWrapper<>();
+ MapVersionToDto mapper = new MapVersionToDto();
+
+ versioningManager.list(itemId)
+ .forEach(version -> results.add(mapper.applyMapping(version, VersionDto.class)));
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response create(VersionRequestDto request, String itemId, String baseVersionId,
+ String user) {
+ Version version = new Version();
+ version.setBaseId(baseVersionId);
+ version.setDescription(request.getDescription());
+
+ version = versioningManager.create(itemId, version, request.getCreationMethod());
+
+ VersionDto versionDto = new MapVersionToDto().applyMapping(version, VersionDto.class);
+
+ activityLogManager.logActivity(new ActivityLogEntity(itemId, version,
+ ActivityType.Create_Version, user, true, "", ""));
+
+ return Response.ok(versionDto).build();
+ }
+
+ @Override
+ public Response get(String itemId, String versionId, String user) {
+ Version version = getVersion(itemId, new Version(versionId));
+ VersionDto versionDto = new MapVersionToDto().applyMapping(version, VersionDto.class);
+ return Response.ok(versionDto).build();
+ }
+
+ @Override
+ public Response getActivityLog(String itemId, String versionId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Get_List_Activity_Log.toString());
+
+ GenericCollectionWrapper<ActivityLogDto> results = new GenericCollectionWrapper<>();
+ MapActivityLogEntityToDto mapper = new MapActivityLogEntityToDto();
+
+ activityLogManager.listLoggedActivities(itemId, new Version(versionId))
+ .forEach(loggedActivity -> results
+ .add(mapper.applyMapping(loggedActivity, ActivityLogDto.class)));
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response listRevisions(String itemId, String versionId, String user) {
+ GenericCollectionWrapper<RevisionDto> results = new GenericCollectionWrapper<>();
+ MapRevisionToDto mapper = new MapRevisionToDto();
+
+ versioningManager.listRevisions(itemId, new Version(versionId))
+ .forEach(revision -> results.add(mapper.applyMapping(revision, RevisionDto.class)));
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response actOn(VersionActionRequestDto request, String itemId, String versionId,
+ String user) {
+ Version version = new Version(versionId);
+ switch (request.getAction()) {
+ case Sync:
+ sync(itemId, version);
+ break;
+ case Commit:
+ if (!permissionsManager.isAllowed(itemId, user, COMMIT_ITEM_ACTION)) {
+ return Response.status(Response.Status.FORBIDDEN)
+ .entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build();
+ }
+ commit(request.getCommitRequest(), itemId, version, user);
+ break;
+ case Revert:
+ revert(request.getRevisionRequest(), itemId, versionId);
+ break;
+ case Reset:
+ throw new UnsupportedOperationException("Action reset not supported.");
+ default:
+ }
+ return Response.ok().build();
+ }
+
+
+ private void revert(RevisionRequestDto request, String itemId, String versionId) {
+ if (request.getRevisionId() == null) {
+ throw new CoreException(new RevisionIdNotFoundErrorBuilder().build());
+ }
+
+ versioningManager.revert(itemId, new Version(versionId), request.getRevisionId());
+ }
+
+ private void sync(String itemId, Version version) {
+ versioningManager.sync(itemId, version);
+ conflictsManager.finalizeMerge(itemId, version);
+ }
+
+ private void commit(CommitRequestDto request, String itemId, Version version, String user) {
+
+ String message = request == null ? "" : request.getMessage();
+
+ versioningManager.publish(itemId, version, message);
+ notifyUsers(itemId, version, message, user, NotificationEventTypes.COMMIT);
+
+ activityLogManager.logActivity(new ActivityLogEntity(itemId, version,
+ ActivityType.Commit, user, true, "", message));
+ }
+
+ private void notifyUsers(String itemId, Version version, String message,
+ String userName, NotificationEventTypes eventType) {
+ Map<String, Object> eventProperties = new HashMap<>();
+ eventProperties.put(ITEM_NAME, itemManager.get(itemId).getName());
+ eventProperties.put(ITEM_ID, itemId);
+
+ Version ver = versioningManager.get(itemId, version);
+ eventProperties.put(VERSION_NAME, ver.getName());
+ eventProperties.put(VERSION_ID, ver.getId());
+
+ eventProperties.put(SUBMIT_DESCRIPTION, message);
+ eventProperties.put(PERMISSION_USER, userName);
+
+ Event syncEvent = new SyncEvent(eventType.getEventName(), itemId, eventProperties, itemId);
+ try {
+ notifier.notifySubscribers(syncEvent, userName);
+ } catch (Exception e) {
+ LOGGER.error("Failed to send sync notification to users subscribed o item '" + itemId);
+ }
+ }
+
+ private class SyncEvent implements Event {
+
+ private String eventType;
+ private String originatorId;
+ private Map<String, Object> attributes;
+ private String entityId;
+
+ public SyncEvent(String eventType, String originatorId,
+ Map<String, Object> attributes, String entityId) {
+ this.eventType = eventType;
+ this.originatorId = originatorId;
+ this.attributes = attributes;
+ this.entityId = entityId;
+ }
+
+ @Override
+ public String getEventType() {
+ return eventType;
+ }
+
+ @Override
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ @Override
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ @Override
+ public String getEntityId() {
+ return entityId;
+ }
+ }
+
+ private Version getVersion(String itemId, Version version) {
+ version = versioningManager.get(itemId, version);
+
+ if (version.getState().getSynchronizationState() != SynchronizationState.Merging &&
+ conflictsManager.isConflicted(itemId, version)) { // looks for sdc applicative conflicts
+ version.getState().setSynchronizationState(SynchronizationState.Merging);
+ }
+ return version;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml
new file mode 100644
index 0000000000..6b974809b2
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml
@@ -0,0 +1,34 @@
+<?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>item-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>item-rest-types</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-activity-log-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
new file mode 100644
index 0000000000..40fb91867e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
@@ -0,0 +1,85 @@
+/*-
+ * ============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.item.types;
+
+
+import java.util.Date;
+
+public class ActivityLogDto {
+
+ private String id;
+ private Date timestamp;
+ private String type;
+ private String comment;
+ private String user;
+ private ActivityStatus status;
+
+ public ActivityLogDto() {
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public ActivityStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(ActivityStatus status) {
+ this.status = status;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java
new file mode 100644
index 0000000000..601a211e5b
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.item.types;
+
+public class ActivityStatus {
+
+ private boolean success;
+ private String message;
+
+ public ActivityStatus() {
+ }
+
+ public ActivityStatus(boolean success) {
+ this(success, null);
+ }
+
+ public ActivityStatus(boolean success, String message) {
+ this.success = success;
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
new file mode 100644
index 0000000000..a1d46cbdf1
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdcrests.item.types;
+
+public class CommitRequestDto {
+ private String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
new file mode 100644
index 0000000000..afba96f6c8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
@@ -0,0 +1,22 @@
+package org.openecomp.sdcrests.item.types;
+
+public class ItemCreationDto {
+ private String itemId;
+ private VersionDto version;
+
+ public String getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(String itemId) {
+ this.itemId = itemId;
+ }
+
+ public VersionDto getVersion() {
+ return version;
+ }
+
+ public void setVersion(VersionDto version) {
+ this.version = version;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
new file mode 100644
index 0000000000..1eebf19750
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
@@ -0,0 +1,40 @@
+package org.openecomp.sdcrests.item.types;
+
+public class ItemDto {
+ private String id;
+ private String type;
+ private String name;
+ private String description;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
new file mode 100644
index 0000000000..241d28541e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
@@ -0,0 +1,43 @@
+package org.openecomp.sdcrests.item.types;
+
+import java.util.Date;
+
+public class RevisionDto {
+ private String id;
+ private String message;
+ private Date time;
+ private String user;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java
new file mode 100644
index 0000000000..49ea9fc7f2
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdcrests.item.types;
+
+public class RevisionRequestDto {
+
+ private String revisionId;
+
+ public String getRevisionId() {
+ return revisionId;
+ }
+
+ public void setRevisionId(String revisionId) {
+ this.revisionId = revisionId;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
new file mode 100644
index 0000000000..2591560fbb
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdcrests.item.types;
+
+public class SubmitRequestDto {
+ private String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java
new file mode 100644
index 0000000000..c9d6f4e293
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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.item.types;
+
+public enum VersionAction {
+ Sync,
+ Commit,
+ Revert,
+ Reset
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java
new file mode 100644
index 0000000000..98a5bb94ee
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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.item.types;
+
+public class VersionActionRequestDto {
+ private VersionAction action;
+ private CommitRequestDto commitRequest;
+
+ private RevisionRequestDto revisionRequest;
+
+ public VersionAction getAction() {
+ return action;
+ }
+
+ public void setAction(VersionAction action) {
+ this.action = action;
+ }
+
+ public CommitRequestDto getCommitRequest() {
+ return commitRequest;
+ }
+
+ public void setCommitRequest(CommitRequestDto commitRequest) {
+ this.commitRequest = commitRequest;
+ }
+
+ public RevisionRequestDto getRevisionRequest() {
+ return revisionRequest;
+ }
+
+ public void setRevisionRequest(RevisionRequestDto revisionRequest) {
+ this.revisionRequest = revisionRequest;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
new file mode 100644
index 0000000000..a0c1942b03
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
@@ -0,0 +1,94 @@
+package org.openecomp.sdcrests.item.types;
+
+import org.openecomp.sdc.versioning.dao.types.VersionState;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.util.Date;
+import java.util.Map;
+
+public class VersionDto {
+ private String id;
+ private String name;
+ private String description;
+ private String baseId;
+ private VersionStatus status;
+ private VersionState state;
+ private Date creationTime;
+ private Date modificationTime;
+ private Map<String,Object> additionalInfo;
+ public VersionDto() {
+
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getBaseId() {
+ return baseId;
+ }
+
+ public void setBaseId(String baseId) {
+ this.baseId = baseId;
+ }
+
+ public VersionStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(VersionStatus status) {
+ this.status = status;
+ }
+
+ public VersionState getState() {
+ return state;
+ }
+
+ public void setState(VersionState state) {
+ this.state = state;
+ }
+
+ public Date getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Date creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Date getModificationTime() {
+ return modificationTime;
+ }
+
+ public void setModificationTime(Date modificationTime) {
+ this.modificationTime = modificationTime;
+ }
+
+ public Map<String, Object> getAdditionalInfo() {
+ return additionalInfo;
+ }
+
+ public void setAdditionalInfo(Map<String, Object> additionalInfo) {
+ this.additionalInfo = additionalInfo;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
new file mode 100644
index 0000000000..629bc2d2db
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
@@ -0,0 +1,24 @@
+package org.openecomp.sdcrests.item.types;
+
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+
+public class VersionRequestDto {
+ private String description;
+ private VersionCreationMethod creationMethod;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public VersionCreationMethod getCreationMethod() {
+ return creationMethod;
+ }
+
+ public void setCreationMethod(VersionCreationMethod creationMethod) {
+ this.creationMethod = creationMethod;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml
new file mode 100644
index 0000000000..6623de8cce
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml
@@ -0,0 +1,22 @@
+<?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>
+
+ <artifactId>item-rest</artifactId>
+ <packaging>pom</packaging>
+
+
+ <modules>
+ <module>item-rest-services</module>
+ <module>item-rest-types</module>
+ </modules>
+
+</project> \ No newline at end of file