aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-10-04 14:24:58 +0300
committerayalaben <ayala.benzvi@amdocs.com>2018-10-07 13:15:53 +0300
commit453831564d4af7eb7603a50a2d75505ad858db2b (patch)
tree1a06c433d2d9b458c4e47531fb39abc9db1fb66a /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
parent454cfef267e87a2e0fba46964106c6fe03c220fd (diff)
Entities are not ordered by Name user feedback
Change-Id: I937b744c13d3cdf08a2ba23e365c7138494ac491 Issue-ID: SDC-1818 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java')
-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/LicenseKeyGroupsImpl.java24
1 files changed, 13 insertions, 11 deletions
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/LicenseKeyGroupsImpl.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/LicenseKeyGroupsImpl.java
index 5f37d39720..3edee02080 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/LicenseKeyGroupsImpl.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/LicenseKeyGroupsImpl.java
@@ -20,6 +20,11 @@
package org.openecomp.sdcrests.vendorlicense.rest.services;
+import java.util.Comparator;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
@@ -35,10 +40,6 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
-import javax.inject.Named;
-import javax.ws.rs.core.Response;
-import java.util.Collection;
-
@Named
@Service("licenseKeyGroups")
@Scope(value = "prototype")
@@ -56,15 +57,16 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
* @return the response
*/
public Response listLicenseKeyGroups(String vlmId, String versionId, String user) {
- Collection<LicenseKeyGroupEntity> licenseKeyGroups =
- vendorLicenseManager.listLicenseKeyGroups(vlmId, new Version(versionId));
- GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>();
MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper =
- new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto();
- for (LicenseKeyGroupEntity ep : licenseKeyGroups) {
- result.add(outputMapper.applyMapping(ep, LicenseKeyGroupEntityDto.class));
- }
+ new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto();
+
+ GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>(
+ vendorLicenseManager.listLicenseKeyGroups(vlmId, new Version(versionId)).stream()
+ .sorted(Comparator.comparing(LicenseKeyGroupEntity::getName))
+ .map(item -> outputMapper.applyMapping(item, LicenseKeyGroupEntityDto.class))
+ .collect(Collectors.toList()));
+
return Response.ok(result).build();
}