From 4ed15b4707fe541cf9b47c4aff22145505b3dfa0 Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Fri, 5 Apr 2024 08:56:07 +0300 Subject: [PATCH] [#1340] floating license pack issuing does not work for template fix 'equals' error on finding Feature Grant prototype --- .../core/FloatingLicensePackFromRequest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java index 94845219d..499c1418a 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java @@ -188,32 +188,32 @@ private Collection featureGrants(FloatingLicensePack pack) { private FeatureGrant featureGrant(LicensePlanFeatureDescriptor feature, FloatingLicensePack pack, int no) { FeatureGrant grant = new EmptyFeatureGrant().get(); String fid = feature.getFeature().getIdentifier(); - grant.getFeature().setIdentifier(fid); - grant.setCapacity(request.defaultCapacity()); grant.setIdentifier(String.format("%s#%d", request.identifier(), no)); //$NON-NLS-1$ - grant.setPack(pack); + grant.setCapacity(request.defaultCapacity()); + grant.getFeature().setIdentifier(fid); + grant.getFeature().setVersionMatch(version(feature)); grant.setValid(featureGrantPeriod(fid)); grant.setVivid(featureGrantVivid(fid)); - grant.getFeature().setVersionMatch(version(feature)); + grant.setPack(pack); return grant; } private ValidityPeriod featureGrantPeriod(String feature) { return template// - .flatMap(l -> forFeature(l.getFeatures(), feature)) // + .flatMap(pack -> forFeature(pack.getFeatures(), feature)) // .map(g -> EcoreUtil.copy(g.getValid()))// .orElseGet(this::period); } private long featureGrantVivid(String feature) { return template// - .flatMap(l -> forFeature(l.getFeatures(), feature)) // + .flatMap(pack -> forFeature(pack.getFeatures(), feature)) // .map(FeatureGrant::getVivid)// .orElse(60L); } private Optional forFeature(List all, String feature) { - return all.stream().filter(g -> feature.equals(g.getFeature())).findFirst(); + return all.stream().filter(g -> feature.equals(g.getFeature().getIdentifier())).findFirst(); } private VersionMatch version(LicensePlanFeatureDescriptor feature) {