diff options
author | ayalaben <ayala.benzvi@amdocs.com> | 2018-04-24 15:57:52 +0300 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2018-05-06 15:35:43 +0000 |
commit | 0c51c0f629767d17c364229e5d528c8b609334da (patch) | |
tree | 941c011f8ae88b69453072eebd4d09d308b5375f /openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java | |
parent | 518c1d305bcb8c3e2cb96a62444f9fc7db634a14 (diff) |
notify catalog on items action
Change-Id: I3be022809b83ec939eaa0a383fa9e7b659dc096b
Issue-ID: SDC-1257
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java')
-rw-r--r-- | openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java index ae6e24bb65..359662ad33 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/ItemsImpl.java @@ -21,7 +21,7 @@ import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME; import java.util.Arrays; -import java.util.Collection; +import java.util.Collections; import java.util.EnumMap; import java.util.HashMap; import java.util.HashSet; @@ -66,6 +66,7 @@ import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; + @Named @Service("items") @Scope(value = "prototype") @@ -85,6 +86,8 @@ public class ItemsImpl implements Items { private NotificationPropagationManager notifier = NotificationPropagationManagerFactory.getInstance().createInterface(); + private CatalogNotifier catalogNotifier = new CatalogNotifier(); + private Map<ItemAction, ActionSideAffects> actionSideAffectsMap = new EnumMap<>(ItemAction.class); @PostConstruct @@ -97,6 +100,7 @@ public class ItemsImpl implements Items { private static final String ONBOARDING_METHOD = "onboardingMethod"; + @Override public Response actOn(ItemActionRequestDto request, String itemId, String user) { @@ -116,6 +120,7 @@ public class ItemsImpl implements Items { } actionSideAffectsMap.get(request.getAction()).execute(item, user); + catalogNotifier.execute(Collections.singleton(itemId),request.getAction(),2); return Response.ok().build(); } @@ -131,8 +136,8 @@ public class ItemsImpl implements Items { GenericCollectionWrapper<ItemDto> results = new GenericCollectionWrapper<>(); MapItemToDto mapper = new MapItemToDto(); itemManager.list(itemPredicate).stream() - .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())) - .forEach(item -> results.add(mapper.applyMapping(item, ItemDto.class))); + .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())) + .forEach(item -> results.add(mapper.applyMapping(item, ItemDto.class))); return Response.ok(results).build(); @@ -323,4 +328,4 @@ public class ItemsImpl implements Items { private enum OnboardingMethod { NetworkPackage, Manual; } -} +}
\ No newline at end of file |