aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml58
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java61
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java134
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java62
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java33
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java29
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml35
13 files changed, 536 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml
new file mode 100644
index 0000000000..534aea1a73
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml
@@ -0,0 +1,58 @@
+<?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>conflict-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>conflict-rest-services</artifactId>
+
+
+
+ <dependencies>
+
+ <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.openecomp.sdc</groupId>
+ <artifactId>conflict-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>vendor-software-products-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>vendor-license-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java
new file mode 100644
index 0000000000..396c4ee5d2
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java
@@ -0,0 +1,61 @@
+package org.openecomp.sdcrests.conflict.rest;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.common.RestConstants;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+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.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/v1.0/items/{itemId}/versions/{versionId}/conflicts")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Item Version Conflicts")
+@Validated
+public interface Conflicts {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "item version conflicts",
+ notes = "Item version private copy conflicts against its public copy",
+ response = ItemVersionConflictDto.class)
+ Response getConflict(@ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{conflictId}")
+ @ApiOperation(value = "Gets item version conflict",
+ notes = "Gets an item version private copy conflict against its public copy",
+ response = ConflictDto.class)
+ Response getConflict(@ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @ApiParam("Version Id") @PathParam("conflictId") String conflictId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{conflictId}")
+ @ApiOperation(value = "Resolves item version conflict",
+ notes = "Resolves an item version private copy conflict against its public copy")
+ Response resolveConflict(ConflictResolutionDto conflictResolution,
+ @ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @ApiParam("Version Id") @PathParam("conflictId") String conflictId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java
new file mode 100644
index 0000000000..e80ef5653d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.openecomp.conflicts.types.ConflictInfo;
+import org.openecomp.sdcrests.conflict.types.ConflictInfoDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapConflictInfoToDto extends MappingBase<ConflictInfo, ConflictInfoDto> {
+ @Override
+ public void doMapping(ConflictInfo source, ConflictInfoDto target) {
+ target.setId(source.getId());
+ target.setType(source.getType());
+ target.setName(source.getName());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java
new file mode 100644
index 0000000000..83a0f52155
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java
@@ -0,0 +1,134 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.datatypes.model.ElementType;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.mapping.EchoMapMapping;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolEntityToEntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapFeatureGroupEntityToFeatureGroupDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseAgreementEntityToLicenseAgreementDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitEntityToLimitDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelEntityToDto;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyModelEntityToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentEntityToComponentDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComputeEntityToVspComputeDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapDeploymentFlavorEntityToDeploymentFlavorDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapFilesDataStructureToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapImageEntityToImageDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNetworkEntityToNetworkDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNicEntityToNicDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapProcessEntityToProcessEntityDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireToQuestionnaireDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDetailsToDto;
+
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MapConflictToDto extends MappingBase<Conflict, ConflictDto> {
+
+ @Override
+ public void doMapping(Conflict source, ConflictDto target) {
+ target.setId(source.getId());
+ target.setType(source.getType());
+ target.setName(source.getName());
+
+ Map.Entry<MappingBase, Class> mapperToTargetClass = getMapper(source.getType());
+ target.setTheirs(map(mapperToTargetClass, source.getTheirs()));
+ target.setYours(map(mapperToTargetClass, source.getYours()));
+ }
+
+ private Map map(Map.Entry<MappingBase, Class> mapperToTargetClass, Object object) {
+ return JsonUtil
+ .json2Object(JsonUtil.object2Json(
+ mapperToTargetClass.getKey().applyMapping(object, mapperToTargetClass.getValue())),
+ Map.class);
+ }
+
+ private Map.Entry<MappingBase, Class> getMapper(ElementType type) {
+ switch (type) {
+ case VendorLicenseModel:
+ return new AbstractMap.SimpleEntry<>(new MapVendorLicenseModelEntityToDto(),
+ VendorLicenseModelEntityDto.class);
+ case LicenseAgreement:
+ return new AbstractMap.SimpleEntry<>(
+ new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(),
+ LicenseAgreementDescriptorDto.class);
+ case FeatureGroup:
+ return new AbstractMap.SimpleEntry<>(new MapFeatureGroupEntityToFeatureGroupDescriptorDto(),
+ FeatureGroupDescriptorDto.class);
+ case LicenseKeyGroup:
+ return new AbstractMap.SimpleEntry<>(
+ new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(), LicenseKeyGroupEntityDto
+ .class);
+ case EntitlementPool:
+ return new AbstractMap.SimpleEntry<>(
+ new MapEntitlementPoolEntityToEntitlementPoolEntityDto(), EntitlementPoolEntityDto
+ .class);
+ case Limit:
+ return new AbstractMap.SimpleEntry<>(new MapLimitEntityToLimitDto(), LimitEntityDto.class);
+ case VendorSoftwareProduct:
+ return new AbstractMap.SimpleEntry<>(new MapVspDetailsToDto(), VspDetailsDto.class);
+ case Network:
+ return new AbstractMap.SimpleEntry<>(new MapNetworkEntityToNetworkDto(), NetworkDto.class);
+ case Component:
+ return new AbstractMap.SimpleEntry<>(new MapComponentEntityToComponentDto(),
+ ComponentDto.class);
+ case ComponentDependencies:
+ return new AbstractMap.SimpleEntry<>(new MapComponentDependencyModelEntityToDto(),
+ ComponentDependencyModel.class);
+ case Nic:
+ return new AbstractMap.SimpleEntry<>(new MapNicEntityToNicDto(), NicDto.class);
+ case Process:
+ return new AbstractMap.SimpleEntry<>(new MapProcessEntityToProcessEntityDto(),
+ ProcessEntityDto.class);
+ case DeploymentFlavor:
+ return new AbstractMap.SimpleEntry<>(new MapDeploymentFlavorEntityToDeploymentFlavorDto(),
+ DeploymentFlavorDto.class);
+ case Compute:
+ return new AbstractMap.SimpleEntry<>(new MapComputeEntityToVspComputeDto(),
+ VspComputeDto.class);
+ case Image:
+ return new AbstractMap.SimpleEntry<>(new MapImageEntityToImageDto(), ImageDto.class);
+ case VSPQuestionnaire:
+ case NicQuestionnaire:
+ case ComponentQuestionnaire:
+ case ImageQuestionnaire:
+ case ComputeQuestionnaire:
+ return new AbstractMap.SimpleEntry<>(new MapQuestionnaireToQuestionnaireDto(),
+ QuestionnaireDto.class);
+ case SNMP_POLL:
+ case SNMP_TRAP:
+ case VES_EVENTS:
+ case OrchestrationTemplateCandidate:
+ return new AbstractMap.SimpleEntry<>(new MapFilesDataStructureToDto(),
+ FileDataStructureDto.class);
+ case ServiceModel:
+ case NetworkPackage:
+ return new AbstractMap.SimpleEntry<>(new EchoMapMapping(), HashMap.class);
+ case itemVersion:
+ return new AbstractMap.SimpleEntry<>(new EchoMapMapping(), HashMap.class);
+ }
+ throw new RuntimeException("Get conflict does not support element type: " + type.name());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java
new file mode 100644
index 0000000000..1a03a6b15e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.openecomp.conflicts.types.ConflictResolution;
+import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapDtoToConflictResolution
+ extends MappingBase<ConflictResolutionDto, ConflictResolution> {
+
+ @Override
+ public void doMapping(ConflictResolutionDto source, ConflictResolution target) {
+ target.setResolution(source.getResolution());
+ target.setOtherResolution(source.getOtherResolution());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java
new file mode 100644
index 0000000000..fb5d013aba
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java
@@ -0,0 +1,22 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.conflict.types.ConflictInfoDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapItemVersionConflictToDto
+ extends MappingBase<ItemVersionConflict, ItemVersionConflictDto> {
+
+ @Override
+ public void doMapping(ItemVersionConflict source, ItemVersionConflictDto target) {
+ target
+ .setConflict(new MapConflictToDto().applyMapping(source.getVersionConflict(), ConflictDto.class));
+
+ MapConflictInfoToDto conflictInfoMapper = new MapConflictInfoToDto();
+ source.getElementConflicts().forEach(conflictInfo -> target
+ .addConflictInfo(conflictInfoMapper.applyMapping(conflictInfo, ConflictInfoDto.class)));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java
new file mode 100644
index 0000000000..fda12ef4c6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java
@@ -0,0 +1,62 @@
+package org.openecomp.sdcrests.conflict.rest.services;
+
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.conflicts.types.ConflictResolution;
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdc.conflicts.ConflictsManager;
+import org.openecomp.sdc.conflicts.ConflictsManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.conflict.rest.Conflicts;
+import org.openecomp.sdcrests.conflict.rest.mapping.MapConflictToDto;
+import org.openecomp.sdcrests.conflict.rest.mapping.MapDtoToConflictResolution;
+import org.openecomp.sdcrests.conflict.rest.mapping.MapItemVersionConflictToDto;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("conflicts")
+@Scope(value = "prototype")
+public class ConflictsImpl implements Conflicts {
+
+ @Override
+ public Response getConflict(String itemId, String versionId, String user) {
+
+ ConflictsManager conflictsManager = ConflictsManagerFactory.getInstance().createInterface();
+ ItemVersionConflict itemVersionConflict = conflictsManager.getConflict
+ (itemId, new Version(versionId));
+ ItemVersionConflictDto result = (new MapItemVersionConflictToDto()).applyMapping
+ (itemVersionConflict, ItemVersionConflictDto.class);
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response getConflict(String itemId, String versionId, String conflictId, String user) {
+ ConflictsManager conflictsManager = ConflictsManagerFactory.getInstance().createInterface();
+ Conflict conflict = conflictsManager.getConflict(itemId, new Version(versionId), conflictId);
+
+ ConflictDto result = new MapConflictToDto().applyMapping(conflict, ConflictDto.class);
+
+ return Response.ok(result).build();
+
+ }
+
+ @Override
+ public Response resolveConflict(ConflictResolutionDto conflictResolution, String itemId,
+ String versionId, String conflictId, String user) {
+ ConflictsManager conflictsManager = ConflictsManagerFactory.getInstance().createInterface();
+
+ Version version = new Version(versionId);
+ conflictsManager.resolveConflict(itemId, version, conflictId,
+ new MapDtoToConflictResolution()
+ .applyMapping(conflictResolution, ConflictResolution.class));
+ conflictsManager.finalizeMerge(itemId, version);
+
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml
new file mode 100644
index 0000000000..e0169332c8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/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>conflict-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>conflict-rest-types</artifactId>
+
+ <dependencies>
+ <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/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java
new file mode 100644
index 0000000000..47f0abd794
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java
@@ -0,0 +1,24 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import java.util.Map;
+
+public class ConflictDto extends ConflictInfoDto {
+ private Map<String, Object> yours;
+ private Map<String, Object> theirs;
+
+ public Map<String, Object> getYours() {
+ return yours;
+ }
+
+ public void setYours(Map<String, Object> yours) {
+ this.yours = yours;
+ }
+
+ public Map<String, Object> getTheirs() {
+ return theirs;
+ }
+
+ public void setTheirs(Map<String, Object> theirs) {
+ this.theirs = theirs;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java
new file mode 100644
index 0000000000..e2e842a74e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java
@@ -0,0 +1,33 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import org.openecomp.sdc.datatypes.model.ElementType;
+
+public class ConflictInfoDto {
+ private String id;
+ private ElementType type;
+ private String name;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ElementType getType() {
+ return type;
+ }
+
+ public void setType(ElementType type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java
new file mode 100644
index 0000000000..1aaf18f859
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import org.openecomp.conflicts.types.Resolution;
+
+import java.util.Map;
+
+public class ConflictResolutionDto {
+ private Resolution resolution;
+ // sits in lower level...
+ private Map<String, Object> otherResolution;
+
+ public Resolution getResolution() {
+ return resolution;
+ }
+
+ public void setResolution(Resolution resolution) {
+ this.resolution = resolution;
+ }
+
+ public Map<String, Object> getOtherResolution() {
+ return otherResolution;
+ }
+
+ public void setOtherResolution(Map<String, Object> otherResolution) {
+ this.otherResolution = otherResolution;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java
new file mode 100644
index 0000000000..3dbfcf03cf
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java
@@ -0,0 +1,29 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class ItemVersionConflictDto{
+ private ConflictDto conflict;
+ private Collection<ConflictInfoDto> conflictInfoList = new ArrayList<>();
+
+ public ConflictDto getConflict() {
+ return conflict;
+ }
+
+ public void setConflict(ConflictDto conflict) {
+ this.conflict = conflict;
+ }
+
+ public Collection<ConflictInfoDto> getConflictInfoList() {
+ return conflictInfoList;
+ }
+
+ public void setConflictInfoList(Collection<ConflictInfoDto> conflictInfoList) {
+ this.conflictInfoList = conflictInfoList;
+ }
+
+ public void addConflictInfo(ConflictInfoDto conflictInfo){
+ conflictInfoList.add(conflictInfo);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml
new file mode 100644
index 0000000000..d29b22a680
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml
@@ -0,0 +1,35 @@
+<?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-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>conflict-rest</artifactId>
+
+ <packaging>pom</packaging>
+
+
+ <modules>
+ <module>conflict-rest-services</module>
+ <module>conflict-rest-types</module>
+ </modules>
+
+</project> \ No newline at end of file