aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java70
-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.java18
-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.java195
-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.java18
-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.java25
-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.java66
6 files changed, 189 insertions, 203 deletions
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
index a6acfdba9c..0762325882 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,28 +17,31 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdcrests.conflict.rest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
+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;
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.*;
-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)
@@ -46,35 +49,26 @@ import javax.ws.rs.core.Response;
@Validated
public interface Conflicts {
- @GET
- @Path("/")
- @Operation(description = "item version conflicts",
- summary = "Item version private copy conflicts against its public copy",
- responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ItemVersionConflictDto.class))))
- Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
- @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
- @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @GET
+ @Path("/")
+ @Operation(description = "item version conflicts", summary = "Item version private copy conflicts against its public copy", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ItemVersionConflictDto.class))))
+ Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
+ @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
- @GET
- @Path("/{conflictId}")
- @Operation(description = "Gets item version conflict",
- summary = "Gets an item version private copy conflict against its public copy",
- responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConflictDto.class))))
- Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
- @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
- @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
- @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @GET
+ @Path("/{conflictId}")
+ @Operation(description = "Gets item version conflict", summary = "Gets an item version private copy conflict against its public copy", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConflictDto.class))))
+ Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
+ @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
+ @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
- @PUT
- @Path("/{conflictId}")
- @Operation(description = "Resolves item version conflict",
- summary = "Resolves an item version private copy conflict against its public copy")
- Response resolveConflict(ConflictResolutionDto conflictResolution,
- @Parameter(description = "Item Id") @PathParam("itemId") String itemId,
- @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
- @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
- @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @PUT
+ @Path("/{conflictId}")
+ @Operation(description = "Resolves item version conflict", summary = "Resolves an item version private copy conflict against its public copy")
+ Response resolveConflict(ConflictResolutionDto conflictResolution, @Parameter(description = "Item Id") @PathParam("itemId") String itemId,
+ @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
+ @Parameter(description = "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
index 274a0cc674..7213fafa0b 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdcrests.conflict.rest.mapping;
import org.openecomp.conflicts.types.ConflictInfo;
@@ -25,10 +24,11 @@ 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());
- }
+
+ @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
index 1a1f3296fa..a1615bfccf 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,108 +17,119 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdcrests.conflict.rest.mapping;
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.Map;
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.*;
-import org.openecomp.sdcrests.vendorlicense.types.*;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.*;
-import org.openecomp.sdcrests.vsp.rest.mapping.*;
-
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.Map;
+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;
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()));
- }
+ @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 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);
+ 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());
}
- 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
index a2b70834c6..c439d5e7ba 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,19 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
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> {
+public class MapDtoToConflictResolution extends MappingBase<ConflictResolutionDto, ConflictResolution> {
- @Override
- public void doMapping(ConflictResolutionDto source, ConflictResolution target) {
- target.setResolution(source.getResolution());
- target.setOtherResolution(source.getOtherResolution());
- }
+ @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
index 51201a884b..a3ae77fc79 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,26 +17,21 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
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));
+public class MapItemVersionConflictToDto extends MappingBase<ItemVersionConflict, ItemVersionConflictDto> {
- MapConflictInfoToDto conflictInfoMapper = new MapConflictInfoToDto();
- source.getElementConflicts().forEach(conflictInfo -> target
- .addConflictInfo(conflictInfoMapper.applyMapping(conflictInfo, ConflictInfoDto.class)));
- }
+ @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
index 994c29afb1..61225b5d6f 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdcrests.conflict.rest.services;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
import org.openecomp.conflicts.types.Conflict;
import org.openecomp.conflicts.types.ConflictResolution;
import org.openecomp.conflicts.types.ItemVersionConflict;
@@ -36,47 +37,34 @@ 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();
+ @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();
+ }
- Version version = new Version(versionId);
- conflictsManager.resolveConflict(itemId, version, conflictId,
- new MapDtoToConflictResolution()
- .applyMapping(conflictResolution, ConflictResolution.class));
- conflictsManager.finalizeMerge(itemId, version);
+ @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();
+ }
- return Response.ok().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();
+ }
}