Skip to content

Commit

Permalink
Bug 560181 - [Passage] add billing core basic implementation
Browse files Browse the repository at this point in the history
added UsersLicenses javadoc

Signed-off-by: Nikifor Fedorov <[email protected]>
  • Loading branch information
zelenyhleb committed Feb 26, 2020
1 parent 20962db commit 0e2d604
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
import org.eclipse.passage.lic.users.UserDescriptor;
import org.eclipse.passage.lic.users.UserLicenseDescriptor;

/**
* Root class of the package. Contains methods that return license descriptors
* filtered by some parameters.
*
* @since 0.1
*/
public final class UserLicenses {

/**
Expand Down Expand Up @@ -97,10 +103,8 @@ public boolean test(UserLicenseDescriptor descriptor) {
* @return Linked list of licenses
*/
private final List<UserLicenseDescriptor> getLicenses(Predicate<UserLicenseDescriptor> condition) {
return users.stream()
.map(UserDescriptor::getUserLicenses)
.flatMap(iterable -> StreamSupport.stream(iterable.spliterator(), false))
.filter(condition)
return users.stream().map(UserDescriptor::getUserLicenses)
.flatMap(iterable -> StreamSupport.stream(iterable.spliterator(), false)).filter(condition)
.collect(Collectors.toList());
}

Expand All @@ -111,13 +115,10 @@ private final List<UserLicenseDescriptor> getLicenses(Predicate<UserLicenseDescr
* and number of licenses is a value
*/
public final Map<ProductVersionLicense, Integer> getLicensesNumbers() {
List<ProductVersionLicense> licenses = getAllLicenses().stream()
.map(ProductVersionLicense::new)
List<ProductVersionLicense> licenses = getAllLicenses().stream().map(ProductVersionLicense::new)
.collect(Collectors.toList());
return licenses.stream()
.collect(Collectors.toMap(license -> license,
license -> Collections.frequency(licenses, license),
(l1, l2) -> l1));
return licenses.stream().collect(Collectors.toMap(license -> license,
license -> Collections.frequency(licenses, license), (l1, l2) -> l1));
}

}

0 comments on commit 0e2d604

Please sign in to comment.