From 5eb33aa2b4a62c60c7296e17e165b8bdf2a81016 Mon Sep 17 00:00:00 2001 From: ayalaben Date: Wed, 27 Dec 2017 12:05:35 +0200 Subject: Add Item Owner to item Change-Id: I91ce289159057bd5c179c64131d74a24aa83ac9f Issue-ID: SDC-800 Signed-off-by: ayalaben --- .../sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java | 5 +++++ .../org/openecomp/sdc/versioning/impl/ItemManagerImpl.java | 11 +++++++++++ 2 files changed, 16 insertions(+) (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src') 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 statusCounter : ((Map) 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); + } } -- cgit 1.2.3-korg