aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--onboarding/pom.xml2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java32
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java55
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java11
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java86
-rw-r--r--openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java9
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java2
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java4
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java9
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java3
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java186
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/types/PermissionActionTypes.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java5
-rw-r--r--openecomp-be/tools/zusammen-tools/pom.xml2
27 files changed, 277 insertions, 177 deletions
diff --git a/onboarding/pom.xml b/onboarding/pom.xml
index 5ed5e4ba33..04624adb87 100644
--- a/onboarding/pom.xml
+++ b/onboarding/pom.xml
@@ -101,7 +101,7 @@
<ws.rs.version>2.0.1</ws.rs.version> <!-- New version 2.0.1 to fix blackduck violation Failing with comiplation issues-->
<zusammen.version>0.3.0</zusammen.version>
<zusammen-state-store.version>0.3.0</zusammen-state-store.version>
- <zusammen-collaboration-store.version>0.3.0</zusammen-collaboration-store.version>
+ <zusammen-collaboration-store.version>0.3.1</zusammen-collaboration-store.version>
<zusammen-index-store.version>0.3.0</zusammen-index-store.version>
<pmd.version>5.8.1</pmd.version>
<build.tools.version>${project.version}</build.tools.version>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
index 9b1c09603c..dc17b49454 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
@@ -1,23 +1,20 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 European Support Limited
+ *
* 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.vendorlicense.rest;
import io.swagger.annotations.Api;
@@ -74,6 +71,14 @@ public interface VendorLicenseModels {
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @DELETE
+ @Path("/{vlmId}")
+ @ApiOperation(value = "Delete vendor license model")
+ Response deleteLicenseModel(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
+ String user);
+
@PUT
@Path("/{vlmId}/versions/{versionId}")
@ApiOperation(value = "Update vendor license model")
@@ -96,15 +101,6 @@ public interface VendorLicenseModels {
@NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
String user);
- @DELETE
- @Path("/{vlmId}/versions/{versionId}")
- @ApiOperation(value = "Delete vendor license model")
- Response deleteLicenseModel(
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam
- ("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
- String user);
@PUT
@Path("/{vlmId}/versions/{versionId}/actions")
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
index 68b387e5bc..fd89989987 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
@@ -1,23 +1,20 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 European Support Limited
+ *
* 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.vendorlicense.rest.services;
import org.openecomp.core.util.UniqueValueUtil;
@@ -68,6 +65,7 @@ import javax.inject.Named;
import javax.ws.rs.core.Response;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
@@ -201,9 +199,23 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
}
@Override
- public Response deleteLicenseModel(String vlmId, String versionId, String user) {
- vendorLicenseManager.deleteVendorLicenseModel(vlmId, new Version(versionId));
- return Response.ok().build();
+ public Response deleteLicenseModel(String vlmId, String user) {
+ Item vlm = itemManager.get(vlmId);
+
+ Integer certifiedVersionsCounter = vlm.getVersionStatusCounters().get(VersionStatus.Certified);
+ if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) {
+ itemManager.delete(vlm);
+ permissionsManager.deleteItemPermissions(vlmId);
+ UniqueValueUtil
+ .deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, vlm.getName());
+ notifyUsers(vlmId, vlm.getName(), null, "VLM was deleted", user,
+ NotificationEventTypes.DELETE);
+
+ return Response.ok().build();
+ } else {
+ return Response.status(Response.Status.PRECONDITION_FAILED)
+ .entity(new Exception(Messages.DELETE_VLM_ERROR.getErrorMessage())).build();
+ }
}
@Override
@@ -220,7 +232,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
request.getSubmitRequest() == null ? "Submit" : request.getSubmitRequest().getMessage();
submit(vlmId, version, message, user);
- notifyUsers(vlmId, version, message, user, NotificationEventTypes.SUBMIT);
+ notifyUsers(vlmId, null, version, message, user, NotificationEventTypes.SUBMIT);
}
return Response.ok().build();
@@ -246,15 +258,18 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
}
}
- private void notifyUsers(String itemId, Version version, String message,
+ private void notifyUsers(String itemId, String itemName, 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_NAME, itemName == null ? itemManager.get(itemId).getName() : itemName);
eventProperties.put(ITEM_ID, itemId);
- Version ver = versioningManager.get(itemId, version);
- eventProperties.put(VERSION_NAME, ver.getName());
- eventProperties.put(VERSION_ID, ver.getId());
+ if (version != null) {
+ eventProperties.put(VERSION_NAME, version.getName() == null
+ ? versioningManager.get(itemId, version).getName()
+ : version.getName());
+ eventProperties.put(VERSION_ID, version.getId());
+ }
eventProperties.put(SUBMIT_DESCRIPTION, message);
eventProperties.put(PERMISSION_USER, userName);
@@ -274,8 +289,8 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
private Map<String, Object> attributes;
private String entityId;
- public SyncEvent(String eventType, String originatorId,
- Map<String, Object> attributes, String entityId) {
+ SyncEvent(String eventType, String originatorId,
+ Map<String, Object> attributes, String entityId) {
this.eventType = eventType;
this.originatorId = originatorId;
this.attributes = attributes;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
index d848d41f7c..60c68ef302 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
@@ -1,9 +1,6 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 European Support Limited
+ *
* 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
@@ -15,9 +12,9 @@
* 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.vsp.rest;
import io.swagger.annotations.Api;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index fa6c778995..7d1c5e1289 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package org.openecomp.sdcrests.vsp.rest.services;
import org.apache.commons.collections4.MapUtils;
@@ -96,6 +97,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
@@ -143,15 +145,16 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
try {
onboardingMethod = OnboardingMethod.valueOf(vspRequestDto.getOnboardingMethod());
} catch (IllegalArgumentException e) {
- throwUnknownOnboardingMethodException();
+ LOGGER.error("Error while creating VSP. Message: " + e.getMessage());
+ throwUnknownOnboardingMethodException(e);
}
- ItemCreationDto itemCreationDto = null;
+ ItemCreationDto itemCreationDto = null;
if (onboardingMethod == OnboardingMethod.NetworkPackage
- || onboardingMethod == OnboardingMethod.Manual) {
+ || onboardingMethod == OnboardingMethod.Manual) {
itemCreationDto = getItemCreationDto(vspRequestDto, user, onboardingMethod);
} else {
- throwUnknownOnboardingMethodException();
+ throwUnknownOnboardingMethodException(new IllegalArgumentException("Wrong parameter Onboarding Method"));
}
return Response.ok(itemCreationDto).build();
@@ -173,7 +176,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
Version version = versioningManager.create(item.getId(), new Version(), null);
VspDetails vspDetails =
- new MapVspDescriptionDtoToVspDetails().applyMapping(vspRequestDto, VspDetails.class);
+ new MapVspDescriptionDtoToVspDetails().applyMapping(vspRequestDto, VspDetails.class);
vspDetails.setId(item.getId());
vspDetails.setVersion(version);
vspDetails.setOnboardingMethod(vspRequestDto.getOnboardingMethod());
@@ -185,14 +188,14 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
itemCreationDto.setVersion(new MapVersionToDto().applyMapping(version, VersionDto.class));
activityLogManager.logActivity(new ActivityLogEntity(vspDetails.getId(), version,
- ActivityType.Create, user, true, "", ""));
+ ActivityType.Create, user, true, "", ""));
return itemCreationDto;
}
- private void throwUnknownOnboardingMethodException() {
+ private void throwUnknownOnboardingMethodException(IllegalArgumentException e) {
ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
.getInvalidOnboardingMethodErrorBuilder();
- throw new CoreException(onboardingMethodUpdateErrorCode);
+ throw new CoreException(onboardingMethodUpdateErrorCode,e);
}
@Override
@@ -200,12 +203,12 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
Predicate<Item> itemPredicate;
if (VersionStatus.Certified.name().equals(versionStatus)) {
itemPredicate = item -> ItemType.vsp.name().equals(item.getType())
- && item.getVersionStatusCounters().containsKey(VersionStatus.Certified);
+ && item.getVersionStatusCounters().containsKey(VersionStatus.Certified);
} else if (VersionStatus.Draft.name().equals(versionStatus)) {
itemPredicate = item -> ItemType.vsp.name().equals(item.getType())
- && item.getVersionStatusCounters().containsKey(VersionStatus.Draft)
- && userHasPermission(item.getId(), user);
+ && item.getVersionStatusCounters().containsKey(VersionStatus.Draft)
+ && userHasPermission(item.getId(), user);
} else {
itemPredicate = item -> ItemType.vsp.name().equals(item.getType());
@@ -282,9 +285,21 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
@Override
public Response deleteVsp(String vspId, String user) {
- vendorSoftwareProductManager.deleteVsp(vspId);
+ Item vsp = itemManager.get(vspId);
- return Response.ok().build();
+ Integer certifiedVersionsCounter = vsp.getVersionStatusCounters().get(VersionStatus.Certified);
+ if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) {
+ itemManager.delete(vsp);
+ permissionsManager.deleteItemPermissions(vspId);
+ UniqueValueUtil.deleteUniqueValue(VENDOR_SOFTWARE_PRODUCT_NAME, vsp.getName());
+ notifyUsers(vspId, vsp.getName(), null, "VSP was deleted", user,
+ NotificationEventTypes.DELETE);
+
+ return Response.ok().build();
+ } else {
+ return Response.status(Response.Status.PRECONDITION_FAILED)
+ .entity(new Exception(Messages.DELETE_VSP_ERROR.getErrorMessage())).build();
+ }
}
@Override
@@ -296,20 +311,20 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
if (request.getAction() == VendorSoftwareProductAction.Submit) {
if (!permissionsManager.isAllowed(vspId, user, SUBMIT_ITEM_ACTION)) {
return Response.status(Response.Status.FORBIDDEN)
- .entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build();
+ .entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build();
}
String message = request.getSubmitRequest() == null ? "Submit"
- : request.getSubmitRequest().getMessage();
+ : request.getSubmitRequest().getMessage();
Optional<ValidationResponse> validationResponse = submit(vspId, version, message, user);
if (validationResponse.isPresent()) {
ValidationResponseDto validationResponseDto = new MapValidationResponseToDto()
- .applyMapping(validationResponse.get(), ValidationResponseDto.class);
+ .applyMapping(validationResponse.get(), ValidationResponseDto.class);
return Response.status(Response.Status.EXPECTATION_FAILED).entity(validationResponseDto)
- .build();
+ .build();
}
- notifyUsers(vspId, version, message, user, NotificationEventTypes.SUBMIT);
+ notifyUsers(vspId, null, version, message, user, NotificationEventTypes.SUBMIT);
} else if (request.getAction() == VendorSoftwareProductAction.Create_Package) {
return createPackage(vspId, version);
@@ -337,8 +352,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
String validationVspId = itemManager.list(item ->
ItemType.vsp.name().equals(item.getType()) && VALIDATION_VSP_NAME.equals(item.getName()))
.stream().findFirst().orElseThrow(() -> new IllegalStateException("Vsp with name %s "
- + "does not exist even though the name exists according to unique value util"))
- .getId();
+ + "does not exist even though the name exists according to unique value util"))
+ .getId();
Version validationVspVersion = versioningManager.list(validationVspId).iterator().next();
validationVsp = new ItemCreationDto();
@@ -383,12 +398,14 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
public Response getTranslatedFile(String vspId, String versionName, String user) {
List<Version> versions = versioningManager.list(vspId);
Version version;
- if (versionName == null) version = versions.stream().filter(ver -> VersionStatus.Certified == ver.getStatus())
- .max(Comparator.comparingDouble(o -> Double.parseDouble(o.getName())))
- .orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build()));
- else {
+ if (versionName == null) {
+ version = versions.stream().filter(ver -> VersionStatus.Certified == ver.getStatus())
+ .max(Comparator.comparingDouble(o -> Double.parseDouble(o.getName())))
+ .orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build()));
+ } else {
version = versions.stream().filter(ver -> versionName.equals(ver.getName()))
- .findFirst().orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build()));
+ .findFirst()
+ .orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build()));
if (version.getStatus() != VersionStatus.Certified) {
throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
@@ -498,15 +515,18 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
return Optional.empty();
}
- private void notifyUsers(String itemId, Version version, String message,
+ private void notifyUsers(String itemId, String itemName, 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_NAME, itemName == null ? itemManager.get(itemId).getName() : itemName);
eventProperties.put(ITEM_ID, itemId);
- Version ver = versioningManager.get(itemId, version);
- eventProperties.put(VERSION_NAME, ver.getName());
- eventProperties.put(VERSION_ID, ver.getId());
+ if (version != null) {
+ eventProperties.put(VERSION_NAME, version.getName() == null
+ ? versioningManager.get(itemId, version).getName()
+ : version.getName());
+ eventProperties.put(VERSION_ID, version.getId());
+ }
eventProperties.put(SUBMIT_DESCRIPTION, message);
eventProperties.put(PERMISSION_USER, userName);
@@ -526,8 +546,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
private final Map<String, Object> attributes;
private final String entityId;
- SyncEvent(String eventType, String originatorId,
- Map<String, Object> attributes, String entityId) {
+ SyncEvent(String eventType, String originatorId,
+ Map<String, Object> attributes, String entityId) {
this.eventType = eventType;
this.originatorId = originatorId;
this.attributes = attributes;
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java
index 74fc3d3c46..1ca37325ca 100644
--- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java
+++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java
@@ -19,5 +19,7 @@ public interface ItemPermissionsManager {
String getUserItemPermiission(String itemId, String userId);
+ void deleteItemPermissions(String itemId);
+
}
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java
index 726695b0c8..838530a1cd 100644
--- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java
@@ -134,6 +134,11 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager {
return permissionsServices.getUserItemPermiission(itemId, userId);
}
+ @Override
+ public void deleteItemPermissions(String itemId) {
+ permissionsServices.deleteItemPermissions(itemId);
+ }
+
private class PermissionEvent implements Event {
private String eventType;
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
index f994652751..994843839b 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
@@ -42,6 +42,9 @@ public enum Messages {
PERMISSIONS_ERROR("Permissions Error. The user does not have permission to perform this action."),
PERMISSIONS_OWNER_ERROR("Permissions Error. Only one owner is allowed."),
+ DELETE_VSP_ERROR("VSP is in use and cannot be deleted."),
+ DELETE_VLM_ERROR("VLM is in use and cannot be deleted."),
+
ZIP_SHOULD_NOT_CONTAIN_FOLDERS("Zip file should not contain folders"),
VES_ZIP_SHOULD_CONTAIN_YML_ONLY(
"Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML files" +
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
index 694c35ebbe..23eddadbf7 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
@@ -27,6 +27,8 @@ public interface ZusammenAdaptor {
Item getItem(SessionContext context, Id itemId);
+ void deleteItem(SessionContext context, Id itemId);
+
Id createItem(SessionContext context, Info info);
void updateItem(SessionContext context, Id itemId, Info info);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
index d90c9a39a0..2c9fb4a574 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
@@ -37,7 +37,7 @@
<dependency>
<groupId>com.amdocs.zusammen.plugin</groupId>
<artifactId>zusammen-collaboration-cassandra-plugin</artifactId>
- <version>${zusammen.version}</version>
+ <version>${zusammen-collaboration-store.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
index 9005bb84c3..1589c1a25b 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
@@ -32,6 +32,8 @@ public interface ZusammenConnector {
Id createItem(SessionContext context, Info info);
+ void deleteItem(SessionContext context, Id itemId);
+
void updateItem(SessionContext context, Id itemId, Info info);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
index 7525a6479a..83bbc5b49a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
@@ -109,6 +109,15 @@ public class ZusammenConnectorImpl implements ZusammenConnector {
}
@Override
+ public void deleteItem(SessionContext context, Id itemId){
+ Response<Void> response = itemAdaptorFactory.createInterface(context).delete(context, itemId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(
+ "Failed to delete Item. message:" + response.getReturnCode().toString());
+ }
+ }
+
+ @Override
public void updateItem(SessionContext context, Id itemId, Info info) {
Response<Void> response =
itemAdaptorFactory.createInterface(context).update(context, itemId, info);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
index cd49ca3069..968ff28963 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
@@ -191,6 +191,11 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor {
}
@Override
+ public void deleteItem(SessionContext context, Id itemId){
+ connector.deleteItem(context,itemId);
+ }
+
+ @Override
public void updateItem(SessionContext context, Id itemId, Info info) {
connector.updateItem(context, itemId, info);
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java
index 09c8102ef0..8c0008454e 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java
@@ -22,5 +22,5 @@ public interface PermissionsServices {
String getUserItemPermiission(String itemId, String userId);
-
+ void deleteItemPermissions(String itemId);
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java
index a0f51f90bb..ee5e1f3e3a 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java
@@ -17,5 +17,7 @@ public interface ItemPermissionsDao {
void addUserPermission(String itemId, String userId, String permission);
- String getUserItemPermiission(String itemId, String userId);
+ String getUserItemPermission(String itemId, String userId);
+
+ void deleteItemPermissions(String itemId);
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java
index e1a9d1c874..8c62aa02fe 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java
@@ -38,7 +38,7 @@ public class ItemPermissionsDaoImpl implements ItemPermissionsDao {
}
@Override
- public String getUserItemPermiission(String itemId, String userId) {
+ public String getUserItemPermission(String itemId, String userId) {
ResultSet result = accessor.getUserItemPermission(itemId,userId);
if (result.getAvailableWithoutFetching() < 1) {
@@ -47,6 +47,11 @@ public class ItemPermissionsDaoImpl implements ItemPermissionsDao {
return result.one().getString(0);
}
+ @Override
+ public void deleteItemPermissions(String itemId) {
+ accessor.deleteItemPermissions(itemId);
+ }
+
@Accessor
interface ItemPermissionsAccessor {
@@ -62,5 +67,9 @@ public class ItemPermissionsDaoImpl implements ItemPermissionsDao {
@Query("insert into dox.item_permissions (item_id,user_id,permission) values (?,?,?)")
void addPermission(String itemId,String userId, String permission);
+ @Query("delete from dox.item_permissions where item_id=?")
+ void deleteItemPermissions(String itemId);
+
+
}
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java
index ae40ea8d97..08b51eee86 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java
@@ -53,7 +53,7 @@ public class PermissionsServicesImpl implements PermissionsServices {
@Override
public boolean isAllowed(String itemId,String userId,String action) {
- String userPermission = permissionsDao.getUserItemPermiission(itemId,userId);
+ String userPermission = permissionsDao.getUserItemPermission(itemId,userId);
return permissionsRules.isAllowed(userPermission,action);
}
@@ -64,7 +64,12 @@ public class PermissionsServicesImpl implements PermissionsServices {
@Override
public String getUserItemPermiission(String itemId, String userId) {
- return permissionsDao.getUserItemPermiission(itemId,userId);
+ return permissionsDao.getUserItemPermission(itemId,userId);
+ }
+
+ @Override
+ public void deleteItemPermissions(String itemId) {
+ permissionsDao.deleteItemPermissions(itemId);
}
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java
index 4a8f44657e..baafb4a9eb 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java
@@ -27,6 +27,7 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.HttpMethod;
import java.io.IOException;
/**
@@ -63,7 +64,7 @@ public class PermissionsFilter implements Filter {
String method = servletRequest.getMethod();
- if (method.equals("POST") || method.equals("PUT")) {
+ if (method.equals(HttpMethod.POST) || method.equals(HttpMethod.PUT) || method.equals(HttpMethod.DELETE)) {
String userId = servletRequest.getHeader("USER_ID");
String itemId = parseItemIdFromPath(servletRequest.getPathInfo());
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java
index 1f56c1038a..f80379aa91 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java
@@ -19,109 +19,115 @@ import static org.openecomp.sdc.itempermissions.errors.PermissionsErrorMessages.
public class PermissionsRulesImpl implements PermissionsRules {
- @Override
- public boolean isAllowed(String permission, String action) {
+ @Override
+ public boolean isAllowed(String permission, String action) {
- if (permission == null) {
- return false;
- }
- try {
- PermissionTypes.valueOf(permission);
- } catch (IllegalArgumentException ex) {
- throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_PERMISSION_TYPE).build());
- }
+ if (permission == null) {
+ return false;
+ }
+ try {
+ PermissionTypes.valueOf(permission);
+ } catch (IllegalArgumentException ex) {
+ throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_PERMISSION_TYPE).build());
+ }
- try {
- switch (PermissionActionTypes.valueOf(action)) {
- case Create_Item:
- return true;
-
- case Edit_Item:
- if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
- (PermissionTypes.Owner.name())) {
- return true;
- }
- break;
- case Commit_Item:
- if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
- (PermissionTypes.Owner.name())) {
- return true;
+ try {
+ switch (PermissionActionTypes.valueOf(action)) {
+ case Create_Item:
+ return true;
+
+ case Edit_Item:
+ if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
+ (PermissionTypes.Owner.name())) {
+ return true;
+ }
+ break;
+ case Commit_Item:
+ if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
+ (PermissionTypes.Owner.name())) {
+ return true;
+ }
+ break;
+ case Delete_Item:
+ if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
+ (PermissionTypes.Owner.name())) {
+ return true;
+ }
+ break;
+
+ case Change_Item_Permissions:
+ if (permission.equals(PermissionTypes.Owner.name())) {
+ return true;
+ }
+ break;
+
+ case Submit_Item:
+ if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
+ (PermissionTypes.Owner.name())) {
+ return true;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ } catch (IllegalArgumentException ex) {
+ throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_ACTION_TYPE).build());
}
- break;
-
- case Change_Item_Permissions:
- if (permission.equals(PermissionTypes.Owner.name())) {
- return true;
- }
- break;
-
- case Submit_Item:
- if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals
- (PermissionTypes.Owner.name())) {
- return true;
- }
- break;
-
- default:
- return false;
- }
- } catch (IllegalArgumentException ex) {
- throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_ACTION_TYPE).build());
- }
- return false;
- }
+ return false;
+ }
- @Override
- public void executeAction(String itemId, String userId, String action) {
- try {
- switch (PermissionActionTypes.valueOf(action)) {
- case Create_Item:
- caseCreateItem(userId,itemId);
- break;
+ @Override
+ public void executeAction(String itemId, String userId, String action) {
+ try {
+ switch (PermissionActionTypes.valueOf(action)) {
+ case Create_Item:
+ caseCreateItem(userId, itemId);
+ break;
- case Change_Item_Permissions:
- break;
+ case Change_Item_Permissions:
+ break;
- case Edit_Item:
- break;
+ case Edit_Item:
+ break;
- case Submit_Item:
- break;
+ case Submit_Item:
+ break;
- default:
- }
- } catch (IllegalArgumentException ex) {
- throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_ACTION_TYPE).build());
- }
- }
-
- @Override
- public void updatePermission(String itemId,String currentUserId, String permission, Set<String>
- addedUsersIds,Set<String> removedUsersIds) {
- try {
- PermissionTypes.valueOf(permission);
- } catch (IllegalArgumentException ex) {
- throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_PERMISSION_TYPE).build());
+ default:
+ }
+ } catch (IllegalArgumentException ex) {
+ throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_ACTION_TYPE).build());
+ }
}
- if (permission.equals(PermissionTypes.Owner.name())) {
+ @Override
+ public void updatePermission(String itemId, String currentUserId, String permission, Set<String>
+ addedUsersIds, Set<String> removedUsersIds) {
+ try {
+ PermissionTypes.valueOf(permission);
+ } catch (IllegalArgumentException ex) {
+ throw new CoreException(new PermissionsErrorMessagesBuilder(INVALID_PERMISSION_TYPE).build());
+ }
+
+ if (permission.equals(PermissionTypes.Owner.name())) {
- HashSet<String> currentOwner = new HashSet<String>();
- currentOwner.add(currentUserId);
+ HashSet<String> currentOwner = new HashSet<>();
+ currentOwner.add(currentUserId);
+
+ PermissionsServicesFactory.getInstance().createInterface()
+ .updateItemPermissions(itemId, PermissionTypes.Contributor.name(),
+ currentOwner, new HashSet<String>());
+ }
+ }
- PermissionsServicesFactory.getInstance().createInterface()
- .updateItemPermissions(itemId,PermissionTypes.Contributor.name(),
- currentOwner,new HashSet<String>());
+ protected void caseCreateItem(String userId, String itemId) {
+ HashSet<String> ownerId = new HashSet<>();
+ ownerId.add(userId);
+ PermissionsServicesFactory.getInstance().createInterface()
+ .updateItemPermissions(itemId, PermissionTypes.Owner.name(), ownerId,
+ new HashSet<String>());
}
- }
-
- protected void caseCreateItem(String userId,String itemId) {
- HashSet<String> ownerId = new HashSet<String>();
- ownerId.add(userId);
- PermissionsServicesFactory.getInstance().createInterface()
- .updateItemPermissions(itemId, PermissionTypes.Owner.name(), ownerId,
- new HashSet<String>());
- }
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/types/PermissionActionTypes.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/types/PermissionActionTypes.java
index 3d1b8a82d7..3911f2ad7b 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/types/PermissionActionTypes.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/types/PermissionActionTypes.java
@@ -9,6 +9,7 @@ public enum PermissionActionTypes {
Change_Item_Permissions,
Edit_Item,
Commit_Item,
+ Delete_Item,
Submit_Item;
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
index c24934508e..a7d1c570a4 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
@@ -406,5 +406,10 @@ public class ServiceModelDaoFactoryTest {
public Item getItem(SessionContext context, Id itemId) {
return null;
}
+
+ @Override
+ public void deleteItem(SessionContext context, Id itemId) {
+
+ }
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
index c83ebff818..885d96a132 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
@@ -19,4 +19,6 @@ public interface ItemManager {
void updateOwner(String itemId, String owner);
+ void delete(Item item);
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java
index f1edc1e0c0..9bc1d894b6 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java
@@ -11,5 +11,7 @@ public interface ItemDao {
Item create(Item item);
+ void delete(Item item);
+
void update(Item item);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
index b62f7b53e1..336db6496c 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
@@ -6,6 +6,7 @@ package org.openecomp.sdc.versioning.types;
*/
public enum NotificationEventTypes {
SUBMIT("submit"),
+ DELETE("delete"),
COMMIT("commit");
private String eventName;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java
index 6352508e0c..5a212afc8e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java
@@ -42,6 +42,11 @@ public class ItemZusammenDaoImpl implements ItemDao {
}
@Override
+ public void delete(Item item){
+ zusammenAdaptor.deleteItem(ZusammenUtil.createSessionContext(),new Id(item.getId()));
+ }
+
+ @Override
public void update(Item item) {
zusammenAdaptor
.updateItem(ZusammenUtil.createSessionContext(), new Id(item.getId()),
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
index e46037373f..ba51b17575 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
@@ -76,4 +76,9 @@ public class ItemManagerImpl implements ItemManager {
item.setOwner(owner);
itemDao.update(item);
}
+
+ @Override
+ public void delete(Item item) {
+ itemDao.delete(item);
+ }
}
diff --git a/openecomp-be/tools/zusammen-tools/pom.xml b/openecomp-be/tools/zusammen-tools/pom.xml
index e96f8e2c06..1d7d66ed10 100644
--- a/openecomp-be/tools/zusammen-tools/pom.xml
+++ b/openecomp-be/tools/zusammen-tools/pom.xml
@@ -22,7 +22,7 @@
<dependency>
<groupId>com.amdocs.zusammen.plugin</groupId>
<artifactId>zusammen-collaboration-cassandra-plugin</artifactId>
- <version>${zusammen.version}</version>
+ <version>${zusammen-collaboration-store.version}</version>
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>