From 21a0f3fb55900b089c18b2ca4d94feacfbea4923 Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Mon, 28 Nov 2022 21:39:59 +0300 Subject: [PATCH] last page of a license issuing wizard is always empty #1148 add description to floating license issue wizard's info Signed-off-by: eparovyshnaya --- .../licenses/model/i18n/messages.properties | 3 ++ .../DescribedFloatingFeatureGrant.java | 45 +++++++++++++++++++ .../DescribedFloatingFeatureGrants.java | 38 ++++++++++++++++ .../described/DescribedFloatingLicense.java | 37 +++++++++++++++ .../model/described/DescribedHost.java | 35 +++++++++++++++ .../model/described/DescribedUserGrant.java | 36 +++++++++++++++ .../model/described/DescribedUserGrants.java | 38 ++++++++++++++++ 7 files changed, 232 insertions(+) create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrant.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrants.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingLicense.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedHost.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrant.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrants.java diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/i18n/messages.properties b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/i18n/messages.properties index eb0261104..ccb8664c3 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/i18n/messages.properties +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/i18n/messages.properties @@ -13,6 +13,7 @@ DescribedAuthenticationInstructions_environment=Authenticated by DescribedAuthenticationInstructions_expression=with expression +DescribedHost_host=Intended for server DescribedLicenseRequisites_identifier=Identifier: DescribedLicenseRequisites_issued=Issued: DescribedLicenseRequisites_plan=Under licensing plan @@ -24,5 +25,7 @@ DescribedPersonalFeatureGrant_capacity=Capacity: DescribedPersonalFeatureGrant_feature=Grant for feature DescribedPersonalFeatureGrant_version=version DescribedPersonalFeatureGrant_rule = \ matching with rule +DescribedPersonalFeatureGrant_user=User DescribedPersonalFeatureGrants_grants=\ grants +DescribedUserGrants_grants=User grants DescribedValidityPeriodClosed.template=Valid from %s until %s diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrant.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrant.java new file mode 100644 index 000000000..99bf9edd3 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrant.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2022 ArSysOp + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0/. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.licenses.model.described; + +import org.eclipse.passage.lic.internal.licenses.model.i18n.Messages; +import org.eclipse.passage.lic.licenses.FeatureGrantDescriptor; + +public final class DescribedFloatingFeatureGrant extends Described { + + private FeatureGrantDescriptor grant; + + public DescribedFloatingFeatureGrant(FeatureGrantDescriptor grant) { + this.grant = grant; + } + + @Override + public String get() { + StringBuilder out = new StringBuilder(); + out.append(tab).append(Messages.getString("DescribedPersonalFeatureGrant_feature")) // //$NON-NLS-1$ + .append(grant.getFeature().getIdentifier()).append(nl)// + + .append(tabs).append(Messages.getString("DescribedPersonalFeatureGrant_version")) // //$NON-NLS-1$ + .append(grant.getFeature().getVersionMatch().getVersion())// + .append(Messages.getString("DescribedPersonalFeatureGrant_rule")) // //$NON-NLS-1$ + .append(grant.getFeature().getVersionMatch().getRule())// + .append(nl)// + + .append(tabs).append(new DescribedValidityPeriod(grant.getValid()).get()).append(nl)// + + .append(tabs).append(Messages.getString("DescribedPersonalFeatureGrant_capacity"))// //$NON-NLS-1$ + .append(grant.getCapacity()).append(nl);// + return out.toString(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrants.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrants.java new file mode 100644 index 000000000..165bf8fcd --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingFeatureGrants.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2022 ArSysOp + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0/. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.licenses.model.described; + +import java.util.List; + +import org.eclipse.passage.lic.internal.licenses.model.i18n.Messages; +import org.eclipse.passage.lic.licenses.FeatureGrantDescriptor; + +public final class DescribedFloatingFeatureGrants extends Described { + + private final List grants; + + public DescribedFloatingFeatureGrants(List grants) { + this.grants = grants; + } + + @Override + public String get() { + StringBuilder out = new StringBuilder(); + out.append(grants.size()).append(Messages.getString("DescribedPersonalFeatureGrants_grants")).append(nl); //$NON-NLS-1$ + for (FeatureGrantDescriptor grant : grants) { + out.append(new DescribedFloatingFeatureGrant(grant).get()); + } + return out.toString(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingLicense.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingLicense.java new file mode 100644 index 000000000..f0a586c37 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedFloatingLicense.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2022 ArSysOp + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0/. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.licenses.model.described; + +import java.util.function.Supplier; + +import org.eclipse.passage.lic.licenses.FloatingLicensePackDescriptor; + +public final class DescribedFloatingLicense implements Supplier { + + private final FloatingLicensePackDescriptor pack; + + public DescribedFloatingLicense(FloatingLicensePackDescriptor license) { + this.pack = license; + } + + @Override + public String get() { + StringBuilder out = new StringBuilder(); + out.append(new DescribedLicenseRequisites(pack.getLicense()).get()); + out.append(new DescribedHost(pack.getHost()).get()); + out.append(new DescribedUserGrants(pack.getUsers()).get()); + out.append(new DescribedFloatingFeatureGrants(pack.getFeatures()).get()); + return out.toString(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedHost.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedHost.java new file mode 100644 index 000000000..f9ca735ea --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedHost.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2022 ArSysOp + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0/. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.licenses.model.described; + +import org.eclipse.passage.lic.internal.licenses.model.i18n.Messages; +import org.eclipse.passage.lic.licenses.FloatingServerDescriptor; + +public final class DescribedHost extends Described { + + private final FloatingServerDescriptor server; + + public DescribedHost(FloatingServerDescriptor server) { + this.server = server; + } + + @Override + public String get() { + StringBuilder out = new StringBuilder(); + out.append(tab).append(Messages.getString("DescribedHost_host")) //$NON-NLS-1$ + .append(server.getIdentifier()).append(nl)// + .append(tab).append(new DescribedAuthenticationInstructions(server.getAuthentication())).append(nl); + return out.toString(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrant.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrant.java new file mode 100644 index 000000000..12ec4c4d3 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrant.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2022 ArSysOp + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0/. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.licenses.model.described; + +import org.eclipse.passage.lic.internal.licenses.model.i18n.Messages; +import org.eclipse.passage.lic.licenses.UserGrantDescriptor; + +public final class DescribedUserGrant extends Described { + + private UserGrantDescriptor grant; + + public DescribedUserGrant(UserGrantDescriptor grant) { + this.grant = grant; + } + + @Override + public String get() { + StringBuilder out = new StringBuilder(); + out.append(tab).append(Messages.getString("DescribedPersonalFeatureGrant_user")) //$NON-NLS-1$ + .append(grant.getUser()).append(nl)// + .append(tabs).append(new DescribedAuthenticationInstructions(grant.getAuthentication()).get()) + .append(nl); + return out.toString(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrants.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrants.java new file mode 100644 index 000000000..70c9a2cfd --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/licenses/model/described/DescribedUserGrants.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2022 ArSysOp + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0/. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.licenses.model.described; + +import java.util.List; + +import org.eclipse.passage.lic.internal.licenses.model.i18n.Messages; +import org.eclipse.passage.lic.licenses.UserGrantDescriptor; + +public final class DescribedUserGrants extends Described { + + private final List grants; + + public DescribedUserGrants(List grants) { + this.grants = grants; + } + + @Override + public String get() { + StringBuilder out = new StringBuilder(); + out.append(grants.size()).append(Messages.getString("DescribedUserGrants_grants")).append(nl); //$NON-NLS-1$ + for (UserGrantDescriptor grant : grants) { + out.append(new DescribedUserGrant(grant).get()); + } + return out.toString(); + } + +}