summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authorayalaben <Ayala.Benzvi@Amdocs.Com>2018-02-11 11:11:00 +0200
committerayalaben <ayala.benzvi@amdocs.com>2018-02-11 15:27:45 +0200
commitda603323ec3cdf4257707ac1cb4d5d657783ae9f (patch)
treea8e65ce8629da0e56d5ac7fa7993b518d360a761 /openecomp-be/lib
parent27fed258bd045e4af8cdc1181ebf3cef8d0822cc (diff)
Delete Item Draft
Change-Id: I13767ab6a7be82ae89f80d50b5857aabe6e55906 Issue-ID: SDC-1014 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/lib')
-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
19 files changed, 162 insertions, 97 deletions
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);
+ }
}