summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib
diff options
context:
space:
mode:
authorayalaben <Ayala.Benzvi@Amdocs.Com>2017-12-27 12:05:35 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2017-12-31 08:08:20 +0000
commit5eb33aa2b4a62c60c7296e17e165b8bdf2a81016 (patch)
tree2dabefac3eef14969a533213689be24d6b5f11fc /openecomp-be/lib/openecomp-sdc-versioning-lib
parented9d494caf774e4340bf9ac0fbf4e4436ef9750e (diff)
Add Item Owner to item
Change-Id: I91ce289159057bd5c179c64131d74a24aa83ac9f Issue-ID: SDC-800 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib')
-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/types/Item.java9
-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.java11
4 files changed, 27 insertions, 0 deletions
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 ee58902a49..c83ebff818 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
@@ -17,4 +17,6 @@ public interface ItemManager {
void updateVersionStatus(String itemId, VersionStatus addedVersionStatus,
VersionStatus removedVersionStatus);
+ void updateOwner(String itemId, String owner);
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
index 2a95c05f49..d572373d44 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
@@ -11,6 +11,7 @@ public class Item {
private String id;
private String type;
private String name;
+ private String owner;
private String description;
private Map<String, Object> properties = new HashMap<>();
private Map<VersionStatus, Integer> versionStatusCounters = new EnumMap<>(VersionStatus.class);
@@ -41,6 +42,14 @@ public class Item {
this.name = name;
}
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
public String getDescription() {
return description;
}
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 8fdcf71d59..6352508e0c 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
@@ -70,6 +70,9 @@ public class ItemZusammenDaoImpl implements ItemDao {
case InfoPropertyName.ITEM_TYPE:
item.setType((String) propertyValue);
break;
+ case InfoPropertyName.ITEM_OWNER:
+ item.setOwner((String) propertyValue);
+ break;
case InfoPropertyName.ITEM_VERSIONS_STATUSES:
for (Map.Entry<String, Number> statusCounter :
((Map<String, Number>) propertyValue).entrySet()) {
@@ -87,6 +90,7 @@ public class ItemZusammenDaoImpl implements ItemDao {
info.setName(item.getName());
info.setDescription(item.getDescription());
info.addProperty(InfoPropertyName.ITEM_TYPE, item.getType());
+ info.addProperty(InfoPropertyName.ITEM_OWNER,item.getOwner());
info.addProperty(InfoPropertyName.ITEM_VERSIONS_STATUSES, item.getVersionStatusCounters());
item.getProperties().entrySet()
.forEach(property -> info.addProperty(property.getKey(), property.getValue()));
@@ -96,6 +100,7 @@ public class ItemZusammenDaoImpl implements ItemDao {
private static final class InfoPropertyName {
private static final String ITEM_TYPE = "item_type";
private static final String ITEM_VERSIONS_STATUSES = "item_versions_statuses";
+ private static final String ITEM_OWNER = "Owner";
private InfoPropertyName() {
throw new IllegalStateException("Constants class");
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 79284542fb..3e85a53ac2 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
@@ -65,4 +65,15 @@ public class ItemManagerImpl implements ItemManager {
}
itemDao.update(item);
}
+
+ @Override
+ public void updateOwner(String itemId, String owner){
+ Item item = get(itemId);
+ if (item == null) {
+ return;
+ }
+
+ item.setOwner(owner);
+ itemDao.update(item);
+ }
}