From d6b362422ebeb459cddd125ade4018c8b7b151f3 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Thu, 13 May 2021 21:47:13 +0300 Subject: [PATCH 1/8] Bug 572650 - upgrade `licenses` domain model - regenerate Model and Edit code for 'licenses' domain - fix the relying code Signed-off-by: eparovyshnaya --- .../lbc/internal/base/mine/Conditions.java | 6 +- .../base/mine/PersonalLicenseGenerated.java | 29 +- .../licenses/e4/ui/LicensesE4UiProcessor.java | 6 +- .../.settings/.api_filters | 8 - .../icons/full/obj16/CompanyRef.gif | Bin 0 -> 129 bytes .../icons/full/obj16/PersonalLicensePack.gif | Bin 0 -> 129 bytes .../icons/full/obj16/UserRef.gif | Bin 0 -> 129 bytes .../plugin.properties | 12 + .../providers/CompanyRefItemProvider.java | 204 ++++++ ...FloatingLicenseRequisitesItemProvider.java | 10 +- .../providers/LicensePackItemProvider.java | 349 --------- .../providers/LicensePlanItemProvider.java | 2 +- .../LicensesItemProviderAdapterFactory.java | 70 +- .../PersonalLicensePackItemProvider.java | 192 +++++ ...PersonalLicenseRequisitesItemProvider.java | 14 +- .../edit/providers/UserRefItemProvider.java | 185 +++++ .../model/licenses.genmodel | 28 +- .../lic/licenses/model/api/CompanyRef.java | 107 +++ .../model/api/FloatingLicenseRequisites.java | 16 +- .../lic/licenses/model/api/LicenseGrant.java | 12 +- .../lic/licenses/model/api/LicensePack.java | 247 ------- .../lic/licenses/model/api/LicensePlan.java | 4 +- .../model/api/PersonalLicensePack.java | 75 ++ .../model/api/PersonalLicenseRequisites.java | 16 +- .../lic/licenses/model/api/UserRef.java | 83 +++ .../licenses/model/impl/CompanyRefImpl.java | 301 ++++++++ .../impl/FloatingLicenseRequisitesImpl.java | 95 ++- .../licenses/model/impl/LicenseGrantImpl.java | 23 +- .../licenses/model/impl/LicensePackImpl.java | 671 ------------------ .../licenses/model/impl/LicensePlanImpl.java | 10 +- .../model/impl/LicensesFactoryImpl.java | 36 +- .../model/impl/LicensesPackageImpl.java | 327 +++++---- .../model/impl/PersonalLicensePackImpl.java | 267 +++++++ .../impl/PersonalLicenseRequisitesImpl.java | 95 ++- .../lic/licenses/model/impl/UserRefImpl.java | 244 +++++++ .../licenses/model/meta/LicensesFactory.java | 28 +- .../licenses/model/meta/LicensesPackage.java | 528 ++++++++------ .../model/util/LicensesAdapterFactory.java | 96 ++- .../model/util/LicensesResourceImpl.java | 5 +- .../licenses/model/util/LicensesSwitch.java | 114 ++- .../model/AssignGrantIdentifiers.java | 10 +- .../model/EmptyFloatingLicensePack.java | 38 + .../model/EmptyPersonalLicensePack.java | 38 + .../migration/LicensesResourceHandler.java | 10 +- .../BaseXmiConditionTransport.java | 13 +- .../UserFilteringConditionTransport.java | 2 +- .../FloatingLicenseRequisitesDescriptor.java | 2 +- .../lic/licenses/LicenseGrantDescriptor.java | 4 +- .../lic/licenses/LicensePackDescriptor.java | 111 --- .../lic/licenses/LicensePlanDescriptor.java | 4 +- .../PersonalLicensePackDescriptor.java | 40 ++ .../PersonalLicenseRequisitesDescriptor.java | 2 +- .../.settings/.api_filters | 11 - .../META-INF/MANIFEST.MF | 2 +- .../loc/internal/api/IssuedLicense.java | 4 +- .../internal/api/OperatorLicenseEvents.java | 4 +- .../internal/api/OperatorLicenseService.java | 6 +- .../DashboardIssueFloatingLicenseHandler.java | 2 +- .../DashboardIssueLicenseHandler.java | 2 +- .../panel/DefaultDashboardPanelAdvisor.java | 4 +- .../ui/wizards/IssueLicenseDetailsPage.java | 6 +- .../ui/wizards/IssueLicensePackPage.java | 24 +- .../ui/wizards/IssueLicenseWizard.java | 10 +- .../licenses/core/BaseIssuedLicense.java | 8 +- .../internal/licenses/core/EmailTemplate.java | 40 +- .../core/FloatingLicensePackFromRequest.java | 12 +- .../licenses/core/IssuePersonalLicense.java | 20 +- .../core/LicenseOperatorServiceImpl.java | 14 +- .../core/PersonalLicensePackFromRequest.java | 48 +- .../licenses/core/UpdateLicensePlan.java | 6 +- .../PersonalLicenseIssuingProtection.java | 10 +- .../emfforms/parts/LicensesDetailsPart.java | 4 +- .../ProductIdentifierRendererService.java | 7 +- .../ProductVersionRendererService.java | 7 +- .../ui/handlers/LicenseExportHandler.java | 8 +- .../core/license/LicensePlanReport.java | 10 +- .../core/license/LicensePlanReportFetch.java | 12 +- .../internal/core/license/LicenseStorage.java | 8 +- .../internal/core/license/Licenses.java | 6 +- .../lbc/base/tests/ConditionsTest.java | 2 +- .../lbc/base/tests/DecodedResponse.java | 8 +- .../tests/FloatingCycleActionsDryRunTest.java | 2 +- .../migration/tests/LicenseMigratorTest.java | 16 +- .../XmiLicensingConditionExtractorTest.java | 9 +- .../tests/AssignGrantIdentifiersTest.java | 51 +- .../core/FakeLicensePlanDescriptor.java | 4 +- 86 files changed, 3041 insertions(+), 2135 deletions(-) create mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/CompanyRef.gif create mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/PersonalLicensePack.gif create mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/UserRef.gif create mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/CompanyRefItemProvider.java delete mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePackItemProvider.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicensePackItemProvider.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/UserRefItemProvider.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/CompanyRef.java delete mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePack.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicensePack.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/UserRef.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/CompanyRefImpl.java delete mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePackImpl.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicensePackImpl.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/UserRefImpl.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyFloatingLicensePack.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyPersonalLicensePack.java delete mode 100644 bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePackDescriptor.java create mode 100644 bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicensePackDescriptor.java delete mode 100644 bundles/org.eclipse.passage.loc.api/.settings/.api_filters diff --git a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/Conditions.java b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/Conditions.java index e4347ee4e..8822fbb91 100644 --- a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/Conditions.java +++ b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/Conditions.java @@ -29,7 +29,7 @@ import org.eclipse.passage.lic.internal.net.api.handle.NetResponse; import org.eclipse.passage.lic.internal.net.handle.Failure; import org.eclipse.passage.lic.internal.net.handle.ProductUserRequest; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; public final class Conditions implements Supplier { @@ -57,11 +57,11 @@ public NetResponse get() { return encodedPack(pack(conditions.data().get())); } - private NetResponse encodedPack(LicensePack pack) { + private NetResponse encodedPack(PersonalLicensePack pack) { return new EncodedResponse(pack, data).get(); } - private LicensePack pack(Collection conditions) { + private PersonalLicensePack pack(Collection conditions) { return new PersonalLicenseGenerated(// data.product().get(), // data.user().get(), // diff --git a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/PersonalLicenseGenerated.java b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/PersonalLicenseGenerated.java index b247f653d..9cb00addc 100644 --- a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/PersonalLicenseGenerated.java +++ b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/PersonalLicenseGenerated.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -22,11 +22,13 @@ import org.eclipse.passage.lic.internal.api.LicensedProduct; import org.eclipse.passage.lic.internal.api.conditions.Condition; import org.eclipse.passage.lic.internal.api.conditions.ValidityPeriodClosed; +import org.eclipse.passage.lic.internal.licenses.model.EmptyPersonalLicensePack; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; -final class PersonalLicenseGenerated implements Supplier { +@SuppressWarnings("restriction") +final class PersonalLicenseGenerated implements Supplier { private final LicensedProduct product; private final String user; @@ -39,19 +41,18 @@ final class PersonalLicenseGenerated implements Supplier { } @Override - public LicensePack get() { - LicensePack pack = LicensesFactory.eINSTANCE.createLicensePack(); - pack.setIdentifier(generated()); - pack.setIssueDate(new Date()); - pack.setPlanIdentifier("ignored"); //$NON-NLS-1$ - pack.setProductIdentifier(product.identifier()); - pack.setProductVersion(product.version()); - pack.setUserFullName(user); - pack.setUserIdentifier(user); - pack.setRequestIdentifier(generated()); + public PersonalLicensePack get() { + PersonalLicensePack pack = new EmptyPersonalLicensePack().get(); + pack.getLicense().setIdentifier(generated()); + pack.getLicense().setIssueDate(new Date()); + pack.getLicense().setPlan("ignored"); //$NON-NLS-1$ + pack.getLicense().getProduct().setIdentifier(product.identifier()); + pack.getLicense().getProduct().setVersion(product.version()); + pack.getLicense().getUser().setName(user); + pack.getLicense().getUser().setIdentifier(user); conditions.stream()// .map(this::grant)// - .forEach(pack.getLicenseGrants()::add); + .forEach(pack.getGrants()::add); return pack; } diff --git a/bundles/org.eclipse.passage.lic.licenses.e4.ui/src/org/eclipse/passage/lic/internal/licenses/e4/ui/LicensesE4UiProcessor.java b/bundles/org.eclipse.passage.lic.licenses.e4.ui/src/org/eclipse/passage/lic/internal/licenses/e4/ui/LicensesE4UiProcessor.java index 8490046ae..9c0c07c69 100644 --- a/bundles/org.eclipse.passage.lic.licenses.e4.ui/src/org/eclipse/passage/lic/internal/licenses/e4/ui/LicensesE4UiProcessor.java +++ b/bundles/org.eclipse.passage.lic.licenses.e4.ui/src/org/eclipse/passage/lic/internal/licenses/e4/ui/LicensesE4UiProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -22,6 +22,7 @@ import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; import org.eclipse.swt.widgets.Display; +@SuppressWarnings("restriction") public class LicensesE4UiProcessor { @Execute @@ -45,7 +46,8 @@ private void registerLicenses(String pattern) { paths.put(licenses.getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ paths.put(licenses.getLicensePlan().getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ paths.put(licenses.getLicensePlanFeature().getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ - paths.put(licenses.getLicensePack().getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ + paths.put(licenses.getPersonalLicensePack().getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ + paths.put(licenses.getFloatingLicensePack().getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ paths.put(licenses.getLicenseGrant().getName(), String.format(pattern, "license.png")); //$NON-NLS-1$ LicensingImages.declareImages(LicensesEditPlugin.class, paths); } diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/.settings/.api_filters b/bundles/org.eclipse.passage.lic.licenses.edit/.settings/.api_filters index 85c07276f..084c148e9 100644 --- a/bundles/org.eclipse.passage.lic.licenses.edit/.settings/.api_filters +++ b/bundles/org.eclipse.passage.lic.licenses.edit/.settings/.api_filters @@ -136,14 +136,6 @@ - - - - - - - - diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/CompanyRef.gif b/bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/CompanyRef.gif new file mode 100644 index 0000000000000000000000000000000000000000..5915591825a5301b9f9a3d398baea497ef02311d GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgt|Nk#u?74Zf=ggV3 z0|y)wf3h$#FmN*HfOLY)U|`WRIO(~1uf^*x-&FV?7P@XXWxbV>;I&}kR~x;L)6}k- WmG`XFk literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/PersonalLicensePack.gif b/bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/PersonalLicensePack.gif new file mode 100644 index 0000000000000000000000000000000000000000..a26660ec28fda4a4216562537c32047bab42b782 GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgte-Qgj+8LmfgM)+O zPZmZ722KVYkWP>p3@myECp}m1wRrvIn+pHKLf7r4thZ7UycR6{YNPjYn%Y&f@}8BN S{JP5-JKc^<6cT1+um%98?=Oe| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/UserRef.gif b/bundles/org.eclipse.passage.lic.licenses.edit/icons/full/obj16/UserRef.gif new file mode 100644 index 0000000000000000000000000000000000000000..e4b530eca173b1070d5d876a0154bc370d8896b4 GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgte-Qir{QE#D2L}hm zpDc_F44e!)Ae|sH7+CZSPI|81Yw`NaHx>Seg|6F8S#PBzcr94?)kg2*G_|W{ + * + * @generated + */ +public class CompanyRefItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public CompanyRefItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addIdentifierPropertyDescriptor(object); + addNamePropertyDescriptor(object); + addInfoPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Identifier feature. + * + * + * @generated + */ + protected void addIdentifierPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_CompanyRef_identifier_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_CompanyRef_identifier_feature", //$NON-NLS-1$//$NON-NLS-2$ + "_UI_CompanyRef_type"), //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getCompanyRef_Identifier(), true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_CompanyRef_name_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_CompanyRef_name_feature", //$NON-NLS-1$//$NON-NLS-2$ + "_UI_CompanyRef_type"), //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getCompanyRef_Name(), true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Info feature. + * + * + * @generated + */ + protected void addInfoPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_CompanyRef_info_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_CompanyRef_info_feature", //$NON-NLS-1$//$NON-NLS-2$ + "_UI_CompanyRef_type"), //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getCompanyRef_Info(), true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns CompanyRef.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/CompanyRef")); //$NON-NLS-1$ + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((CompanyRef) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_CompanyRef_type") : //$NON-NLS-1$ + getString("_UI_CompanyRef_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(CompanyRef.class)) { + case LicensesPackage.COMPANY_REF__IDENTIFIER: + case LicensesPackage.COMPANY_REF__NAME: + case LicensesPackage.COMPANY_REF__INFO: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + default: + super.notifyChanged(notification); + return; + } + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return LicensesEditPlugin.INSTANCE; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/FloatingLicenseRequisitesItemProvider.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/FloatingLicenseRequisitesItemProvider.java index 74e86a0e5..df41386de 100644 --- a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/FloatingLicenseRequisitesItemProvider.java +++ b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/FloatingLicenseRequisitesItemProvider.java @@ -20,8 +20,8 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.passage.lic.licenses.model.api.CompanyRef; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites; import org.eclipse.passage.lic.licenses.model.api.ProductRef; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; @@ -71,8 +71,8 @@ protected void addCompanyPropertyDescriptor(Object object) { getResourceLocator(), getString("_UI_FloatingLicenseRequisites_company_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_FloatingLicenseRequisites_company_feature", //$NON-NLS-1$//$NON-NLS-2$ "_UI_FloatingLicenseRequisites_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getFloatingLicenseRequisites_Company(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + LicensesPackage.eINSTANCE.getFloatingLicenseRequisites_Company(), true, false, false, null, + null, null)); } /** @@ -94,7 +94,9 @@ protected boolean shouldComposeCreationImage() { @Override public String getText(Object object) { FloatingLicenseRequisites license = (FloatingLicenseRequisites) object; - String company = license.getCompany() == null ? "unknown" : license.getCompany(); //$NON-NLS-1$ + String company = Optional.ofNullable(license.getCompany())// + .map(CompanyRef::getName) // + .orElse("unknown"); //$NON-NLS-1$ String product = Optional.ofNullable(license.getProduct())// .map(ProductRef::getIdentifier) // .orElse("unknown"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePackItemProvider.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePackItemProvider.java deleted file mode 100644 index 4ef910264..000000000 --- a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePackItemProvider.java +++ /dev/null @@ -1,349 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2020 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.edit.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; -import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; -import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; - -/** - * This is the item provider adapter for a {@link org.eclipse.passage.lic.licenses.model.api.LicensePack} object. - * - * - * - * @generated - */ -public class LicensePackItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, - IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. - * - * - * - * @generated - */ - public LicensePackItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * - * - * - * @generated - */ - @Override - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addIdentifierPropertyDescriptor(object); - addIssueDatePropertyDescriptor(object); - addUserIdentifierPropertyDescriptor(object); - addUserFullNamePropertyDescriptor(object); - addRequestIdentifierPropertyDescriptor(object); - addPlanIdentifierPropertyDescriptor(object); - addProductIdentifierPropertyDescriptor(object); - addProductVersionPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Identifier feature. - * - * - * - * @generated - */ - protected void addIdentifierPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_identifier_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_identifier_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_Identifier(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the Issue Date feature. - * - * - * - * @generated - */ - protected void addIssueDatePropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_issueDate_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_issueDate_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_IssueDate(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the Product Identifier feature. - * - * - * - * @generated - */ - protected void addProductIdentifierPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_productIdentifier_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_productIdentifier_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_ProductIdentifier(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the Product Version feature. - * - * - * - * @generated - */ - protected void addProductVersionPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_productVersion_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_productVersion_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_ProductVersion(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the User Identifier feature. - * - * - * - * @generated - */ - protected void addUserIdentifierPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_userIdentifier_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_userIdentifier_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_UserIdentifier(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the User Full Name feature. - * - * - * @generated - */ - protected void addUserFullNamePropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_userFullName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_userFullName_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_UserFullName(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the Request Identifier feature. - * - * - * @generated - */ - protected void addRequestIdentifierPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_requestIdentifier_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_requestIdentifier_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_RequestIdentifier(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the Plan Identifier feature. - * - * - * @generated - */ - protected void addPlanIdentifierPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_LicensePack_planIdentifier_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LicensePack_planIdentifier_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_LicensePack_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getLicensePack_PlanIdentifier(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or - * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. - * - * - * - * @generated - */ - @Override - public Collection getChildrenFeatures(Object object) { - if (childrenFeatures == null) { - super.getChildrenFeatures(object); - childrenFeatures.add(LicensesPackage.eINSTANCE.getLicensePack_LicenseGrants()); - } - return childrenFeatures; - } - - /** - * - * - * - * @generated - */ - @Override - protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildFeature(object, child); - } - - /** - * This returns license.png. - * - * - * - * - * - * @generated NOT - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/license.png")); //$NON-NLS-1$ - } - - /** - * - * - * - * @generated - */ - @Override - protected boolean shouldComposeCreationImage() { - return true; - } - - /** - * This returns the label text for the adapted class. - * - * - * - * - * - * @generated NOT - */ - @Override - public String getText(Object object) { - LicensePack licensePack = (LicensePack) object; - String packId = licensePack.getIdentifier(); - String productId = licensePack.getProductIdentifier(); - String productVersion = licensePack.getProductVersion(); - return getString("_UI_LicensePack_text_pattern", new Object[] { packId, productId, productVersion }); //$NON-NLS-1$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * - * - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(LicensePack.class)) { - case LicensesPackage.LICENSE_PACK__IDENTIFIER: - case LicensesPackage.LICENSE_PACK__ISSUE_DATE: - case LicensesPackage.LICENSE_PACK__USER_IDENTIFIER: - case LicensesPackage.LICENSE_PACK__USER_FULL_NAME: - case LicensesPackage.LICENSE_PACK__REQUEST_IDENTIFIER: - case LicensesPackage.LICENSE_PACK__PLAN_IDENTIFIER: - case LicensesPackage.LICENSE_PACK__PRODUCT_IDENTIFIER: - case LicensesPackage.LICENSE_PACK__PRODUCT_VERSION: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); - return; - default: - super.notifyChanged(notification); - return; - } - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * - * - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(LicensesPackage.eINSTANCE.getLicensePack_LicenseGrants(), - LicensesFactory.eINSTANCE.createLicenseGrant())); - } - - /** - * Return the resource locator for this item provider's resources. - * - * - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return LicensesEditPlugin.INSTANCE; - } - -} diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePlanItemProvider.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePlanItemProvider.java index dcf01fda6..a9a70de47 100644 --- a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePlanItemProvider.java +++ b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensePlanItemProvider.java @@ -237,7 +237,7 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors LicensesFactory.eINSTANCE.createLicensePlanFeature())); newChildDescriptors.add(createChildParameter(LicensesPackage.eINSTANCE.getLicensePlan_Personal(), - LicensesFactory.eINSTANCE.createLicensePack())); + LicensesFactory.eINSTANCE.createPersonalLicensePack())); newChildDescriptors.add(createChildParameter(LicensesPackage.eINSTANCE.getLicensePlan_Floating(), LicensesFactory.eINSTANCE.createFloatingLicensePack())); diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensesItemProviderAdapterFactory.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensesItemProviderAdapterFactory.java index 10d7583d3..2dda476fd 100644 --- a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensesItemProviderAdapterFactory.java +++ b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/LicensesItemProviderAdapterFactory.java @@ -132,28 +132,26 @@ public Adapter createLicensePlanFeatureAdapter() { } /** - * This keeps track of the one adapter used for all {@link org.eclipse.passage.lic.licenses.model.api.LicensePack} instances. + * This keeps track of the one adapter used for all {@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack} instances. * - * * * @generated */ - protected LicensePackItemProvider licensePackItemProvider; + protected PersonalLicensePackItemProvider personalLicensePackItemProvider; /** - * This creates an adapter for a {@link org.eclipse.passage.lic.licenses.model.api.LicensePack}. + * This creates an adapter for a {@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack}. * - * * * @generated */ @Override - public Adapter createLicensePackAdapter() { - if (licensePackItemProvider == null) { - licensePackItemProvider = new LicensePackItemProvider(this); + public Adapter createPersonalLicensePackAdapter() { + if (personalLicensePackItemProvider == null) { + personalLicensePackItemProvider = new PersonalLicensePackItemProvider(this); } - return licensePackItemProvider; + return personalLicensePackItemProvider; } /** @@ -273,6 +271,52 @@ public Adapter createProductRefAdapter() { return productRefItemProvider; } + /** + * This keeps track of the one adapter used for all {@link org.eclipse.passage.lic.licenses.model.api.UserRef} instances. + * + * + * @generated + */ + protected UserRefItemProvider userRefItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.passage.lic.licenses.model.api.UserRef}. + * + * + * @generated + */ + @Override + public Adapter createUserRefAdapter() { + if (userRefItemProvider == null) { + userRefItemProvider = new UserRefItemProvider(this); + } + + return userRefItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.passage.lic.licenses.model.api.CompanyRef} instances. + * + * + * @generated + */ + protected CompanyRefItemProvider companyRefItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.passage.lic.licenses.model.api.CompanyRef}. + * + * + * @generated + */ + @Override + public Adapter createCompanyRefAdapter() { + if (companyRefItemProvider == null) { + companyRefItemProvider = new CompanyRefItemProvider(this); + } + + return companyRefItemProvider; + } + /** * This keeps track of the one adapter used for all {@link org.eclipse.passage.lic.licenses.model.api.FloatingServer} instances. * @@ -598,8 +642,8 @@ public void dispose() { licensePlanItemProvider.dispose(); if (licensePlanFeatureItemProvider != null) licensePlanFeatureItemProvider.dispose(); - if (licensePackItemProvider != null) - licensePackItemProvider.dispose(); + if (personalLicensePackItemProvider != null) + personalLicensePackItemProvider.dispose(); if (licenseGrantItemProvider != null) licenseGrantItemProvider.dispose(); if (floatingLicensePackItemProvider != null) @@ -610,6 +654,10 @@ public void dispose() { floatingLicenseRequisitesItemProvider.dispose(); if (productRefItemProvider != null) productRefItemProvider.dispose(); + if (userRefItemProvider != null) + userRefItemProvider.dispose(); + if (companyRefItemProvider != null) + companyRefItemProvider.dispose(); if (floatingServerItemProvider != null) floatingServerItemProvider.dispose(); if (userGrantItemProvider != null) diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicensePackItemProvider.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicensePackItemProvider.java new file mode 100644 index 000000000..5f4fa81ee --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicensePackItemProvider.java @@ -0,0 +1,192 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.edit.providers; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; +import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack} object. + * + * + * @generated + */ +public class PersonalLicensePackItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public PersonalLicensePackItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(LicensesPackage.eINSTANCE.getPersonalLicensePack_License()); + childrenFeatures.add(LicensesPackage.eINSTANCE.getPersonalLicensePack_Grants()); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns license.png. + * + * + * + * + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/license.png")); //$NON-NLS-1$ + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * + * + * + * @generated NOT + */ + @Override + public String getText(Object object) { + PersonalLicensePack pack = (PersonalLicensePack) object; + return getString("_UI_LicensePack_text_pattern", new Object[] { //$NON-NLS-1$ + pack.getLicense().getIdentifier(), // + pack.getLicense().getProduct().getIdentifier(), // + pack.getLicense().getProduct().getVersion() }); + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(PersonalLicensePack.class)) { + case LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE: + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + default: + super.notifyChanged(notification); + return; + } + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(LicensesPackage.eINSTANCE.getPersonalLicensePack_License(), + LicensesFactory.eINSTANCE.createPersonalLicenseRequisites())); + + newChildDescriptors.add(createChildParameter(LicensesPackage.eINSTANCE.getPersonalLicensePack_Grants(), + LicensesFactory.eINSTANCE.createLicenseGrant())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return LicensesEditPlugin.INSTANCE; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicenseRequisitesItemProvider.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicenseRequisitesItemProvider.java index 0726d942c..53dd33e4d 100644 --- a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicenseRequisitesItemProvider.java +++ b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/PersonalLicenseRequisitesItemProvider.java @@ -20,7 +20,6 @@ import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; @@ -67,13 +66,12 @@ public List getPropertyDescriptors(Object object) { * @generated */ protected void addUserPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), - getResourceLocator(), getString("_UI_PersonalLicenseRequisites_user_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_PersonalLicenseRequisites_user_feature", //$NON-NLS-1$//$NON-NLS-2$ - "_UI_PersonalLicenseRequisites_type"), //$NON-NLS-1$ - LicensesPackage.eINSTANCE.getPersonalLicenseRequisites_User(), true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_PersonalLicenseRequisites_user_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_PersonalLicenseRequisites_user_feature", //$NON-NLS-1$//$NON-NLS-2$ + "_UI_PersonalLicenseRequisites_type"), //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getPersonalLicenseRequisites_User(), true, false, false, null, null, null)); } /** diff --git a/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/UserRefItemProvider.java b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/UserRefItemProvider.java new file mode 100644 index 000000000..16c218f9f --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.edit/src-gen/org/eclipse/passage/lic/licenses/edit/providers/UserRefItemProvider.java @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.edit.providers; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin; + +import org.eclipse.passage.lic.licenses.model.api.UserRef; + +import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.passage.lic.licenses.model.api.UserRef} object. + * + * + * @generated + */ +public class UserRefItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public UserRefItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addIdentifierPropertyDescriptor(object); + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Identifier feature. + * + * + * @generated + */ + protected void addIdentifierPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_UserRef_identifier_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_UserRef_identifier_feature", //$NON-NLS-1$//$NON-NLS-2$ + "_UI_UserRef_type"), //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getUserRef_Identifier(), true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_UserRef_name_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_UserRef_name_feature", "_UI_UserRef_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LicensesPackage.eINSTANCE.getUserRef_Name(), true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns UserRef.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/UserRef")); //$NON-NLS-1$ + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((UserRef) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_UserRef_type") : //$NON-NLS-1$ + getString("_UI_UserRef_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(UserRef.class)) { + case LicensesPackage.USER_REF__IDENTIFIER: + case LicensesPackage.USER_REF__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + default: + super.notifyChanged(notification); + return; + } + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return LicensesEditPlugin.INSTANCE; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/model/licenses.genmodel b/bundles/org.eclipse.passage.lic.licenses.model/model/licenses.genmodel index 832ce3935..15b6c74cb 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/model/licenses.genmodel +++ b/bundles/org.eclipse.passage.lic.licenses.model/model/licenses.genmodel @@ -23,6 +23,8 @@ + + @@ -48,16 +50,9 @@ - - - - - - - - - - + + + @@ -85,15 +80,24 @@ - + - + + + + + + + + + + diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/CompanyRef.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/CompanyRef.java new file mode 100644 index 000000000..8df2b454d --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/CompanyRef.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.api; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.passage.lic.licenses.CompanyRefDescriptor; + +/** + * + * A representation of the model object 'Company Ref'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getIdentifier Identifier}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getName Name}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getInfo Info}
  • + *
+ * + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getCompanyRef() + * @model superTypes="org.eclipse.passage.lic.licenses.model.api.CompanyRefDescriptor" + * @generated + */ +public interface CompanyRef extends EObject, CompanyRefDescriptor { + /** + * Returns the value of the 'Identifier' attribute. + * + * + * @return the value of the 'Identifier' attribute. + * @see #setIdentifier(String) + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getCompanyRef_Identifier() + * @model required="true" + * @generated + */ + @Override + String getIdentifier(); + + /** + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getIdentifier Identifier}' attribute. + * + * + * @param value the new value of the 'Identifier' attribute. + * @see #getIdentifier() + * @generated + */ + void setIdentifier(String value); + + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getCompanyRef_Name() + * @model required="true" + * @generated + */ + @Override + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Info' attribute. + * + * + * @return the value of the 'Info' attribute. + * @see #setInfo(String) + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getCompanyRef_Info() + * @model required="true" + * @generated + */ + @Override + String getInfo(); + + /** + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getInfo Info}' attribute. + * + * + * @param value the new value of the 'Info' attribute. + * @see #getInfo() + * @generated + */ + void setInfo(String value); + +} // CompanyRef diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/FloatingLicenseRequisites.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/FloatingLicenseRequisites.java index e918b5335..0b2eef328 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/FloatingLicenseRequisites.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/FloatingLicenseRequisites.java @@ -32,26 +32,26 @@ */ public interface FloatingLicenseRequisites extends LicenseRequisites, FloatingLicenseRequisitesDescriptor { /** - * Returns the value of the 'Company' attribute. + * Returns the value of the 'Company' containment reference. * * - * @return the value of the 'Company' attribute. - * @see #setCompany(String) + * @return the value of the 'Company' containment reference. + * @see #setCompany(CompanyRef) * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getFloatingLicenseRequisites_Company() - * @model required="true" + * @model containment="true" required="true" * @generated */ @Override - String getCompany(); + CompanyRef getCompany(); /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites#getCompany Company}' attribute. + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites#getCompany Company}' containment reference. * * - * @param value the new value of the 'Company' attribute. + * @param value the new value of the 'Company' containment reference. * @see #getCompany() * @generated */ - void setCompany(String value); + void setCompany(CompanyRef value); } // FloatingLicenseRequisites diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicenseGrant.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicenseGrant.java index 78fcadeab..ed58c17b5 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicenseGrant.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicenseGrant.java @@ -255,18 +255,18 @@ public interface LicenseGrant extends EObject, LicenseGrantDescriptor { /** * Returns the value of the 'License Pack' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getLicenseGrants License Grants}'. + * It is bidirectional and its opposite is '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getGrants Grants}'. * * * @return the value of the 'License Pack' container reference. - * @see #setLicensePack(LicensePack) + * @see #setLicensePack(PersonalLicensePack) * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicenseGrant_LicensePack() - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getLicenseGrants - * @model opposite="licenseGrants" required="true" transient="false" + * @see org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getGrants + * @model opposite="grants" required="true" transient="false" * @generated */ @Override - LicensePack getLicensePack(); + PersonalLicensePack getLicensePack(); /** * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicenseGrant#getLicensePack License Pack}' container reference. @@ -276,6 +276,6 @@ public interface LicenseGrant extends EObject, LicenseGrantDescriptor { * @see #getLicensePack() * @generated */ - void setLicensePack(LicensePack value); + void setLicensePack(PersonalLicensePack value); } // LicenseGrant diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePack.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePack.java deleted file mode 100644 index 0353b3a23..000000000 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePack.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2021 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.api; - -import java.util.Date; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; - -/** - * - * A representation of the model object 'License Pack'. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getIdentifier Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getIssueDate Issue Date}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserIdentifier User Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserFullName User Full Name}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getRequestIdentifier Request Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getPlanIdentifier Plan Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductIdentifier Product Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductVersion Product Version}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getLicenseGrants License Grants}
  • - *
- * - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack() - * @model superTypes="org.eclipse.passage.lic.licenses.model.api.LicensePackDescriptor" - * @generated - */ -public interface LicensePack extends EObject, LicensePackDescriptor { - /** - * Returns the value of the 'Identifier' attribute. - * - * - * @return the value of the 'Identifier' attribute. - * @see #setIdentifier(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_Identifier() - * @model id="true" - * @generated - */ - @Override - String getIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getIdentifier Identifier}' attribute. - * - * - * @param value the new value of the 'Identifier' attribute. - * @see #getIdentifier() - * @generated - */ - void setIdentifier(String value); - - /** - * Returns the value of the 'Issue Date' attribute. - * - * - * @return the value of the 'Issue Date' attribute. - * @see #setIssueDate(Date) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_IssueDate() - * @model - * @generated - */ - @Override - Date getIssueDate(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getIssueDate Issue Date}' attribute. - * - * - * @param value the new value of the 'Issue Date' attribute. - * @see #getIssueDate() - * @generated - */ - void setIssueDate(Date value); - - /** - * Returns the value of the 'User Identifier' attribute. - * - * - * @return the value of the 'User Identifier' attribute. - * @see #setUserIdentifier(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_UserIdentifier() - * @model required="true" - * @generated - */ - @Override - String getUserIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserIdentifier User Identifier}' attribute. - * - * - * @param value the new value of the 'User Identifier' attribute. - * @see #getUserIdentifier() - * @generated - */ - void setUserIdentifier(String value); - - /** - * Returns the value of the 'User Full Name' attribute. - * - * - * @return the value of the 'User Full Name' attribute. - * @see #setUserFullName(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_UserFullName() - * @model required="true" - * @generated - */ - @Override - String getUserFullName(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserFullName User Full Name}' attribute. - * - * - * @param value the new value of the 'User Full Name' attribute. - * @see #getUserFullName() - * @generated - */ - void setUserFullName(String value); - - /** - * Returns the value of the 'Request Identifier' attribute. - * - * - * @return the value of the 'Request Identifier' attribute. - * @see #setRequestIdentifier(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_RequestIdentifier() - * @model required="true" - * @generated - */ - @Override - String getRequestIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getRequestIdentifier Request Identifier}' attribute. - * - * - * @param value the new value of the 'Request Identifier' attribute. - * @see #getRequestIdentifier() - * @generated - */ - void setRequestIdentifier(String value); - - /** - * Returns the value of the 'Plan Identifier' attribute. - * - * - * @return the value of the 'Plan Identifier' attribute. - * @see #setPlanIdentifier(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_PlanIdentifier() - * @model required="true" - * @generated - */ - @Override - String getPlanIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getPlanIdentifier Plan Identifier}' attribute. - * - * - * @param value the new value of the 'Plan Identifier' attribute. - * @see #getPlanIdentifier() - * @generated - */ - void setPlanIdentifier(String value); - - /** - * Returns the value of the 'Product Identifier' attribute. - * - * - * @return the value of the 'Product Identifier' attribute. - * @see #setProductIdentifier(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_ProductIdentifier() - * @model required="true" - * @generated - */ - @Override - String getProductIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductIdentifier Product Identifier}' attribute. - * - * - * @param value the new value of the 'Product Identifier' attribute. - * @see #getProductIdentifier() - * @generated - */ - void setProductIdentifier(String value); - - /** - * Returns the value of the 'Product Version' attribute. - * - * - * @return the value of the 'Product Version' attribute. - * @see #setProductVersion(String) - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_ProductVersion() - * @model required="true" - * @generated - */ - @Override - String getProductVersion(); - - /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductVersion Product Version}' attribute. - * - * - * @param value the new value of the 'Product Version' attribute. - * @see #getProductVersion() - * @generated - */ - void setProductVersion(String value); - - /** - * Returns the value of the 'License Grants' containment reference list. - * The list contents are of type {@link org.eclipse.passage.lic.licenses.model.api.LicenseGrant}. - * It is bidirectional and its opposite is '{@link org.eclipse.passage.lic.licenses.model.api.LicenseGrant#getLicensePack License Pack}'. - * - * - * @return the value of the 'License Grants' containment reference list. - * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getLicensePack_LicenseGrants() - * @see org.eclipse.passage.lic.licenses.model.api.LicenseGrant#getLicensePack - * @model opposite="licensePack" containment="true" - * @generated - */ - @Override - EList getLicenseGrants(); - -} // LicensePack diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePlan.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePlan.java index 724a02295..a4d498527 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePlan.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/LicensePlan.java @@ -125,7 +125,7 @@ public interface LicensePlan extends EObject, LicensePlanDescriptor { /** * Returns the value of the 'Personal' containment reference list. - * The list contents are of type {@link org.eclipse.passage.lic.licenses.model.api.LicensePack}. + * The list contents are of type {@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack}. * * * @return the value of the 'Personal' containment reference list. @@ -134,7 +134,7 @@ public interface LicensePlan extends EObject, LicensePlanDescriptor { * @generated */ @Override - EList getPersonal(); + EList getPersonal(); /** * Returns the value of the 'Floating' containment reference list. diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicensePack.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicensePack.java new file mode 100644 index 000000000..240f06933 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicensePack.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.api; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; + +/** + * + * A representation of the model object 'Personal License Pack'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getLicense License}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getGrants Grants}
  • + *
+ * + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getPersonalLicensePack() + * @model superTypes="org.eclipse.passage.lic.licenses.model.api.LicensePackDescriptor" + * @generated + */ +public interface PersonalLicensePack extends EObject, PersonalLicensePackDescriptor { + /** + * Returns the value of the 'License' containment reference. + * + * + * @return the value of the 'License' containment reference. + * @see #setLicense(PersonalLicenseRequisites) + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getPersonalLicensePack_License() + * @model containment="true" required="true" + * @generated + */ + PersonalLicenseRequisites getLicense(); + + /** + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getLicense License}' containment reference. + * + * + * @param value the new value of the 'License' containment reference. + * @see #getLicense() + * @generated + */ + void setLicense(PersonalLicenseRequisites value); + + /** + * Returns the value of the 'Grants' containment reference list. + * The list contents are of type {@link org.eclipse.passage.lic.licenses.model.api.LicenseGrant}. + * It is bidirectional and its opposite is '{@link org.eclipse.passage.lic.licenses.model.api.LicenseGrant#getLicensePack License Pack}'. + * + * + * @return the value of the 'Grants' containment reference list. + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getPersonalLicensePack_Grants() + * @see org.eclipse.passage.lic.licenses.model.api.LicenseGrant#getLicensePack + * @model opposite="licensePack" containment="true" + * @generated + */ + EList getGrants(); + +} // PersonalLicensePack diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicenseRequisites.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicenseRequisites.java index b70dda570..dce4cd9a5 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicenseRequisites.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/PersonalLicenseRequisites.java @@ -32,26 +32,26 @@ */ public interface PersonalLicenseRequisites extends LicenseRequisites, PersonalLicenseRequisitesDescriptor { /** - * Returns the value of the 'User' attribute. + * Returns the value of the 'User' containment reference. * * - * @return the value of the 'User' attribute. - * @see #setUser(String) + * @return the value of the 'User' containment reference. + * @see #setUser(UserRef) * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getPersonalLicenseRequisites_User() - * @model required="true" + * @model containment="true" required="true" * @generated */ @Override - String getUser(); + UserRef getUser(); /** - * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites#getUser User}' attribute. + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites#getUser User}' containment reference. * * - * @param value the new value of the 'User' attribute. + * @param value the new value of the 'User' containment reference. * @see #getUser() * @generated */ - void setUser(String value); + void setUser(UserRef value); } // PersonalLicenseRequisites diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/UserRef.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/UserRef.java new file mode 100644 index 000000000..f1e3cb3c2 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/api/UserRef.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.api; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.passage.lic.licenses.UserRefDescriptor; + +/** + * + * A representation of the model object 'User Ref'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.passage.lic.licenses.model.api.UserRef#getIdentifier Identifier}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.api.UserRef#getName Name}
  • + *
+ * + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getUserRef() + * @model superTypes="org.eclipse.passage.lic.licenses.model.api.UserRefDescriptor" + * @generated + */ +public interface UserRef extends EObject, UserRefDescriptor { + /** + * Returns the value of the 'Identifier' attribute. + * + * + * @return the value of the 'Identifier' attribute. + * @see #setIdentifier(String) + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getUserRef_Identifier() + * @model required="true" + * @generated + */ + @Override + String getIdentifier(); + + /** + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.UserRef#getIdentifier Identifier}' attribute. + * + * + * @param value the new value of the 'Identifier' attribute. + * @see #getIdentifier() + * @generated + */ + void setIdentifier(String value); + + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.passage.lic.licenses.model.meta.LicensesPackage#getUserRef_Name() + * @model required="true" + * @generated + */ + @Override + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.passage.lic.licenses.model.api.UserRef#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // UserRef diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/CompanyRefImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/CompanyRefImpl.java new file mode 100644 index 000000000..f4ff141a8 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/CompanyRefImpl.java @@ -0,0 +1,301 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.impl; + +import java.util.Objects; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.passage.lic.licenses.model.api.CompanyRef; + +import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; + +/** + * + * An implementation of the model object 'Company Ref'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.CompanyRefImpl#getIdentifier Identifier}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.CompanyRefImpl#getName Name}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.CompanyRefImpl#getInfo Info}
  • + *
+ * + * @generated + */ +public class CompanyRefImpl extends MinimalEObjectImpl.Container implements CompanyRef { + /** + * The default value of the '{@link #getIdentifier() Identifier}' attribute. + * + * + * @see #getIdentifier() + * @generated + * @ordered + */ + protected static final String IDENTIFIER_EDEFAULT = null; + + /** + * The cached value of the '{@link #getIdentifier() Identifier}' attribute. + * + * + * @see #getIdentifier() + * @generated + * @ordered + */ + private String identifier = IDENTIFIER_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + private String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getInfo() Info}' attribute. + * + * + * @see #getInfo() + * @generated + * @ordered + */ + protected static final String INFO_EDEFAULT = null; + + /** + * The cached value of the '{@link #getInfo() Info}' attribute. + * + * + * @see #getInfo() + * @generated + * @ordered + */ + private String info = INFO_EDEFAULT; + + /** + * + * + * @generated + */ + protected CompanyRefImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LicensesPackage.eINSTANCE.getCompanyRef(); + } + + /** + * + * + * @generated + */ + @Override + public String getIdentifier() { + return identifier; + } + + /** + * + * + * @generated + */ + @Override + public void setIdentifier(String newIdentifier) { + String oldIdentifier = identifier; + identifier = newIdentifier; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.COMPANY_REF__IDENTIFIER, + oldIdentifier, identifier)); + } + } + + /** + * + * + * @generated + */ + @Override + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + @Override + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.COMPANY_REF__NAME, oldName, name)); + } + } + + /** + * + * + * @generated + */ + @Override + public String getInfo() { + return info; + } + + /** + * + * + * @generated + */ + @Override + public void setInfo(String newInfo) { + String oldInfo = info; + info = newInfo; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.COMPANY_REF__INFO, oldInfo, info)); + } + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LicensesPackage.COMPANY_REF__IDENTIFIER: + return getIdentifier(); + case LicensesPackage.COMPANY_REF__NAME: + return getName(); + case LicensesPackage.COMPANY_REF__INFO: + return getInfo(); + default: + return super.eGet(featureID, resolve, coreType); + } + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LicensesPackage.COMPANY_REF__IDENTIFIER: + setIdentifier((String) newValue); + return; + case LicensesPackage.COMPANY_REF__NAME: + setName((String) newValue); + return; + case LicensesPackage.COMPANY_REF__INFO: + setInfo((String) newValue); + return; + default: + super.eSet(featureID, newValue); + return; + } + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LicensesPackage.COMPANY_REF__IDENTIFIER: + setIdentifier(IDENTIFIER_EDEFAULT); + return; + case LicensesPackage.COMPANY_REF__NAME: + setName(NAME_EDEFAULT); + return; + case LicensesPackage.COMPANY_REF__INFO: + setInfo(INFO_EDEFAULT); + return; + default: + super.eUnset(featureID); + return; + } + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LicensesPackage.COMPANY_REF__IDENTIFIER: + return !Objects.equals(IDENTIFIER_EDEFAULT, identifier); + case LicensesPackage.COMPANY_REF__NAME: + return !Objects.equals(NAME_EDEFAULT, name); + case LicensesPackage.COMPANY_REF__INFO: + return !Objects.equals(INFO_EDEFAULT, info); + default: + return super.eIsSet(featureID); + } + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (identifier: "); //$NON-NLS-1$ + result.append(identifier); + result.append(", name: "); //$NON-NLS-1$ + result.append(name); + result.append(", info: "); //$NON-NLS-1$ + result.append(info); + result.append(')'); + return result.toString(); + } + +} //CompanyRefImpl diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/FloatingLicenseRequisitesImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/FloatingLicenseRequisitesImpl.java index a1c82e978..92dc0c00a 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/FloatingLicenseRequisitesImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/FloatingLicenseRequisitesImpl.java @@ -12,14 +12,15 @@ *******************************************************************************/ package org.eclipse.passage.lic.licenses.model.impl; -import java.util.Objects; - import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.passage.lic.licenses.model.api.CompanyRef; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; @@ -39,24 +40,14 @@ */ public class FloatingLicenseRequisitesImpl extends LicenseRequisitesImpl implements FloatingLicenseRequisites { /** - * The default value of the '{@link #getCompany() Company}' attribute. - * - * - * @see #getCompany() - * @generated - * @ordered - */ - protected static final String COMPANY_EDEFAULT = null; - - /** - * The cached value of the '{@link #getCompany() Company}' attribute. + * The cached value of the '{@link #getCompany() Company}' containment reference. * * * @see #getCompany() * @generated * @ordered */ - private String company = COMPANY_EDEFAULT; + protected CompanyRef company; /** * @@ -83,7 +74,7 @@ protected EClass eStaticClass() { * @generated */ @Override - public String getCompany() { + public CompanyRef getCompany() { return company; } @@ -92,13 +83,56 @@ public String getCompany() { * * @generated */ - @Override - public void setCompany(String newCompany) { - String oldCompany = company; + public NotificationChain basicSetCompany(CompanyRef newCompany, NotificationChain msgs) { + CompanyRef oldCompany = company; company = newCompany; if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, + LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY, oldCompany, newCompany); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setCompany(CompanyRef newCompany) { + if (newCompany != company) { + NotificationChain msgs = null; + if (company != null) + msgs = ((InternalEObject) company).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE - LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY, null, msgs); + if (newCompany != null) + msgs = ((InternalEObject) newCompany).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE - LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY, null, msgs); + msgs = basicSetCompany(newCompany, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY, - oldCompany, company)); + newCompany, newCompany)); + } + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY: + return basicSetCompany(null, msgs); + default: + return super.eInverseRemove(otherEnd, featureID, msgs); } } @@ -126,7 +160,7 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { public void eSet(int featureID, Object newValue) { switch (featureID) { case LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY: - setCompany((String) newValue); + setCompany((CompanyRef) newValue); return; default: super.eSet(featureID, newValue); @@ -143,7 +177,7 @@ public void eSet(int featureID, Object newValue) { public void eUnset(int featureID) { switch (featureID) { case LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY: - setCompany(COMPANY_EDEFAULT); + setCompany((CompanyRef) null); return; default: super.eUnset(featureID); @@ -160,27 +194,10 @@ public void eUnset(int featureID) { public boolean eIsSet(int featureID) { switch (featureID) { case LicensesPackage.FLOATING_LICENSE_REQUISITES__COMPANY: - return !Objects.equals(COMPANY_EDEFAULT, company); + return company != null; default: return super.eIsSet(featureID); } } - /** - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - StringBuilder result = new StringBuilder(super.toString()); - result.append(" (company: "); //$NON-NLS-1$ - result.append(company); - result.append(')'); - return result.toString(); - } - } //FloatingLicenseRequisitesImpl diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicenseGrantImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicenseGrantImpl.java index 050713a5d..5e2f6a8aa 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicenseGrantImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicenseGrantImpl.java @@ -27,8 +27,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; - +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; /** @@ -484,11 +483,11 @@ public void setCapacity(int newCapacity) { * @generated */ @Override - public LicensePack getLicensePack() { + public PersonalLicensePack getLicensePack() { if (eContainerFeatureID() != LicensesPackage.LICENSE_GRANT__LICENSE_PACK) { return null; } - return (LicensePack) eInternalContainer(); + return (PersonalLicensePack) eInternalContainer(); } /** @@ -496,7 +495,7 @@ public LicensePack getLicensePack() { * * @generated */ - public NotificationChain basicSetLicensePack(LicensePack newLicensePack, NotificationChain msgs) { + public NotificationChain basicSetLicensePack(PersonalLicensePack newLicensePack, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject) newLicensePack, LicensesPackage.LICENSE_GRANT__LICENSE_PACK, msgs); return msgs; } @@ -507,7 +506,7 @@ public NotificationChain basicSetLicensePack(LicensePack newLicensePack, Notific * @generated */ @Override - public void setLicensePack(LicensePack newLicensePack) { + public void setLicensePack(PersonalLicensePack newLicensePack) { if (newLicensePack != eInternalContainer() || (eContainerFeatureID() != LicensesPackage.LICENSE_GRANT__LICENSE_PACK && newLicensePack != null)) { if (EcoreUtil.isAncestor(this, newLicensePack)) { @@ -519,7 +518,7 @@ public void setLicensePack(LicensePack newLicensePack) { } if (newLicensePack != null) msgs = ((InternalEObject) newLicensePack).eInverseAdd(this, - LicensesPackage.LICENSE_PACK__LICENSE_GRANTS, LicensePack.class, msgs); + LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS, PersonalLicensePack.class, msgs); msgs = basicSetLicensePack(newLicensePack, msgs); if (msgs != null) msgs.dispatch(); @@ -541,7 +540,7 @@ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, No if (eInternalContainer() != null) { msgs = eBasicRemoveFromContainer(msgs); } - return basicSetLicensePack((LicensePack) otherEnd, msgs); + return basicSetLicensePack((PersonalLicensePack) otherEnd, msgs); default: return super.eInverseAdd(otherEnd, featureID, msgs); } @@ -571,8 +570,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case LicensesPackage.LICENSE_GRANT__LICENSE_PACK: - return eInternalContainer().eInverseRemove(this, LicensesPackage.LICENSE_PACK__LICENSE_GRANTS, - LicensePack.class, msgs); + return eInternalContainer().eInverseRemove(this, LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS, + PersonalLicensePack.class, msgs); default: return super.eBasicRemoveFromContainerFeature(msgs); } @@ -647,7 +646,7 @@ public void eSet(int featureID, Object newValue) { setCapacity((Integer) newValue); return; case LicensesPackage.LICENSE_GRANT__LICENSE_PACK: - setLicensePack((LicensePack) newValue); + setLicensePack((PersonalLicensePack) newValue); return; default: super.eSet(featureID, newValue); @@ -691,7 +690,7 @@ public void eUnset(int featureID) { setCapacity(CAPACITY_EDEFAULT); return; case LicensesPackage.LICENSE_GRANT__LICENSE_PACK: - setLicensePack((LicensePack) null); + setLicensePack((PersonalLicensePack) null); return; default: super.eUnset(featureID); diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePackImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePackImpl.java deleted file mode 100644 index fa505d4e1..000000000 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePackImpl.java +++ /dev/null @@ -1,671 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2021 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.impl; - -import java.util.Collection; -import java.util.Date; -import java.util.Objects; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; - -import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; - -/** - * - * An implementation of the model object 'License Pack'. - * - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getIdentifier Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getIssueDate Issue Date}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getUserIdentifier User Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getUserFullName User Full Name}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getRequestIdentifier Request Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getPlanIdentifier Plan Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getProductIdentifier Product Identifier}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getProductVersion Product Version}
  • - *
  • {@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl#getLicenseGrants License Grants}
  • - *
- * - * @generated - */ -public class LicensePackImpl extends MinimalEObjectImpl.Container implements LicensePack { - /** - * The default value of the '{@link #getIdentifier() Identifier}' attribute. - * - * - * @see #getIdentifier() - * @generated - * @ordered - */ - protected static final String IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getIdentifier() Identifier}' attribute. - * - * - * @see #getIdentifier() - * @generated - * @ordered - */ - private String identifier = IDENTIFIER_EDEFAULT; - - /** - * The default value of the '{@link #getIssueDate() Issue Date}' attribute. - * - * - * @see #getIssueDate() - * @generated - * @ordered - */ - protected static final Date ISSUE_DATE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getIssueDate() Issue Date}' attribute. - * - * - * @see #getIssueDate() - * @generated - * @ordered - */ - private Date issueDate = ISSUE_DATE_EDEFAULT; - - /** - * The default value of the '{@link #getUserIdentifier() User Identifier}' attribute. - * - * - * @see #getUserIdentifier() - * @generated - * @ordered - */ - protected static final String USER_IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getUserIdentifier() User Identifier}' attribute. - * - * - * @see #getUserIdentifier() - * @generated - * @ordered - */ - private String userIdentifier = USER_IDENTIFIER_EDEFAULT; - - /** - * The default value of the '{@link #getUserFullName() User Full Name}' attribute. - * - * - * @see #getUserFullName() - * @generated - * @ordered - */ - protected static final String USER_FULL_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getUserFullName() User Full Name}' attribute. - * - * - * @see #getUserFullName() - * @generated - * @ordered - */ - private String userFullName = USER_FULL_NAME_EDEFAULT; - - /** - * The default value of the '{@link #getRequestIdentifier() Request Identifier}' attribute. - * - * - * @see #getRequestIdentifier() - * @generated - * @ordered - */ - protected static final String REQUEST_IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getRequestIdentifier() Request Identifier}' attribute. - * - * - * @see #getRequestIdentifier() - * @generated - * @ordered - */ - private String requestIdentifier = REQUEST_IDENTIFIER_EDEFAULT; - - /** - * The default value of the '{@link #getPlanIdentifier() Plan Identifier}' attribute. - * - * - * @see #getPlanIdentifier() - * @generated - * @ordered - */ - protected static final String PLAN_IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPlanIdentifier() Plan Identifier}' attribute. - * - * - * @see #getPlanIdentifier() - * @generated - * @ordered - */ - private String planIdentifier = PLAN_IDENTIFIER_EDEFAULT; - - /** - * The default value of the '{@link #getProductIdentifier() Product Identifier}' attribute. - * - * - * @see #getProductIdentifier() - * @generated - * @ordered - */ - protected static final String PRODUCT_IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getProductIdentifier() Product Identifier}' attribute. - * - * - * @see #getProductIdentifier() - * @generated - * @ordered - */ - private String productIdentifier = PRODUCT_IDENTIFIER_EDEFAULT; - - /** - * The default value of the '{@link #getProductVersion() Product Version}' attribute. - * - * - * @see #getProductVersion() - * @generated - * @ordered - */ - protected static final String PRODUCT_VERSION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getProductVersion() Product Version}' attribute. - * - * - * @see #getProductVersion() - * @generated - * @ordered - */ - private String productVersion = PRODUCT_VERSION_EDEFAULT; - - /** - * The cached value of the '{@link #getLicenseGrants() License Grants}' containment reference list. - * - * - * @see #getLicenseGrants() - * @generated - * @ordered - */ - protected EList licenseGrants; - - /** - * - * - * @generated - */ - protected LicensePackImpl() { - super(); - } - - /** - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return LicensesPackage.eINSTANCE.getLicensePack(); - } - - /** - * - * - * @generated - */ - @Override - public String getIdentifier() { - return identifier; - } - - /** - * - * - * @generated - */ - @Override - public void setIdentifier(String newIdentifier) { - String oldIdentifier = identifier; - identifier = newIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__IDENTIFIER, - oldIdentifier, identifier)); - } - } - - /** - * - * - * @generated - */ - @Override - public Date getIssueDate() { - return issueDate; - } - - /** - * - * - * @generated - */ - @Override - public void setIssueDate(Date newIssueDate) { - Date oldIssueDate = issueDate; - issueDate = newIssueDate; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__ISSUE_DATE, - oldIssueDate, issueDate)); - } - } - - /** - * - * - * @generated - */ - @Override - public String getUserIdentifier() { - return userIdentifier; - } - - /** - * - * - * @generated - */ - @Override - public void setUserIdentifier(String newUserIdentifier) { - String oldUserIdentifier = userIdentifier; - userIdentifier = newUserIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__USER_IDENTIFIER, - oldUserIdentifier, userIdentifier)); - } - } - - /** - * - * - * @generated - */ - @Override - public String getUserFullName() { - return userFullName; - } - - /** - * - * - * @generated - */ - @Override - public void setUserFullName(String newUserFullName) { - String oldUserFullName = userFullName; - userFullName = newUserFullName; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__USER_FULL_NAME, - oldUserFullName, userFullName)); - } - } - - /** - * - * - * @generated - */ - @Override - public String getRequestIdentifier() { - return requestIdentifier; - } - - /** - * - * - * @generated - */ - @Override - public void setRequestIdentifier(String newRequestIdentifier) { - String oldRequestIdentifier = requestIdentifier; - requestIdentifier = newRequestIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__REQUEST_IDENTIFIER, - oldRequestIdentifier, requestIdentifier)); - } - } - - /** - * - * - * @generated - */ - @Override - public String getPlanIdentifier() { - return planIdentifier; - } - - /** - * - * - * @generated - */ - @Override - public void setPlanIdentifier(String newPlanIdentifier) { - String oldPlanIdentifier = planIdentifier; - planIdentifier = newPlanIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__PLAN_IDENTIFIER, - oldPlanIdentifier, planIdentifier)); - } - } - - /** - * - * - * @generated - */ - @Override - public String getProductIdentifier() { - return productIdentifier; - } - - /** - * - * - * @generated - */ - @Override - public void setProductIdentifier(String newProductIdentifier) { - String oldProductIdentifier = productIdentifier; - productIdentifier = newProductIdentifier; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__PRODUCT_IDENTIFIER, - oldProductIdentifier, productIdentifier)); - } - } - - /** - * - * - * @generated - */ - @Override - public String getProductVersion() { - return productVersion; - } - - /** - * - * - * @generated - */ - @Override - public void setProductVersion(String newProductVersion) { - String oldProductVersion = productVersion; - productVersion = newProductVersion; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.LICENSE_PACK__PRODUCT_VERSION, - oldProductVersion, productVersion)); - } - } - - /** - * - * - * @generated - */ - @Override - public EList getLicenseGrants() { - if (licenseGrants == null) { - licenseGrants = new EObjectContainmentWithInverseEList(LicenseGrant.class, this, - LicensesPackage.LICENSE_PACK__LICENSE_GRANTS, LicensesPackage.LICENSE_GRANT__LICENSE_PACK); - } - return licenseGrants; - } - - /** - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - return ((InternalEList) (InternalEList) getLicenseGrants()).basicAdd(otherEnd, msgs); - default: - return super.eInverseAdd(otherEnd, featureID, msgs); - } - } - - /** - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - return ((InternalEList) getLicenseGrants()).basicRemove(otherEnd, msgs); - default: - return super.eInverseRemove(otherEnd, featureID, msgs); - } - } - - /** - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case LicensesPackage.LICENSE_PACK__IDENTIFIER: - return getIdentifier(); - case LicensesPackage.LICENSE_PACK__ISSUE_DATE: - return getIssueDate(); - case LicensesPackage.LICENSE_PACK__USER_IDENTIFIER: - return getUserIdentifier(); - case LicensesPackage.LICENSE_PACK__USER_FULL_NAME: - return getUserFullName(); - case LicensesPackage.LICENSE_PACK__REQUEST_IDENTIFIER: - return getRequestIdentifier(); - case LicensesPackage.LICENSE_PACK__PLAN_IDENTIFIER: - return getPlanIdentifier(); - case LicensesPackage.LICENSE_PACK__PRODUCT_IDENTIFIER: - return getProductIdentifier(); - case LicensesPackage.LICENSE_PACK__PRODUCT_VERSION: - return getProductVersion(); - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - return getLicenseGrants(); - default: - return super.eGet(featureID, resolve, coreType); - } - } - - /** - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case LicensesPackage.LICENSE_PACK__IDENTIFIER: - setIdentifier((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__ISSUE_DATE: - setIssueDate((Date) newValue); - return; - case LicensesPackage.LICENSE_PACK__USER_IDENTIFIER: - setUserIdentifier((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__USER_FULL_NAME: - setUserFullName((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__REQUEST_IDENTIFIER: - setRequestIdentifier((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__PLAN_IDENTIFIER: - setPlanIdentifier((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__PRODUCT_IDENTIFIER: - setProductIdentifier((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__PRODUCT_VERSION: - setProductVersion((String) newValue); - return; - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - getLicenseGrants().clear(); - getLicenseGrants().addAll((Collection) newValue); - return; - default: - super.eSet(featureID, newValue); - return; - } - } - - /** - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case LicensesPackage.LICENSE_PACK__IDENTIFIER: - setIdentifier(IDENTIFIER_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__ISSUE_DATE: - setIssueDate(ISSUE_DATE_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__USER_IDENTIFIER: - setUserIdentifier(USER_IDENTIFIER_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__USER_FULL_NAME: - setUserFullName(USER_FULL_NAME_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__REQUEST_IDENTIFIER: - setRequestIdentifier(REQUEST_IDENTIFIER_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__PLAN_IDENTIFIER: - setPlanIdentifier(PLAN_IDENTIFIER_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__PRODUCT_IDENTIFIER: - setProductIdentifier(PRODUCT_IDENTIFIER_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__PRODUCT_VERSION: - setProductVersion(PRODUCT_VERSION_EDEFAULT); - return; - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - getLicenseGrants().clear(); - return; - default: - super.eUnset(featureID); - return; - } - } - - /** - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case LicensesPackage.LICENSE_PACK__IDENTIFIER: - return !Objects.equals(IDENTIFIER_EDEFAULT, identifier); - case LicensesPackage.LICENSE_PACK__ISSUE_DATE: - return !Objects.equals(ISSUE_DATE_EDEFAULT, issueDate); - case LicensesPackage.LICENSE_PACK__USER_IDENTIFIER: - return !Objects.equals(USER_IDENTIFIER_EDEFAULT, userIdentifier); - case LicensesPackage.LICENSE_PACK__USER_FULL_NAME: - return !Objects.equals(USER_FULL_NAME_EDEFAULT, userFullName); - case LicensesPackage.LICENSE_PACK__REQUEST_IDENTIFIER: - return !Objects.equals(REQUEST_IDENTIFIER_EDEFAULT, requestIdentifier); - case LicensesPackage.LICENSE_PACK__PLAN_IDENTIFIER: - return !Objects.equals(PLAN_IDENTIFIER_EDEFAULT, planIdentifier); - case LicensesPackage.LICENSE_PACK__PRODUCT_IDENTIFIER: - return !Objects.equals(PRODUCT_IDENTIFIER_EDEFAULT, productIdentifier); - case LicensesPackage.LICENSE_PACK__PRODUCT_VERSION: - return !Objects.equals(PRODUCT_VERSION_EDEFAULT, productVersion); - case LicensesPackage.LICENSE_PACK__LICENSE_GRANTS: - return licenseGrants != null && !licenseGrants.isEmpty(); - default: - return super.eIsSet(featureID); - } - } - - /** - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - StringBuilder result = new StringBuilder(super.toString()); - result.append(" (identifier: "); //$NON-NLS-1$ - result.append(identifier); - result.append(", issueDate: "); //$NON-NLS-1$ - result.append(issueDate); - result.append(", userIdentifier: "); //$NON-NLS-1$ - result.append(userIdentifier); - result.append(", userFullName: "); //$NON-NLS-1$ - result.append(userFullName); - result.append(", requestIdentifier: "); //$NON-NLS-1$ - result.append(requestIdentifier); - result.append(", planIdentifier: "); //$NON-NLS-1$ - result.append(planIdentifier); - result.append(", productIdentifier: "); //$NON-NLS-1$ - result.append(productIdentifier); - result.append(", productVersion: "); //$NON-NLS-1$ - result.append(productVersion); - result.append(')'); - return result.toString(); - } - -} //LicensePackImpl diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePlanImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePlanImpl.java index 233a0da17..b338ef139 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePlanImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensePlanImpl.java @@ -32,9 +32,9 @@ import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; import org.eclipse.passage.lic.licenses.model.api.LicensePlan; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; /** @@ -134,7 +134,7 @@ public class LicensePlanImpl extends MinimalEObjectImpl.Container implements Lic * @generated * @ordered */ - protected EList personal; + protected EList personal; /** * The cached value of the '{@link #getFloating() Floating}' containment reference list. @@ -259,9 +259,9 @@ public EList getLicensePlanFeatures() { * @generated */ @Override - public EList getPersonal() { + public EList getPersonal() { if (personal == null) { - personal = new EObjectContainmentEList(LicensePack.class, this, + personal = new EObjectContainmentEList(PersonalLicensePack.class, this, LicensesPackage.LICENSE_PLAN__PERSONAL); } return personal; @@ -349,7 +349,7 @@ public void eSet(int featureID, Object newValue) { return; case LicensesPackage.LICENSE_PLAN__PERSONAL: getPersonal().clear(); - getPersonal().addAll((Collection) newValue); + getPersonal().addAll((Collection) newValue); return; case LicensesPackage.LICENSE_PLAN__FLOATING: getFloating().clear(); diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesFactoryImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesFactoryImpl.java index d9896cdd2..7401ec834 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesFactoryImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesFactoryImpl.java @@ -73,8 +73,8 @@ public EObject create(EClass eClass) { return createLicensePlan(); case LicensesPackage.LICENSE_PLAN_FEATURE: return createLicensePlanFeature(); - case LicensesPackage.LICENSE_PACK: - return createLicensePack(); + case LicensesPackage.PERSONAL_LICENSE_PACK: + return createPersonalLicensePack(); case LicensesPackage.LICENSE_GRANT: return createLicenseGrant(); case LicensesPackage.FLOATING_LICENSE_PACK: @@ -85,6 +85,10 @@ public EObject create(EClass eClass) { return createFloatingLicenseRequisites(); case LicensesPackage.PRODUCT_REF: return createProductRef(); + case LicensesPackage.USER_REF: + return createUserRef(); + case LicensesPackage.COMPANY_REF: + return createCompanyRef(); case LicensesPackage.FLOATING_SERVER: return createFloatingServer(); case LicensesPackage.USER_GRANT: @@ -136,9 +140,9 @@ public LicensePlanFeature createLicensePlanFeature() { * @generated */ @Override - public LicensePack createLicensePack() { - LicensePackImpl licensePack = new LicensePackImpl(); - return licensePack; + public PersonalLicensePack createPersonalLicensePack() { + PersonalLicensePackImpl personalLicensePack = new PersonalLicensePackImpl(); + return personalLicensePack; } /** @@ -196,6 +200,28 @@ public ProductRef createProductRef() { return productRef; } + /** + * + * + * @generated + */ + @Override + public UserRef createUserRef() { + UserRefImpl userRef = new UserRefImpl(); + return userRef; + } + + /** + * + * + * @generated + */ + @Override + public CompanyRef createCompanyRef() { + CompanyRefImpl companyRef = new CompanyRefImpl(); + return companyRef; + } + /** * * diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesPackageImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesPackageImpl.java index 3c91dd66e..f13aa2863 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesPackageImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/LicensesPackageImpl.java @@ -19,23 +19,26 @@ import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.passage.lic.licenses.CompanyRefDescriptor; import org.eclipse.passage.lic.licenses.EvaluationInstructionsDescriptor; import org.eclipse.passage.lic.licenses.FeatureGrantDescriptor; import org.eclipse.passage.lic.licenses.FloatingLicensePackDescriptor; import org.eclipse.passage.lic.licenses.FloatingLicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.FloatingServerDescriptor; import org.eclipse.passage.lic.licenses.LicenseGrantDescriptor; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; import org.eclipse.passage.lic.licenses.LicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.PersonalLicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.ProductRefDescriptor; import org.eclipse.passage.lic.licenses.UserGrantDescriptor; +import org.eclipse.passage.lic.licenses.UserRefDescriptor; import org.eclipse.passage.lic.licenses.ValidityPeriodClosedDescriptor; import org.eclipse.passage.lic.licenses.ValidityPeriodDescriptor; import org.eclipse.passage.lic.licenses.VersionMatchDescriptor; +import org.eclipse.passage.lic.licenses.model.api.CompanyRef; import org.eclipse.passage.lic.licenses.model.api.EvaluationInstructions; import org.eclipse.passage.lic.licenses.model.api.FeatureGrant; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; @@ -45,13 +48,14 @@ import org.eclipse.passage.lic.licenses.model.api.FloatingServerConnection; import org.eclipse.passage.lic.licenses.model.api.GrantAcqisition; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; import org.eclipse.passage.lic.licenses.model.api.LicensePlan; import org.eclipse.passage.lic.licenses.model.api.LicensePlanFeature; import org.eclipse.passage.lic.licenses.model.api.LicenseRequisites; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; import org.eclipse.passage.lic.licenses.model.api.ProductRef; import org.eclipse.passage.lic.licenses.model.api.UserGrant; +import org.eclipse.passage.lic.licenses.model.api.UserRef; import org.eclipse.passage.lic.licenses.model.api.ValidityPeriod; import org.eclipse.passage.lic.licenses.model.api.ValidityPeriodClosed; import org.eclipse.passage.lic.licenses.model.api.VersionMatch; @@ -101,6 +105,20 @@ public class LicensesPackageImpl extends EPackageImpl implements LicensesPackage */ private EClass productRefDescriptorEClass = null; + /** + * + * + * @generated + */ + private EClass userRefDescriptorEClass = null; + + /** + * + * + * @generated + */ + private EClass companyRefDescriptorEClass = null; + /** * * @@ -197,7 +215,7 @@ public class LicensesPackageImpl extends EPackageImpl implements LicensesPackage * * @generated */ - private EClass licensePackEClass = null; + private EClass personalLicensePackEClass = null; /** * @@ -241,6 +259,20 @@ public class LicensesPackageImpl extends EPackageImpl implements LicensesPackage */ private EClass productRefEClass = null; + /** + * + * + * @generated + */ + private EClass userRefEClass = null; + + /** + * + * + * @generated + */ + private EClass companyRefEClass = null; + /** * * @@ -425,6 +457,26 @@ public EClass getProductRefDescriptor() { return productRefDescriptorEClass; } + /** + * + * + * @generated + */ + @Override + public EClass getUserRefDescriptor() { + return userRefDescriptorEClass; + } + + /** + * + * + * @generated + */ + @Override + public EClass getCompanyRefDescriptor() { + return companyRefDescriptorEClass; + } + /** * * @@ -661,8 +713,8 @@ public EReference getLicensePlanFeature_LicensePlan() { * @generated */ @Override - public EClass getLicensePack() { - return licensePackEClass; + public EClass getPersonalLicensePack() { + return personalLicensePackEClass; } /** @@ -671,8 +723,8 @@ public EClass getLicensePack() { * @generated */ @Override - public EAttribute getLicensePack_Identifier() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(0); + public EReference getPersonalLicensePack_License() { + return (EReference) personalLicensePackEClass.getEStructuralFeatures().get(0); } /** @@ -681,8 +733,8 @@ public EAttribute getLicensePack_Identifier() { * @generated */ @Override - public EAttribute getLicensePack_IssueDate() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(1); + public EReference getPersonalLicensePack_Grants() { + return (EReference) personalLicensePackEClass.getEStructuralFeatures().get(1); } /** @@ -691,8 +743,8 @@ public EAttribute getLicensePack_IssueDate() { * @generated */ @Override - public EAttribute getLicensePack_UserIdentifier() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(2); + public EClass getLicenseGrant() { + return licenseGrantEClass; } /** @@ -701,8 +753,8 @@ public EAttribute getLicensePack_UserIdentifier() { * @generated */ @Override - public EAttribute getLicensePack_UserFullName() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(3); + public EAttribute getLicenseGrant_Identifier() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(0); } /** @@ -711,8 +763,8 @@ public EAttribute getLicensePack_UserFullName() { * @generated */ @Override - public EAttribute getLicensePack_RequestIdentifier() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(4); + public EAttribute getLicenseGrant_FeatureIdentifier() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(1); } /** @@ -721,8 +773,8 @@ public EAttribute getLicensePack_RequestIdentifier() { * @generated */ @Override - public EAttribute getLicensePack_PlanIdentifier() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(5); + public EAttribute getLicenseGrant_MatchVersion() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(2); } /** @@ -731,8 +783,8 @@ public EAttribute getLicensePack_PlanIdentifier() { * @generated */ @Override - public EAttribute getLicensePack_ProductIdentifier() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(6); + public EAttribute getLicenseGrant_MatchRule() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(3); } /** @@ -741,8 +793,8 @@ public EAttribute getLicensePack_ProductIdentifier() { * @generated */ @Override - public EAttribute getLicensePack_ProductVersion() { - return (EAttribute) licensePackEClass.getEStructuralFeatures().get(7); + public EAttribute getLicenseGrant_ValidFrom() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(4); } /** @@ -751,8 +803,8 @@ public EAttribute getLicensePack_ProductVersion() { * @generated */ @Override - public EReference getLicensePack_LicenseGrants() { - return (EReference) licensePackEClass.getEStructuralFeatures().get(8); + public EAttribute getLicenseGrant_ValidUntil() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(5); } /** @@ -761,8 +813,8 @@ public EReference getLicensePack_LicenseGrants() { * @generated */ @Override - public EClass getLicenseGrant() { - return licenseGrantEClass; + public EAttribute getLicenseGrant_ConditionType() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(6); } /** @@ -771,8 +823,8 @@ public EClass getLicenseGrant() { * @generated */ @Override - public EAttribute getLicenseGrant_Identifier() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(0); + public EAttribute getLicenseGrant_ConditionExpression() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(7); } /** @@ -781,8 +833,8 @@ public EAttribute getLicenseGrant_Identifier() { * @generated */ @Override - public EAttribute getLicenseGrant_FeatureIdentifier() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(1); + public EAttribute getLicenseGrant_Capacity() { + return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(8); } /** @@ -791,8 +843,8 @@ public EAttribute getLicenseGrant_FeatureIdentifier() { * @generated */ @Override - public EAttribute getLicenseGrant_MatchVersion() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(2); + public EReference getLicenseGrant_LicensePack() { + return (EReference) licenseGrantEClass.getEStructuralFeatures().get(9); } /** @@ -801,8 +853,8 @@ public EAttribute getLicenseGrant_MatchVersion() { * @generated */ @Override - public EAttribute getLicenseGrant_MatchRule() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(3); + public EClass getFloatingLicensePack() { + return floatingLicensePackEClass; } /** @@ -811,8 +863,8 @@ public EAttribute getLicenseGrant_MatchRule() { * @generated */ @Override - public EAttribute getLicenseGrant_ValidFrom() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(4); + public EReference getFloatingLicensePack_License() { + return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(0); } /** @@ -821,8 +873,8 @@ public EAttribute getLicenseGrant_ValidFrom() { * @generated */ @Override - public EAttribute getLicenseGrant_ValidUntil() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(5); + public EReference getFloatingLicensePack_Host() { + return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(1); } /** @@ -831,8 +883,8 @@ public EAttribute getLicenseGrant_ValidUntil() { * @generated */ @Override - public EAttribute getLicenseGrant_ConditionType() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(6); + public EReference getFloatingLicensePack_Users() { + return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(2); } /** @@ -841,8 +893,8 @@ public EAttribute getLicenseGrant_ConditionType() { * @generated */ @Override - public EAttribute getLicenseGrant_ConditionExpression() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(7); + public EReference getFloatingLicensePack_Features() { + return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(3); } /** @@ -851,8 +903,8 @@ public EAttribute getLicenseGrant_ConditionExpression() { * @generated */ @Override - public EAttribute getLicenseGrant_Capacity() { - return (EAttribute) licenseGrantEClass.getEStructuralFeatures().get(8); + public EClass getLicenseRequisites() { + return licenseRequisitesEClass; } /** @@ -861,8 +913,8 @@ public EAttribute getLicenseGrant_Capacity() { * @generated */ @Override - public EReference getLicenseGrant_LicensePack() { - return (EReference) licenseGrantEClass.getEStructuralFeatures().get(9); + public EAttribute getLicenseRequisites_Identifier() { + return (EAttribute) licenseRequisitesEClass.getEStructuralFeatures().get(0); } /** @@ -871,8 +923,8 @@ public EReference getLicenseGrant_LicensePack() { * @generated */ @Override - public EClass getFloatingLicensePack() { - return floatingLicensePackEClass; + public EAttribute getLicenseRequisites_IssueDate() { + return (EAttribute) licenseRequisitesEClass.getEStructuralFeatures().get(1); } /** @@ -881,8 +933,8 @@ public EClass getFloatingLicensePack() { * @generated */ @Override - public EReference getFloatingLicensePack_License() { - return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(0); + public EAttribute getLicenseRequisites_Plan() { + return (EAttribute) licenseRequisitesEClass.getEStructuralFeatures().get(2); } /** @@ -891,8 +943,8 @@ public EReference getFloatingLicensePack_License() { * @generated */ @Override - public EReference getFloatingLicensePack_Host() { - return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(1); + public EReference getLicenseRequisites_Product() { + return (EReference) licenseRequisitesEClass.getEStructuralFeatures().get(3); } /** @@ -901,8 +953,8 @@ public EReference getFloatingLicensePack_Host() { * @generated */ @Override - public EReference getFloatingLicensePack_Users() { - return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(2); + public EReference getLicenseRequisites_Valid() { + return (EReference) licenseRequisitesEClass.getEStructuralFeatures().get(4); } /** @@ -911,8 +963,8 @@ public EReference getFloatingLicensePack_Users() { * @generated */ @Override - public EReference getFloatingLicensePack_Features() { - return (EReference) floatingLicensePackEClass.getEStructuralFeatures().get(3); + public EClass getPersonalLicenseRequisites() { + return personalLicenseRequisitesEClass; } /** @@ -921,8 +973,8 @@ public EReference getFloatingLicensePack_Features() { * @generated */ @Override - public EClass getLicenseRequisites() { - return licenseRequisitesEClass; + public EReference getPersonalLicenseRequisites_User() { + return (EReference) personalLicenseRequisitesEClass.getEStructuralFeatures().get(0); } /** @@ -931,8 +983,8 @@ public EClass getLicenseRequisites() { * @generated */ @Override - public EAttribute getLicenseRequisites_Identifier() { - return (EAttribute) licenseRequisitesEClass.getEStructuralFeatures().get(0); + public EClass getFloatingLicenseRequisites() { + return floatingLicenseRequisitesEClass; } /** @@ -941,8 +993,8 @@ public EAttribute getLicenseRequisites_Identifier() { * @generated */ @Override - public EAttribute getLicenseRequisites_IssueDate() { - return (EAttribute) licenseRequisitesEClass.getEStructuralFeatures().get(1); + public EReference getFloatingLicenseRequisites_Company() { + return (EReference) floatingLicenseRequisitesEClass.getEStructuralFeatures().get(0); } /** @@ -951,8 +1003,8 @@ public EAttribute getLicenseRequisites_IssueDate() { * @generated */ @Override - public EAttribute getLicenseRequisites_Plan() { - return (EAttribute) licenseRequisitesEClass.getEStructuralFeatures().get(2); + public EClass getProductRef() { + return productRefEClass; } /** @@ -961,8 +1013,8 @@ public EAttribute getLicenseRequisites_Plan() { * @generated */ @Override - public EReference getLicenseRequisites_Product() { - return (EReference) licenseRequisitesEClass.getEStructuralFeatures().get(3); + public EAttribute getProductRef_Identifier() { + return (EAttribute) productRefEClass.getEStructuralFeatures().get(0); } /** @@ -971,8 +1023,8 @@ public EReference getLicenseRequisites_Product() { * @generated */ @Override - public EReference getLicenseRequisites_Valid() { - return (EReference) licenseRequisitesEClass.getEStructuralFeatures().get(4); + public EAttribute getProductRef_Version() { + return (EAttribute) productRefEClass.getEStructuralFeatures().get(1); } /** @@ -981,8 +1033,8 @@ public EReference getLicenseRequisites_Valid() { * @generated */ @Override - public EClass getPersonalLicenseRequisites() { - return personalLicenseRequisitesEClass; + public EClass getUserRef() { + return userRefEClass; } /** @@ -991,8 +1043,8 @@ public EClass getPersonalLicenseRequisites() { * @generated */ @Override - public EAttribute getPersonalLicenseRequisites_User() { - return (EAttribute) personalLicenseRequisitesEClass.getEStructuralFeatures().get(0); + public EAttribute getUserRef_Identifier() { + return (EAttribute) userRefEClass.getEStructuralFeatures().get(0); } /** @@ -1001,8 +1053,8 @@ public EAttribute getPersonalLicenseRequisites_User() { * @generated */ @Override - public EClass getFloatingLicenseRequisites() { - return floatingLicenseRequisitesEClass; + public EAttribute getUserRef_Name() { + return (EAttribute) userRefEClass.getEStructuralFeatures().get(1); } /** @@ -1011,8 +1063,8 @@ public EClass getFloatingLicenseRequisites() { * @generated */ @Override - public EAttribute getFloatingLicenseRequisites_Company() { - return (EAttribute) floatingLicenseRequisitesEClass.getEStructuralFeatures().get(0); + public EClass getCompanyRef() { + return companyRefEClass; } /** @@ -1021,8 +1073,8 @@ public EAttribute getFloatingLicenseRequisites_Company() { * @generated */ @Override - public EClass getProductRef() { - return productRefEClass; + public EAttribute getCompanyRef_Identifier() { + return (EAttribute) companyRefEClass.getEStructuralFeatures().get(0); } /** @@ -1031,8 +1083,8 @@ public EClass getProductRef() { * @generated */ @Override - public EAttribute getProductRef_Identifier() { - return (EAttribute) productRefEClass.getEStructuralFeatures().get(0); + public EAttribute getCompanyRef_Name() { + return (EAttribute) companyRefEClass.getEStructuralFeatures().get(1); } /** @@ -1041,8 +1093,8 @@ public EAttribute getProductRef_Identifier() { * @generated */ @Override - public EAttribute getProductRef_Version() { - return (EAttribute) productRefEClass.getEStructuralFeatures().get(1); + public EAttribute getCompanyRef_Info() { + return (EAttribute) companyRefEClass.getEStructuralFeatures().get(2); } /** @@ -1465,6 +1517,10 @@ public void createPackageContents() { productRefDescriptorEClass = createEClass(PRODUCT_REF_DESCRIPTOR); + userRefDescriptorEClass = createEClass(USER_REF_DESCRIPTOR); + + companyRefDescriptorEClass = createEClass(COMPANY_REF_DESCRIPTOR); + licenseRequisitesDescriptorEClass = createEClass(LICENSE_REQUISITES_DESCRIPTOR); personalLicenseRequisitesDescriptorEClass = createEClass(PERSONAL_LICENSE_REQUISITES_DESCRIPTOR); @@ -1501,16 +1557,9 @@ public void createPackageContents() { createEAttribute(licensePlanFeatureEClass, LICENSE_PLAN_FEATURE__MATCH_RULE); createEReference(licensePlanFeatureEClass, LICENSE_PLAN_FEATURE__LICENSE_PLAN); - licensePackEClass = createEClass(LICENSE_PACK); - createEAttribute(licensePackEClass, LICENSE_PACK__IDENTIFIER); - createEAttribute(licensePackEClass, LICENSE_PACK__ISSUE_DATE); - createEAttribute(licensePackEClass, LICENSE_PACK__USER_IDENTIFIER); - createEAttribute(licensePackEClass, LICENSE_PACK__USER_FULL_NAME); - createEAttribute(licensePackEClass, LICENSE_PACK__REQUEST_IDENTIFIER); - createEAttribute(licensePackEClass, LICENSE_PACK__PLAN_IDENTIFIER); - createEAttribute(licensePackEClass, LICENSE_PACK__PRODUCT_IDENTIFIER); - createEAttribute(licensePackEClass, LICENSE_PACK__PRODUCT_VERSION); - createEReference(licensePackEClass, LICENSE_PACK__LICENSE_GRANTS); + personalLicensePackEClass = createEClass(PERSONAL_LICENSE_PACK); + createEReference(personalLicensePackEClass, PERSONAL_LICENSE_PACK__LICENSE); + createEReference(personalLicensePackEClass, PERSONAL_LICENSE_PACK__GRANTS); licenseGrantEClass = createEClass(LICENSE_GRANT); createEAttribute(licenseGrantEClass, LICENSE_GRANT__IDENTIFIER); @@ -1538,15 +1587,24 @@ public void createPackageContents() { createEReference(licenseRequisitesEClass, LICENSE_REQUISITES__VALID); personalLicenseRequisitesEClass = createEClass(PERSONAL_LICENSE_REQUISITES); - createEAttribute(personalLicenseRequisitesEClass, PERSONAL_LICENSE_REQUISITES__USER); + createEReference(personalLicenseRequisitesEClass, PERSONAL_LICENSE_REQUISITES__USER); floatingLicenseRequisitesEClass = createEClass(FLOATING_LICENSE_REQUISITES); - createEAttribute(floatingLicenseRequisitesEClass, FLOATING_LICENSE_REQUISITES__COMPANY); + createEReference(floatingLicenseRequisitesEClass, FLOATING_LICENSE_REQUISITES__COMPANY); productRefEClass = createEClass(PRODUCT_REF); createEAttribute(productRefEClass, PRODUCT_REF__IDENTIFIER); createEAttribute(productRefEClass, PRODUCT_REF__VERSION); + userRefEClass = createEClass(USER_REF); + createEAttribute(userRefEClass, USER_REF__IDENTIFIER); + createEAttribute(userRefEClass, USER_REF__NAME); + + companyRefEClass = createEClass(COMPANY_REF); + createEAttribute(companyRefEClass, COMPANY_REF__IDENTIFIER); + createEAttribute(companyRefEClass, COMPANY_REF__NAME); + createEAttribute(companyRefEClass, COMPANY_REF__INFO); + floatingServerEClass = createEClass(FLOATING_SERVER); createEAttribute(floatingServerEClass, FLOATING_SERVER__IDENTIFIER); createEReference(floatingServerEClass, FLOATING_SERVER__AUTHENTICATION); @@ -1629,7 +1687,7 @@ public void initializePackageContents() { floatingLicenseRequisitesDescriptorEClass.getESuperTypes().add(this.getLicenseRequisitesDescriptor()); licensePlanEClass.getESuperTypes().add(this.getLicensePlanDescriptor()); licensePlanFeatureEClass.getESuperTypes().add(this.getLicensePlanFeatureDescriptor()); - licensePackEClass.getESuperTypes().add(this.getLicensePackDescriptor()); + personalLicensePackEClass.getESuperTypes().add(this.getLicensePackDescriptor()); licenseGrantEClass.getESuperTypes().add(this.getLicenseGrantDescriptor()); floatingLicensePackEClass.getESuperTypes().add(this.getFloatingLicensePackDescriptor()); licenseRequisitesEClass.getESuperTypes().add(this.getLicenseRequisitesDescriptor()); @@ -1638,6 +1696,8 @@ public void initializePackageContents() { floatingLicenseRequisitesEClass.getESuperTypes().add(this.getLicenseRequisites()); floatingLicenseRequisitesEClass.getESuperTypes().add(this.getFloatingLicenseRequisitesDescriptor()); productRefEClass.getESuperTypes().add(this.getProductRefDescriptor()); + userRefEClass.getESuperTypes().add(this.getUserRefDescriptor()); + companyRefEClass.getESuperTypes().add(this.getCompanyRefDescriptor()); floatingServerEClass.getESuperTypes().add(this.getFloatingServerDescriptor()); userGrantEClass.getESuperTypes().add(this.getUserGrantDescriptor()); featureGrantEClass.getESuperTypes().add(this.getFeatureGrantDescriptor()); @@ -1654,7 +1714,7 @@ public void initializePackageContents() { initEClass(licensePlanFeatureDescriptorEClass, LicensePlanFeatureDescriptor.class, "LicensePlanFeatureDescriptor", IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEClass(licensePackDescriptorEClass, LicensePackDescriptor.class, "LicensePackDescriptor", IS_ABSTRACT, //$NON-NLS-1$ + initEClass(licensePackDescriptorEClass, PersonalLicensePackDescriptor.class, "LicensePackDescriptor", IS_ABSTRACT, //$NON-NLS-1$ IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); initEClass(licenseGrantDescriptorEClass, LicenseGrantDescriptor.class, "LicenseGrantDescriptor", IS_ABSTRACT, //$NON-NLS-1$ @@ -1663,6 +1723,12 @@ public void initializePackageContents() { initEClass(productRefDescriptorEClass, ProductRefDescriptor.class, "ProductRefDescriptor", IS_ABSTRACT, //$NON-NLS-1$ IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEClass(userRefDescriptorEClass, UserRefDescriptor.class, "UserRefDescriptor", IS_ABSTRACT, IS_INTERFACE, //$NON-NLS-1$ + !IS_GENERATED_INSTANCE_CLASS); + + initEClass(companyRefDescriptorEClass, CompanyRefDescriptor.class, "CompanyRefDescriptor", IS_ABSTRACT, //$NON-NLS-1$ + IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEClass(licenseRequisitesDescriptorEClass, LicenseRequisitesDescriptor.class, "LicenseRequisitesDescriptor", //$NON-NLS-1$ IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); @@ -1709,7 +1775,7 @@ public void initializePackageContents() { initEReference(getLicensePlan_LicensePlanFeatures(), this.getLicensePlanFeatureDescriptor(), null, "licensePlanFeatures", null, 0, -1, LicensePlan.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, //$NON-NLS-1$ IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getLicensePlan_Personal(), this.getLicensePack(), null, "personal", null, 0, -1, //$NON-NLS-1$ + initEReference(getLicensePlan_Personal(), this.getPersonalLicensePack(), null, "personal", null, 0, -1, //$NON-NLS-1$ LicensePlan.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getLicensePlan_Floating(), this.getFloatingLicensePack(), null, "floating", null, 0, -1, //$NON-NLS-1$ @@ -1731,33 +1797,13 @@ public void initializePackageContents() { LicensePlanFeature.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEClass(licensePackEClass, LicensePack.class, "LicensePack", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ - IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getLicensePack_Identifier(), ecorePackage.getEString(), "identifier", null, 0, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_IssueDate(), ecorePackage.getEDate(), "issueDate", null, 0, 1, LicensePack.class, //$NON-NLS-1$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_UserIdentifier(), ecorePackage.getEString(), "userIdentifier", null, 1, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_UserFullName(), ecorePackage.getEString(), "userFullName", null, 1, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_RequestIdentifier(), ecorePackage.getEString(), "requestIdentifier", null, 1, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_PlanIdentifier(), ecorePackage.getEString(), "planIdentifier", null, 1, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_ProductIdentifier(), ecorePackage.getEString(), "productIdentifier", null, 1, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getLicensePack_ProductVersion(), ecorePackage.getEString(), "productVersion", null, 1, 1, //$NON-NLS-1$ - LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getLicensePack_LicenseGrants(), this.getLicenseGrant(), this.getLicenseGrant_LicensePack(), - "licenseGrants", null, 0, -1, LicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, //$NON-NLS-1$ + initEClass(personalLicensePackEClass, PersonalLicensePack.class, "PersonalLicensePack", !IS_ABSTRACT, //$NON-NLS-1$ + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPersonalLicensePack_License(), this.getPersonalLicenseRequisites(), null, "license", null, 1, //$NON-NLS-1$ + 1, PersonalLicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, + !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPersonalLicensePack_Grants(), this.getLicenseGrant(), this.getLicenseGrant_LicensePack(), + "grants", null, 0, -1, PersonalLicensePack.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, //$NON-NLS-1$ IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(licenseGrantEClass, LicenseGrant.class, "LicenseGrant", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ @@ -1788,9 +1834,10 @@ public void initializePackageContents() { !IS_DERIVED, IS_ORDERED); initEAttribute(getLicenseGrant_Capacity(), ecorePackage.getEInt(), "capacity", "1", 0, 1, LicenseGrant.class, //$NON-NLS-1$//$NON-NLS-2$ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getLicenseGrant_LicensePack(), this.getLicensePack(), this.getLicensePack_LicenseGrants(), - "licensePack", null, 1, 1, LicenseGrant.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, //$NON-NLS-1$ - !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getLicenseGrant_LicensePack(), this.getPersonalLicensePack(), + this.getPersonalLicensePack_Grants(), "licensePack", null, 1, 1, LicenseGrant.class, !IS_TRANSIENT, //$NON-NLS-1$ + !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); initEClass(floatingLicensePackEClass, FloatingLicensePack.class, "FloatingLicensePack", !IS_ABSTRACT, //$NON-NLS-1$ !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -1827,15 +1874,15 @@ public void initializePackageContents() { initEClass(personalLicenseRequisitesEClass, PersonalLicenseRequisites.class, "PersonalLicenseRequisites", //$NON-NLS-1$ !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPersonalLicenseRequisites_User(), ecorePackage.getEString(), "user", null, 1, 1, //$NON-NLS-1$ - PersonalLicenseRequisites.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, - IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPersonalLicenseRequisites_User(), this.getUserRef(), null, "user", null, 1, 1, //$NON-NLS-1$ + PersonalLicenseRequisites.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, + !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(floatingLicenseRequisitesEClass, FloatingLicenseRequisites.class, "FloatingLicenseRequisites", //$NON-NLS-1$ !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getFloatingLicenseRequisites_Company(), ecorePackage.getEString(), "company", null, 1, 1, //$NON-NLS-1$ - FloatingLicenseRequisites.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, - IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getFloatingLicenseRequisites_Company(), this.getCompanyRef(), null, "company", null, 1, 1, //$NON-NLS-1$ + FloatingLicenseRequisites.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, + !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(productRefEClass, ProductRef.class, "ProductRef", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ IS_GENERATED_INSTANCE_CLASS); @@ -1845,6 +1892,22 @@ public void initializePackageContents() { initEAttribute(getProductRef_Version(), ecorePackage.getEString(), "version", null, 1, 1, ProductRef.class, //$NON-NLS-1$ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(userRefEClass, UserRef.class, "UserRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getUserRef_Identifier(), ecorePackage.getEString(), "identifier", null, 1, 1, UserRef.class, //$NON-NLS-1$ + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getUserRef_Name(), ecorePackage.getEString(), "name", null, 1, 1, UserRef.class, !IS_TRANSIENT, //$NON-NLS-1$ + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(companyRefEClass, CompanyRef.class, "CompanyRef", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ + IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCompanyRef_Identifier(), ecorePackage.getEString(), "identifier", null, 1, 1, //$NON-NLS-1$ + CompanyRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, + !IS_DERIVED, IS_ORDERED); + initEAttribute(getCompanyRef_Name(), ecorePackage.getEString(), "name", null, 1, 1, CompanyRef.class, //$NON-NLS-1$ + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCompanyRef_Info(), ecorePackage.getEString(), "info", null, 1, 1, CompanyRef.class, //$NON-NLS-1$ + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(floatingServerEClass, FloatingServer.class, "FloatingServer", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ IS_GENERATED_INSTANCE_CLASS); initEAttribute(getFloatingServer_Identifier(), ecorePackage.getEString(), "identifier", null, 1, 1, //$NON-NLS-1$ diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicensePackImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicensePackImpl.java new file mode 100644 index 000000000..007114319 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicensePackImpl.java @@ -0,0 +1,267 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; + +import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; + +/** + * + * An implementation of the model object 'Personal License Pack'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.PersonalLicensePackImpl#getLicense License}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.PersonalLicensePackImpl#getGrants Grants}
  • + *
+ * + * @generated + */ +public class PersonalLicensePackImpl extends MinimalEObjectImpl.Container implements PersonalLicensePack { + /** + * The cached value of the '{@link #getLicense() License}' containment reference. + * + * + * @see #getLicense() + * @generated + * @ordered + */ + protected PersonalLicenseRequisites license; + + /** + * The cached value of the '{@link #getGrants() Grants}' containment reference list. + * + * + * @see #getGrants() + * @generated + * @ordered + */ + protected EList grants; + + /** + * + * + * @generated + */ + protected PersonalLicensePackImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LicensesPackage.eINSTANCE.getPersonalLicensePack(); + } + + /** + * + * + * @generated + */ + @Override + public PersonalLicenseRequisites getLicense() { + return license; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLicense(PersonalLicenseRequisites newLicense, NotificationChain msgs) { + PersonalLicenseRequisites oldLicense = license; + license = newLicense; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, + LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE, oldLicense, newLicense); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setLicense(PersonalLicenseRequisites newLicense) { + if (newLicense != license) { + NotificationChain msgs = null; + if (license != null) + msgs = ((InternalEObject) license).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE - LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE, null, msgs); + if (newLicense != null) + msgs = ((InternalEObject) newLicense).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE - LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE, null, msgs); + msgs = basicSetLicense(newLicense, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE, + newLicense, newLicense)); + } + } + + /** + * + * + * @generated + */ + @Override + public EList getGrants() { + if (grants == null) { + grants = new EObjectContainmentWithInverseEList(LicenseGrant.class, this, + LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS, LicensesPackage.LICENSE_GRANT__LICENSE_PACK); + } + return grants; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + return ((InternalEList) (InternalEList) getGrants()).basicAdd(otherEnd, msgs); + default: + return super.eInverseAdd(otherEnd, featureID, msgs); + } + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE: + return basicSetLicense(null, msgs); + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + return ((InternalEList) getGrants()).basicRemove(otherEnd, msgs); + default: + return super.eInverseRemove(otherEnd, featureID, msgs); + } + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE: + return getLicense(); + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + return getGrants(); + default: + return super.eGet(featureID, resolve, coreType); + } + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE: + setLicense((PersonalLicenseRequisites) newValue); + return; + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + getGrants().clear(); + getGrants().addAll((Collection) newValue); + return; + default: + super.eSet(featureID, newValue); + return; + } + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE: + setLicense((PersonalLicenseRequisites) null); + return; + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + getGrants().clear(); + return; + default: + super.eUnset(featureID); + return; + } + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_PACK__LICENSE: + return license != null; + case LicensesPackage.PERSONAL_LICENSE_PACK__GRANTS: + return grants != null && !grants.isEmpty(); + default: + return super.eIsSet(featureID); + } + } + +} //PersonalLicensePackImpl diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicenseRequisitesImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicenseRequisitesImpl.java index db7c0e2e7..eeafd5497 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicenseRequisitesImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/PersonalLicenseRequisitesImpl.java @@ -12,16 +12,17 @@ *******************************************************************************/ package org.eclipse.passage.lic.licenses.model.impl; -import java.util.Objects; - import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; +import org.eclipse.passage.lic.licenses.model.api.UserRef; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; /** @@ -39,24 +40,14 @@ */ public class PersonalLicenseRequisitesImpl extends LicenseRequisitesImpl implements PersonalLicenseRequisites { /** - * The default value of the '{@link #getUser() User}' attribute. - * - * - * @see #getUser() - * @generated - * @ordered - */ - protected static final String USER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getUser() User}' attribute. + * The cached value of the '{@link #getUser() User}' containment reference. * * * @see #getUser() * @generated * @ordered */ - private String user = USER_EDEFAULT; + protected UserRef user; /** * @@ -83,7 +74,7 @@ protected EClass eStaticClass() { * @generated */ @Override - public String getUser() { + public UserRef getUser() { return user; } @@ -92,13 +83,56 @@ public String getUser() { * * @generated */ - @Override - public void setUser(String newUser) { - String oldUser = user; + public NotificationChain basicSetUser(UserRef newUser, NotificationChain msgs) { + UserRef oldUser = user; user = newUser; if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, + LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER, oldUser, newUser); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setUser(UserRef newUser) { + if (newUser != user) { + NotificationChain msgs = null; + if (user != null) + msgs = ((InternalEObject) user).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE - LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER, null, msgs); + if (newUser != null) + msgs = ((InternalEObject) newUser).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE - LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER, null, msgs); + msgs = basicSetUser(newUser, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER, - oldUser, user)); + newUser, newUser)); + } + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER: + return basicSetUser(null, msgs); + default: + return super.eInverseRemove(otherEnd, featureID, msgs); } } @@ -126,7 +160,7 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { public void eSet(int featureID, Object newValue) { switch (featureID) { case LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER: - setUser((String) newValue); + setUser((UserRef) newValue); return; default: super.eSet(featureID, newValue); @@ -143,7 +177,7 @@ public void eSet(int featureID, Object newValue) { public void eUnset(int featureID) { switch (featureID) { case LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER: - setUser(USER_EDEFAULT); + setUser((UserRef) null); return; default: super.eUnset(featureID); @@ -160,27 +194,10 @@ public void eUnset(int featureID) { public boolean eIsSet(int featureID) { switch (featureID) { case LicensesPackage.PERSONAL_LICENSE_REQUISITES__USER: - return !Objects.equals(USER_EDEFAULT, user); + return user != null; default: return super.eIsSet(featureID); } } - /** - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - StringBuilder result = new StringBuilder(super.toString()); - result.append(" (user: "); //$NON-NLS-1$ - result.append(user); - result.append(')'); - return result.toString(); - } - } //PersonalLicenseRequisitesImpl diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/UserRefImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/UserRefImpl.java new file mode 100644 index 000000000..1e89c8ec3 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/impl/UserRefImpl.java @@ -0,0 +1,244 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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.impl; + +import java.util.Objects; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.passage.lic.licenses.model.api.UserRef; + +import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; + +/** + * + * An implementation of the model object 'User Ref'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.UserRefImpl#getIdentifier Identifier}
  • + *
  • {@link org.eclipse.passage.lic.licenses.model.impl.UserRefImpl#getName Name}
  • + *
+ * + * @generated + */ +public class UserRefImpl extends MinimalEObjectImpl.Container implements UserRef { + /** + * The default value of the '{@link #getIdentifier() Identifier}' attribute. + * + * + * @see #getIdentifier() + * @generated + * @ordered + */ + protected static final String IDENTIFIER_EDEFAULT = null; + + /** + * The cached value of the '{@link #getIdentifier() Identifier}' attribute. + * + * + * @see #getIdentifier() + * @generated + * @ordered + */ + private String identifier = IDENTIFIER_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + private String name = NAME_EDEFAULT; + + /** + * + * + * @generated + */ + protected UserRefImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LicensesPackage.eINSTANCE.getUserRef(); + } + + /** + * + * + * @generated + */ + @Override + public String getIdentifier() { + return identifier; + } + + /** + * + * + * @generated + */ + @Override + public void setIdentifier(String newIdentifier) { + String oldIdentifier = identifier; + identifier = newIdentifier; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.USER_REF__IDENTIFIER, oldIdentifier, + identifier)); + } + } + + /** + * + * + * @generated + */ + @Override + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + @Override + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, LicensesPackage.USER_REF__NAME, oldName, name)); + } + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LicensesPackage.USER_REF__IDENTIFIER: + return getIdentifier(); + case LicensesPackage.USER_REF__NAME: + return getName(); + default: + return super.eGet(featureID, resolve, coreType); + } + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LicensesPackage.USER_REF__IDENTIFIER: + setIdentifier((String) newValue); + return; + case LicensesPackage.USER_REF__NAME: + setName((String) newValue); + return; + default: + super.eSet(featureID, newValue); + return; + } + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LicensesPackage.USER_REF__IDENTIFIER: + setIdentifier(IDENTIFIER_EDEFAULT); + return; + case LicensesPackage.USER_REF__NAME: + setName(NAME_EDEFAULT); + return; + default: + super.eUnset(featureID); + return; + } + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LicensesPackage.USER_REF__IDENTIFIER: + return !Objects.equals(IDENTIFIER_EDEFAULT, identifier); + case LicensesPackage.USER_REF__NAME: + return !Objects.equals(NAME_EDEFAULT, name); + default: + return super.eIsSet(featureID); + } + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (identifier: "); //$NON-NLS-1$ + result.append(identifier); + result.append(", name: "); //$NON-NLS-1$ + result.append(name); + result.append(')'); + return result.toString(); + } + +} //UserRefImpl diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesFactory.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesFactory.java index 7471165cb..acf2da88f 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesFactory.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesFactory.java @@ -14,6 +14,7 @@ import org.eclipse.emf.ecore.EFactory; +import org.eclipse.passage.lic.licenses.model.api.CompanyRef; import org.eclipse.passage.lic.licenses.model.api.EvaluationInstructions; import org.eclipse.passage.lic.licenses.model.api.FeatureGrant; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; @@ -23,12 +24,13 @@ import org.eclipse.passage.lic.licenses.model.api.FloatingServerConnection; import org.eclipse.passage.lic.licenses.model.api.GrantAcqisition; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; import org.eclipse.passage.lic.licenses.model.api.LicensePlan; import org.eclipse.passage.lic.licenses.model.api.LicensePlanFeature; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; import org.eclipse.passage.lic.licenses.model.api.ProductRef; import org.eclipse.passage.lic.licenses.model.api.UserGrant; +import org.eclipse.passage.lic.licenses.model.api.UserRef; import org.eclipse.passage.lic.licenses.model.api.ValidityPeriodClosed; import org.eclipse.passage.lic.licenses.model.api.VersionMatch; @@ -68,13 +70,13 @@ public interface LicensesFactory extends EFactory { LicensePlanFeature createLicensePlanFeature(); /** - * Returns a new object of class 'License Pack'. + * Returns a new object of class 'Personal License Pack'. * * - * @return a new object of class 'License Pack'. + * @return a new object of class 'Personal License Pack'. * @generated */ - LicensePack createLicensePack(); + PersonalLicensePack createPersonalLicensePack(); /** * Returns a new object of class 'License Grant'. @@ -121,6 +123,24 @@ public interface LicensesFactory extends EFactory { */ ProductRef createProductRef(); + /** + * Returns a new object of class 'User Ref'. + * + * + * @return a new object of class 'User Ref'. + * @generated + */ + UserRef createUserRef(); + + /** + * Returns a new object of class 'Company Ref'. + * + * + * @return a new object of class 'Company Ref'. + * @generated + */ + CompanyRef createCompanyRef(); + /** * Returns a new object of class 'Floating Server'. * diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesPackage.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesPackage.java index 8b4e46032..2516556df 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesPackage.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/meta/LicensesPackage.java @@ -123,10 +123,10 @@ public interface LicensesPackage extends EPackage { int LICENSE_PLAN_FEATURE_DESCRIPTOR_OPERATION_COUNT = 0; /** - * The meta object id for the '{@link org.eclipse.passage.lic.licenses.LicensePackDescriptor License Pack Descriptor}' class. + * The meta object id for the '{@link org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor License Pack Descriptor}' class. * * - * @see org.eclipse.passage.lic.licenses.LicensePackDescriptor + * @see org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicensePackDescriptor() * @generated */ @@ -206,6 +206,62 @@ public interface LicensesPackage extends EPackage { */ int PRODUCT_REF_DESCRIPTOR_OPERATION_COUNT = 0; + /** + * The meta object id for the '{@link org.eclipse.passage.lic.licenses.UserRefDescriptor User Ref Descriptor}' class. + * + * + * @see org.eclipse.passage.lic.licenses.UserRefDescriptor + * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getUserRefDescriptor() + * @generated + */ + int USER_REF_DESCRIPTOR = 5; + + /** + * The number of structural features of the 'User Ref Descriptor' class. + * + * + * @generated + * @ordered + */ + int USER_REF_DESCRIPTOR_FEATURE_COUNT = 0; + + /** + * The number of operations of the 'User Ref Descriptor' class. + * + * + * @generated + * @ordered + */ + int USER_REF_DESCRIPTOR_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.passage.lic.licenses.CompanyRefDescriptor Company Ref Descriptor}' class. + * + * + * @see org.eclipse.passage.lic.licenses.CompanyRefDescriptor + * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getCompanyRefDescriptor() + * @generated + */ + int COMPANY_REF_DESCRIPTOR = 6; + + /** + * The number of structural features of the 'Company Ref Descriptor' class. + * + * + * @generated + * @ordered + */ + int COMPANY_REF_DESCRIPTOR_FEATURE_COUNT = 0; + + /** + * The number of operations of the 'Company Ref Descriptor' class. + * + * + * @generated + * @ordered + */ + int COMPANY_REF_DESCRIPTOR_OPERATION_COUNT = 0; + /** * The meta object id for the '{@link org.eclipse.passage.lic.licenses.LicenseRequisitesDescriptor License Requisites Descriptor}' class. * @@ -214,7 +270,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicenseRequisitesDescriptor() * @generated */ - int LICENSE_REQUISITES_DESCRIPTOR = 5; + int LICENSE_REQUISITES_DESCRIPTOR = 7; /** * The number of structural features of the 'License Requisites Descriptor' class. @@ -242,7 +298,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getPersonalLicenseRequisitesDescriptor() * @generated */ - int PERSONAL_LICENSE_REQUISITES_DESCRIPTOR = 6; + int PERSONAL_LICENSE_REQUISITES_DESCRIPTOR = 8; /** * The number of structural features of the 'Personal License Requisites Descriptor' class. @@ -270,7 +326,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingLicenseRequisitesDescriptor() * @generated */ - int FLOATING_LICENSE_REQUISITES_DESCRIPTOR = 7; + int FLOATING_LICENSE_REQUISITES_DESCRIPTOR = 9; /** * The number of structural features of the 'Floating License Requisites Descriptor' class. @@ -298,7 +354,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getValidityPeriodDescriptor() * @generated */ - int VALIDITY_PERIOD_DESCRIPTOR = 8; + int VALIDITY_PERIOD_DESCRIPTOR = 10; /** * The number of structural features of the 'Validity Period Descriptor' class. @@ -326,7 +382,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getValidityPeriodClosedDescriptor() * @generated */ - int VALIDITY_PERIOD_CLOSED_DESCRIPTOR = 9; + int VALIDITY_PERIOD_CLOSED_DESCRIPTOR = 11; /** * The number of structural features of the 'Validity Period Closed Descriptor' class. @@ -354,7 +410,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingLicensePackDescriptor() * @generated */ - int FLOATING_LICENSE_PACK_DESCRIPTOR = 10; + int FLOATING_LICENSE_PACK_DESCRIPTOR = 12; /** * The number of structural features of the 'Floating License Pack Descriptor' class. @@ -382,7 +438,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingServerDescriptor() * @generated */ - int FLOATING_SERVER_DESCRIPTOR = 11; + int FLOATING_SERVER_DESCRIPTOR = 13; /** * The number of structural features of the 'Floating Server Descriptor' class. @@ -410,7 +466,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getUserGrantDescriptor() * @generated */ - int USER_GRANT_DESCRIPTOR = 12; + int USER_GRANT_DESCRIPTOR = 14; /** * The number of structural features of the 'User Grant Descriptor' class. @@ -438,7 +494,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFeatureGrantDescriptor() * @generated */ - int FEATURE_GRANT_DESCRIPTOR = 13; + int FEATURE_GRANT_DESCRIPTOR = 15; /** * The number of structural features of the 'Feature Grant Descriptor' class. @@ -466,7 +522,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getEvaluationInstructionsDescriptor() * @generated */ - int EVALUATION_INSTRUCTIONS_DESCRIPTOR = 14; + int EVALUATION_INSTRUCTIONS_DESCRIPTOR = 16; /** * The number of structural features of the 'Evaluation Instructions Descriptor' class. @@ -494,7 +550,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getVersionMatchDescriptor() * @generated */ - int VERSION_MATCH_DESCRIPTOR = 15; + int VERSION_MATCH_DESCRIPTOR = 17; /** * The number of structural features of the 'Version Match Descriptor' class. @@ -522,7 +578,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicensePlan() * @generated */ - int LICENSE_PLAN = 16; + int LICENSE_PLAN = 18; /** * The feature id for the 'Identifier' attribute. @@ -604,7 +660,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicensePlanFeature() * @generated */ - int LICENSE_PLAN_FEATURE = 17; + int LICENSE_PLAN_FEATURE = 19; /** * The feature id for the 'Feature Identifier' attribute. @@ -661,113 +717,50 @@ public interface LicensesPackage extends EPackage { int LICENSE_PLAN_FEATURE_OPERATION_COUNT = LICENSE_PLAN_FEATURE_DESCRIPTOR_OPERATION_COUNT + 0; /** - * The meta object id for the '{@link org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl License Pack}' class. - * - * - * @see org.eclipse.passage.lic.licenses.model.impl.LicensePackImpl - * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicensePack() - * @generated - */ - int LICENSE_PACK = 18; - - /** - * The feature id for the 'Identifier' attribute. - * - * - * @generated - * @ordered - */ - int LICENSE_PACK__IDENTIFIER = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The feature id for the 'Issue Date' attribute. - * - * - * @generated - * @ordered - */ - int LICENSE_PACK__ISSUE_DATE = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 1; - - /** - * The feature id for the 'User Identifier' attribute. - * - * - * @generated - * @ordered - */ - int LICENSE_PACK__USER_IDENTIFIER = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 2; - - /** - * The feature id for the 'User Full Name' attribute. + * The meta object id for the '{@link org.eclipse.passage.lic.licenses.model.impl.PersonalLicensePackImpl Personal License Pack}' class. * * + * @see org.eclipse.passage.lic.licenses.model.impl.PersonalLicensePackImpl + * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getPersonalLicensePack() * @generated - * @ordered - */ - int LICENSE_PACK__USER_FULL_NAME = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 3; - - /** - * The feature id for the 'Request Identifier' attribute. - * - * - * @generated - * @ordered - */ - int LICENSE_PACK__REQUEST_IDENTIFIER = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 4; - - /** - * The feature id for the 'Plan Identifier' attribute. - * - * - * @generated - * @ordered */ - int LICENSE_PACK__PLAN_IDENTIFIER = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 5; + int PERSONAL_LICENSE_PACK = 20; /** - * The feature id for the 'Product Identifier' attribute. - * - * - * @generated - * @ordered - */ - int LICENSE_PACK__PRODUCT_IDENTIFIER = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 6; - - /** - * The feature id for the 'Product Version' attribute. + * The feature id for the 'License' containment reference. * * * @generated * @ordered */ - int LICENSE_PACK__PRODUCT_VERSION = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 7; + int PERSONAL_LICENSE_PACK__LICENSE = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 0; /** - * The feature id for the 'License Grants' containment reference list. + * The feature id for the 'Grants' containment reference list. * * * @generated * @ordered */ - int LICENSE_PACK__LICENSE_GRANTS = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 8; + int PERSONAL_LICENSE_PACK__GRANTS = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 1; /** - * The number of structural features of the 'License Pack' class. + * The number of structural features of the 'Personal License Pack' class. * * * @generated * @ordered */ - int LICENSE_PACK_FEATURE_COUNT = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 9; + int PERSONAL_LICENSE_PACK_FEATURE_COUNT = LICENSE_PACK_DESCRIPTOR_FEATURE_COUNT + 2; /** - * The number of operations of the 'License Pack' class. + * The number of operations of the 'Personal License Pack' class. * * * @generated * @ordered */ - int LICENSE_PACK_OPERATION_COUNT = LICENSE_PACK_DESCRIPTOR_OPERATION_COUNT + 0; + int PERSONAL_LICENSE_PACK_OPERATION_COUNT = LICENSE_PACK_DESCRIPTOR_OPERATION_COUNT + 0; /** * The meta object id for the '{@link org.eclipse.passage.lic.licenses.model.impl.LicenseGrantImpl License Grant}' class. @@ -777,7 +770,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicenseGrant() * @generated */ - int LICENSE_GRANT = 19; + int LICENSE_GRANT = 21; /** * The feature id for the 'Identifier' attribute. @@ -895,7 +888,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingLicensePack() * @generated */ - int FLOATING_LICENSE_PACK = 20; + int FLOATING_LICENSE_PACK = 22; /** * The feature id for the 'License' containment reference. @@ -959,7 +952,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getLicenseRequisites() * @generated */ - int LICENSE_REQUISITES = 21; + int LICENSE_REQUISITES = 23; /** * The feature id for the 'Identifier' attribute. @@ -1032,7 +1025,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getPersonalLicenseRequisites() * @generated */ - int PERSONAL_LICENSE_REQUISITES = 22; + int PERSONAL_LICENSE_REQUISITES = 24; /** * The feature id for the 'Identifier' attribute. @@ -1080,7 +1073,7 @@ public interface LicensesPackage extends EPackage { int PERSONAL_LICENSE_REQUISITES__VALID = LICENSE_REQUISITES__VALID; /** - * The feature id for the 'User' attribute. + * The feature id for the 'User' containment reference. * * * @generated @@ -1114,7 +1107,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingLicenseRequisites() * @generated */ - int FLOATING_LICENSE_REQUISITES = 23; + int FLOATING_LICENSE_REQUISITES = 25; /** * The feature id for the 'Identifier' attribute. @@ -1162,7 +1155,7 @@ public interface LicensesPackage extends EPackage { int FLOATING_LICENSE_REQUISITES__VALID = LICENSE_REQUISITES__VALID; /** - * The feature id for the 'Company' attribute. + * The feature id for the 'Company' containment reference. * * * @generated @@ -1196,7 +1189,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getProductRef() * @generated */ - int PRODUCT_REF = 24; + int PRODUCT_REF = 26; /** * The feature id for the 'Identifier' attribute. @@ -1234,6 +1227,107 @@ public interface LicensesPackage extends EPackage { */ int PRODUCT_REF_OPERATION_COUNT = PRODUCT_REF_DESCRIPTOR_OPERATION_COUNT + 0; + /** + * The meta object id for the '{@link org.eclipse.passage.lic.licenses.model.impl.UserRefImpl User Ref}' class. + * + * + * @see org.eclipse.passage.lic.licenses.model.impl.UserRefImpl + * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getUserRef() + * @generated + */ + int USER_REF = 27; + + /** + * The feature id for the 'Identifier' attribute. + * + * + * @generated + * @ordered + */ + int USER_REF__IDENTIFIER = USER_REF_DESCRIPTOR_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int USER_REF__NAME = USER_REF_DESCRIPTOR_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'User Ref' class. + * + * + * @generated + * @ordered + */ + int USER_REF_FEATURE_COUNT = USER_REF_DESCRIPTOR_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'User Ref' class. + * + * + * @generated + * @ordered + */ + int USER_REF_OPERATION_COUNT = USER_REF_DESCRIPTOR_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.passage.lic.licenses.model.impl.CompanyRefImpl Company Ref}' class. + * + * + * @see org.eclipse.passage.lic.licenses.model.impl.CompanyRefImpl + * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getCompanyRef() + * @generated + */ + int COMPANY_REF = 28; + + /** + * The feature id for the 'Identifier' attribute. + * + * + * @generated + * @ordered + */ + int COMPANY_REF__IDENTIFIER = COMPANY_REF_DESCRIPTOR_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int COMPANY_REF__NAME = COMPANY_REF_DESCRIPTOR_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Info' attribute. + * + * + * @generated + * @ordered + */ + int COMPANY_REF__INFO = COMPANY_REF_DESCRIPTOR_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Company Ref' class. + * + * + * @generated + * @ordered + */ + int COMPANY_REF_FEATURE_COUNT = COMPANY_REF_DESCRIPTOR_FEATURE_COUNT + 3; + + /** + * The number of operations of the 'Company Ref' class. + * + * + * @generated + * @ordered + */ + int COMPANY_REF_OPERATION_COUNT = COMPANY_REF_DESCRIPTOR_OPERATION_COUNT + 0; + /** * The meta object id for the '{@link org.eclipse.passage.lic.licenses.model.impl.FloatingServerImpl Floating Server}' class. * @@ -1242,7 +1336,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingServer() * @generated */ - int FLOATING_SERVER = 25; + int FLOATING_SERVER = 29; /** * The feature id for the 'Identifier' attribute. @@ -1288,7 +1382,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getUserGrant() * @generated */ - int USER_GRANT = 26; + int USER_GRANT = 30; /** * The feature id for the 'User' attribute. @@ -1334,7 +1428,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFeatureGrant() * @generated */ - int FEATURE_GRANT = 27; + int FEATURE_GRANT = 31; /** * The feature id for the 'Identifier' attribute. @@ -1425,7 +1519,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getValidityPeriod() * @generated */ - int VALIDITY_PERIOD = 28; + int VALIDITY_PERIOD = 32; /** * The number of structural features of the 'Validity Period' class. @@ -1453,7 +1547,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getValidityPeriodClosed() * @generated */ - int VALIDITY_PERIOD_CLOSED = 29; + int VALIDITY_PERIOD_CLOSED = 33; /** * The feature id for the 'From' attribute. @@ -1499,7 +1593,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getEvaluationInstructions() * @generated */ - int EVALUATION_INSTRUCTIONS = 30; + int EVALUATION_INSTRUCTIONS = 34; /** * The feature id for the 'Type' attribute. @@ -1545,7 +1639,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getVersionMatch() * @generated */ - int VERSION_MATCH = 31; + int VERSION_MATCH = 35; /** * The feature id for the 'Version' attribute. @@ -1591,7 +1685,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingLicenseAccess() * @generated */ - int FLOATING_LICENSE_ACCESS = 32; + int FLOATING_LICENSE_ACCESS = 36; /** * The feature id for the 'User' attribute. @@ -1646,7 +1740,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getFloatingServerConnection() * @generated */ - int FLOATING_SERVER_CONNECTION = 33; + int FLOATING_SERVER_CONNECTION = 37; /** * The feature id for the 'Ip' attribute. @@ -1701,7 +1795,7 @@ public interface LicensesPackage extends EPackage { * @see org.eclipse.passage.lic.licenses.model.impl.LicensesPackageImpl#getGrantAcqisition() * @generated */ - int GRANT_ACQISITION = 34; + int GRANT_ACQISITION = 38; /** * The feature id for the 'Identifier' attribute. @@ -1789,11 +1883,11 @@ public interface LicensesPackage extends EPackage { EClass getLicensePlanFeatureDescriptor(); /** - * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.LicensePackDescriptor License Pack Descriptor}'. + * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor License Pack Descriptor}'. * * * @return the meta object for class 'License Pack Descriptor'. - * @see org.eclipse.passage.lic.licenses.LicensePackDescriptor + * @see org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor * @model instanceClass="org.eclipse.passage.lic.licenses.LicensePackDescriptor" * @generated */ @@ -1821,6 +1915,28 @@ public interface LicensesPackage extends EPackage { */ EClass getProductRefDescriptor(); + /** + * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.UserRefDescriptor User Ref Descriptor}'. + * + * + * @return the meta object for class 'User Ref Descriptor'. + * @see org.eclipse.passage.lic.licenses.UserRefDescriptor + * @model instanceClass="org.eclipse.passage.lic.licenses.UserRefDescriptor" + * @generated + */ + EClass getUserRefDescriptor(); + + /** + * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.CompanyRefDescriptor Company Ref Descriptor}'. + * + * + * @return the meta object for class 'Company Ref Descriptor'. + * @see org.eclipse.passage.lic.licenses.CompanyRefDescriptor + * @model instanceClass="org.eclipse.passage.lic.licenses.CompanyRefDescriptor" + * @generated + */ + EClass getCompanyRefDescriptor(); + /** * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.LicenseRequisitesDescriptor License Requisites Descriptor}'. * @@ -2073,113 +2189,36 @@ public interface LicensesPackage extends EPackage { EReference getLicensePlanFeature_LicensePlan(); /** - * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack License Pack}'. - * - * - * @return the meta object for class 'License Pack'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack - * @generated - */ - EClass getLicensePack(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getIdentifier Identifier}'. - * - * - * @return the meta object for the attribute 'Identifier'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getIdentifier() - * @see #getLicensePack() - * @generated - */ - EAttribute getLicensePack_Identifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getIssueDate Issue Date}'. - * - * - * @return the meta object for the attribute 'Issue Date'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getIssueDate() - * @see #getLicensePack() - * @generated - */ - EAttribute getLicensePack_IssueDate(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserIdentifier User Identifier}'. - * - * - * @return the meta object for the attribute 'User Identifier'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserIdentifier() - * @see #getLicensePack() - * @generated - */ - EAttribute getLicensePack_UserIdentifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserFullName User Full Name}'. - * - * - * @return the meta object for the attribute 'User Full Name'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getUserFullName() - * @see #getLicensePack() - * @generated - */ - EAttribute getLicensePack_UserFullName(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getRequestIdentifier Request Identifier}'. + * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack Personal License Pack}'. * * - * @return the meta object for the attribute 'Request Identifier'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getRequestIdentifier() - * @see #getLicensePack() + * @return the meta object for class 'Personal License Pack'. + * @see org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack * @generated */ - EAttribute getLicensePack_RequestIdentifier(); + EClass getPersonalLicensePack(); /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getPlanIdentifier Plan Identifier}'. + * Returns the meta object for the containment reference '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getLicense License}'. * * - * @return the meta object for the attribute 'Plan Identifier'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getPlanIdentifier() - * @see #getLicensePack() - * @generated - */ - EAttribute getLicensePack_PlanIdentifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductIdentifier Product Identifier}'. - * - * - * @return the meta object for the attribute 'Product Identifier'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductIdentifier() - * @see #getLicensePack() - * @generated - */ - EAttribute getLicensePack_ProductIdentifier(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductVersion Product Version}'. - * - * - * @return the meta object for the attribute 'Product Version'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getProductVersion() - * @see #getLicensePack() + * @return the meta object for the containment reference 'License'. + * @see org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getLicense() + * @see #getPersonalLicensePack() * @generated */ - EAttribute getLicensePack_ProductVersion(); + EReference getPersonalLicensePack_License(); /** - * Returns the meta object for the containment reference list '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack#getLicenseGrants License Grants}'. + * Returns the meta object for the containment reference list '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getGrants Grants}'. * * - * @return the meta object for the containment reference list 'License Grants'. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack#getLicenseGrants() - * @see #getLicensePack() + * @return the meta object for the containment reference list 'Grants'. + * @see org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack#getGrants() + * @see #getPersonalLicensePack() * @generated */ - EReference getLicensePack_LicenseGrants(); + EReference getPersonalLicensePack_Grants(); /** * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.LicenseGrant License Grant}'. @@ -2431,15 +2470,15 @@ public interface LicensesPackage extends EPackage { EClass getPersonalLicenseRequisites(); /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites#getUser User}'. + * Returns the meta object for the containment reference '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites#getUser User}'. * * - * @return the meta object for the attribute 'User'. + * @return the meta object for the containment reference 'User'. * @see org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites#getUser() * @see #getPersonalLicenseRequisites() * @generated */ - EAttribute getPersonalLicenseRequisites_User(); + EReference getPersonalLicenseRequisites_User(); /** * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites Floating License Requisites}'. @@ -2452,15 +2491,15 @@ public interface LicensesPackage extends EPackage { EClass getFloatingLicenseRequisites(); /** - * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites#getCompany Company}'. + * Returns the meta object for the containment reference '{@link org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites#getCompany Company}'. * * - * @return the meta object for the attribute 'Company'. + * @return the meta object for the containment reference 'Company'. * @see org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites#getCompany() * @see #getFloatingLicenseRequisites() * @generated */ - EAttribute getFloatingLicenseRequisites_Company(); + EReference getFloatingLicenseRequisites_Company(); /** * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.ProductRef Product Ref}'. @@ -2494,6 +2533,81 @@ public interface LicensesPackage extends EPackage { */ EAttribute getProductRef_Version(); + /** + * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.UserRef User Ref}'. + * + * + * @return the meta object for class 'User Ref'. + * @see org.eclipse.passage.lic.licenses.model.api.UserRef + * @generated + */ + EClass getUserRef(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.UserRef#getIdentifier Identifier}'. + * + * + * @return the meta object for the attribute 'Identifier'. + * @see org.eclipse.passage.lic.licenses.model.api.UserRef#getIdentifier() + * @see #getUserRef() + * @generated + */ + EAttribute getUserRef_Identifier(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.UserRef#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.passage.lic.licenses.model.api.UserRef#getName() + * @see #getUserRef() + * @generated + */ + EAttribute getUserRef_Name(); + + /** + * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef Company Ref}'. + * + * + * @return the meta object for class 'Company Ref'. + * @see org.eclipse.passage.lic.licenses.model.api.CompanyRef + * @generated + */ + EClass getCompanyRef(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getIdentifier Identifier}'. + * + * + * @return the meta object for the attribute 'Identifier'. + * @see org.eclipse.passage.lic.licenses.model.api.CompanyRef#getIdentifier() + * @see #getCompanyRef() + * @generated + */ + EAttribute getCompanyRef_Identifier(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.passage.lic.licenses.model.api.CompanyRef#getName() + * @see #getCompanyRef() + * @generated + */ + EAttribute getCompanyRef_Name(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef#getInfo Info}'. + * + * + * @return the meta object for the attribute 'Info'. + * @see org.eclipse.passage.lic.licenses.model.api.CompanyRef#getInfo() + * @see #getCompanyRef() + * @generated + */ + EAttribute getCompanyRef_Info(); + /** * Returns the meta object for class '{@link org.eclipse.passage.lic.licenses.model.api.FloatingServer Floating Server}'. * diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesAdapterFactory.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesAdapterFactory.java index c6d9e2b61..cebebb25f 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesAdapterFactory.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesAdapterFactory.java @@ -19,19 +19,21 @@ import org.eclipse.emf.ecore.EObject; +import org.eclipse.passage.lic.licenses.CompanyRefDescriptor; import org.eclipse.passage.lic.licenses.EvaluationInstructionsDescriptor; import org.eclipse.passage.lic.licenses.FeatureGrantDescriptor; import org.eclipse.passage.lic.licenses.FloatingLicensePackDescriptor; import org.eclipse.passage.lic.licenses.FloatingLicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.FloatingServerDescriptor; import org.eclipse.passage.lic.licenses.LicenseGrantDescriptor; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; import org.eclipse.passage.lic.licenses.LicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.PersonalLicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.ProductRefDescriptor; import org.eclipse.passage.lic.licenses.UserGrantDescriptor; +import org.eclipse.passage.lic.licenses.UserRefDescriptor; import org.eclipse.passage.lic.licenses.ValidityPeriodClosedDescriptor; import org.eclipse.passage.lic.licenses.ValidityPeriodDescriptor; import org.eclipse.passage.lic.licenses.VersionMatchDescriptor; @@ -106,7 +108,7 @@ public Adapter caseLicensePlanFeatureDescriptor(LicensePlanFeatureDescriptor obj } @Override - public Adapter caseLicensePackDescriptor(LicensePackDescriptor object) { + public Adapter caseLicensePackDescriptor(PersonalLicensePackDescriptor object) { return createLicensePackDescriptorAdapter(); } @@ -120,6 +122,16 @@ public Adapter caseProductRefDescriptor(ProductRefDescriptor object) { return createProductRefDescriptorAdapter(); } + @Override + public Adapter caseUserRefDescriptor(UserRefDescriptor object) { + return createUserRefDescriptorAdapter(); + } + + @Override + public Adapter caseCompanyRefDescriptor(CompanyRefDescriptor object) { + return createCompanyRefDescriptorAdapter(); + } + @Override public Adapter caseLicenseRequisitesDescriptor(LicenseRequisitesDescriptor object) { return createLicenseRequisitesDescriptorAdapter(); @@ -186,8 +198,8 @@ public Adapter caseLicensePlanFeature(LicensePlanFeature object) { } @Override - public Adapter caseLicensePack(LicensePack object) { - return createLicensePackAdapter(); + public Adapter casePersonalLicensePack(PersonalLicensePack object) { + return createPersonalLicensePackAdapter(); } @Override @@ -220,6 +232,16 @@ public Adapter caseProductRef(ProductRef object) { return createProductRefAdapter(); } + @Override + public Adapter caseUserRef(UserRef object) { + return createUserRefAdapter(); + } + + @Override + public Adapter caseCompanyRef(CompanyRef object) { + return createCompanyRefAdapter(); + } + @Override public Adapter caseFloatingServer(FloatingServer object) { return createFloatingServerAdapter(); @@ -318,13 +340,13 @@ public Adapter createLicensePlanFeatureDescriptorAdapter() { } /** - * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.LicensePackDescriptor License Pack Descriptor}'. + * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor License Pack Descriptor}'. * * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * * @return the new adapter. - * @see org.eclipse.passage.lic.licenses.LicensePackDescriptor + * @see org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor * @generated */ public Adapter createLicensePackDescriptorAdapter() { @@ -359,6 +381,34 @@ public Adapter createProductRefDescriptorAdapter() { return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.UserRefDescriptor User Ref Descriptor}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.passage.lic.licenses.UserRefDescriptor + * @generated + */ + public Adapter createUserRefDescriptorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.CompanyRefDescriptor Company Ref Descriptor}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.passage.lic.licenses.CompanyRefDescriptor + * @generated + */ + public Adapter createCompanyRefDescriptorAdapter() { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.LicenseRequisitesDescriptor License Requisites Descriptor}'. * @@ -542,16 +592,16 @@ public Adapter createLicensePlanFeatureAdapter() { } /** - * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.model.api.LicensePack License Pack}'. + * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack Personal License Pack}'. * * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * * @return the new adapter. - * @see org.eclipse.passage.lic.licenses.model.api.LicensePack + * @see org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack * @generated */ - public Adapter createLicensePackAdapter() { + public Adapter createPersonalLicensePackAdapter() { return null; } @@ -639,6 +689,34 @@ public Adapter createProductRefAdapter() { return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.model.api.UserRef User Ref}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.passage.lic.licenses.model.api.UserRef + * @generated + */ + public Adapter createUserRefAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.model.api.CompanyRef Company Ref}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.passage.lic.licenses.model.api.CompanyRef + * @generated + */ + public Adapter createCompanyRefAdapter() { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.licenses.model.api.FloatingServer Floating Server}'. * diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceImpl.java index 4ee9c311c..6f9ab7cb4 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceImpl.java @@ -21,15 +21,14 @@ /** * The Resource associated with the package. * - * * @see org.eclipse.passage.lic.licenses.model.util.LicensesResourceFactoryImpl * @generated */ public class LicensesResourceImpl extends XMIResourceImpl { /** - * Creates an instance of the resource. - * * @param uri the URI of the new resource. * @generated */ diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesSwitch.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesSwitch.java index 90a4bbad0..fb2ac01c7 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesSwitch.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesSwitch.java @@ -17,19 +17,21 @@ import org.eclipse.emf.ecore.util.Switch; +import org.eclipse.passage.lic.licenses.CompanyRefDescriptor; import org.eclipse.passage.lic.licenses.EvaluationInstructionsDescriptor; import org.eclipse.passage.lic.licenses.FeatureGrantDescriptor; import org.eclipse.passage.lic.licenses.FloatingLicensePackDescriptor; import org.eclipse.passage.lic.licenses.FloatingLicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.FloatingServerDescriptor; import org.eclipse.passage.lic.licenses.LicenseGrantDescriptor; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; import org.eclipse.passage.lic.licenses.LicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.PersonalLicenseRequisitesDescriptor; import org.eclipse.passage.lic.licenses.ProductRefDescriptor; import org.eclipse.passage.lic.licenses.UserGrantDescriptor; +import org.eclipse.passage.lic.licenses.UserRefDescriptor; import org.eclipse.passage.lic.licenses.ValidityPeriodClosedDescriptor; import org.eclipse.passage.lic.licenses.ValidityPeriodDescriptor; import org.eclipse.passage.lic.licenses.VersionMatchDescriptor; @@ -110,7 +112,7 @@ protected T doSwitch(int classifierID, EObject theEObject) { return result; } case LicensesPackage.LICENSE_PACK_DESCRIPTOR: { - LicensePackDescriptor licensePackDescriptor = (LicensePackDescriptor) theEObject; + PersonalLicensePackDescriptor licensePackDescriptor = (PersonalLicensePackDescriptor) theEObject; T result = caseLicensePackDescriptor(licensePackDescriptor); if (result == null) result = defaultCase(theEObject); @@ -130,6 +132,20 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = defaultCase(theEObject); return result; } + case LicensesPackage.USER_REF_DESCRIPTOR: { + UserRefDescriptor userRefDescriptor = (UserRefDescriptor) theEObject; + T result = caseUserRefDescriptor(userRefDescriptor); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case LicensesPackage.COMPANY_REF_DESCRIPTOR: { + CompanyRefDescriptor companyRefDescriptor = (CompanyRefDescriptor) theEObject; + T result = caseCompanyRefDescriptor(companyRefDescriptor); + if (result == null) + result = defaultCase(theEObject); + return result; + } case LicensesPackage.LICENSE_REQUISITES_DESCRIPTOR: { LicenseRequisitesDescriptor licenseRequisitesDescriptor = (LicenseRequisitesDescriptor) theEObject; T result = caseLicenseRequisitesDescriptor(licenseRequisitesDescriptor); @@ -229,11 +245,11 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = defaultCase(theEObject); return result; } - case LicensesPackage.LICENSE_PACK: { - LicensePack licensePack = (LicensePack) theEObject; - T result = caseLicensePack(licensePack); + case LicensesPackage.PERSONAL_LICENSE_PACK: { + PersonalLicensePack personalLicensePack = (PersonalLicensePack) theEObject; + T result = casePersonalLicensePack(personalLicensePack); if (result == null) - result = caseLicensePackDescriptor(licensePack); + result = caseLicensePackDescriptor(personalLicensePack); if (result == null) result = defaultCase(theEObject); return result; @@ -300,6 +316,24 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = defaultCase(theEObject); return result; } + case LicensesPackage.USER_REF: { + UserRef userRef = (UserRef) theEObject; + T result = caseUserRef(userRef); + if (result == null) + result = caseUserRefDescriptor(userRef); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case LicensesPackage.COMPANY_REF: { + CompanyRef companyRef = (CompanyRef) theEObject; + T result = caseCompanyRef(companyRef); + if (result == null) + result = caseCompanyRefDescriptor(companyRef); + if (result == null) + result = defaultCase(theEObject); + return result; + } case LicensesPackage.FLOATING_SERVER: { FloatingServer floatingServer = (FloatingServer) theEObject; T result = caseFloatingServer(floatingServer); @@ -434,7 +468,7 @@ public T caseLicensePlanFeatureDescriptor(LicensePlanFeatureDescriptor object) { * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseLicensePackDescriptor(LicensePackDescriptor object) { + public T caseLicensePackDescriptor(PersonalLicensePackDescriptor object) { return null; } @@ -468,6 +502,36 @@ public T caseProductRefDescriptor(ProductRefDescriptor object) { return null; } + /** + * Returns the result of interpreting the object as an instance of 'User Ref Descriptor'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'User Ref Descriptor'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseUserRefDescriptor(UserRefDescriptor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Company Ref Descriptor'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Company Ref Descriptor'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCompanyRefDescriptor(CompanyRefDescriptor object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'License Requisites Descriptor'. * @@ -664,17 +728,17 @@ public T caseLicensePlanFeature(LicensePlanFeature object) { } /** - * Returns the result of interpreting the object as an instance of 'License Pack'. + * Returns the result of interpreting the object as an instance of 'Personal License Pack'. * * This implementation returns null; * returning a non-null result will terminate the switch. * * @param object the target of the switch. - * @return the result of interpreting the object as an instance of 'License Pack'. + * @return the result of interpreting the object as an instance of 'Personal License Pack'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseLicensePack(LicensePack object) { + public T casePersonalLicensePack(PersonalLicensePack object) { return null; } @@ -768,6 +832,36 @@ public T caseProductRef(ProductRef object) { return null; } + /** + * Returns the result of interpreting the object as an instance of 'User Ref'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'User Ref'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseUserRef(UserRef object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Company Ref'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Company Ref'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCompanyRef(CompanyRef object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'Floating Server'. * diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java index 37267413a..9145ee419 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java @@ -18,9 +18,9 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; -public final class AssignGrantIdentifiers implements Consumer { +public final class AssignGrantIdentifiers implements Consumer { private final Predicate predicate; @@ -29,9 +29,9 @@ public AssignGrantIdentifiers() { } @Override - public void accept(LicensePack pack) { - String identifier = pack.getIdentifier(); - EList grants = pack.getLicenseGrants(); + public void accept(PersonalLicensePack pack) { + String identifier = pack.getLicense().getIdentifier(); + EList grants = pack.getGrants(); for (int i = 0; i < grants.size(); i++) { LicenseGrant grant = grants.get(i); if (Optional.ofNullable(grant.getIdentifier()).filter(predicate).isPresent()) { diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyFloatingLicensePack.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyFloatingLicensePack.java new file mode 100644 index 000000000..549516d8f --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyFloatingLicensePack.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2021 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.internal.licenses.model; + +import java.util.function.Supplier; + +import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; +import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseRequisites; +import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; + +public final class EmptyFloatingLicensePack implements Supplier { + + @Override + public FloatingLicensePack get() { + FloatingLicensePack pack = LicensesFactory.eINSTANCE.createFloatingLicensePack(); + pack.setLicense(requisites()); + return pack; + } + + private FloatingLicenseRequisites requisites() { + FloatingLicenseRequisites license = LicensesFactory.eINSTANCE.createFloatingLicenseRequisites(); + license.setCompany(LicensesFactory.eINSTANCE.createCompanyRef()); + license.setProduct(LicensesFactory.eINSTANCE.createProductRef()); + license.setValid(LicensesFactory.eINSTANCE.createValidityPeriodClosed()); + return license; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyPersonalLicensePack.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyPersonalLicensePack.java new file mode 100644 index 000000000..3c68d2792 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/EmptyPersonalLicensePack.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2021 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.internal.licenses.model; + +import java.util.function.Supplier; + +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; +import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; + +public final class EmptyPersonalLicensePack implements Supplier { + + @Override + public PersonalLicensePack get() { + PersonalLicensePack pack = LicensesFactory.eINSTANCE.createPersonalLicensePack(); + pack.setLicense(requisites()); + return pack; + } + + private PersonalLicenseRequisites requisites() { + PersonalLicenseRequisites license = LicensesFactory.eINSTANCE.createPersonalLicenseRequisites(); + license.setUser(LicensesFactory.eINSTANCE.createUserRef()); + license.setProduct(LicensesFactory.eINSTANCE.createProductRef()); + license.setValid(LicensesFactory.eINSTANCE.createValidityPeriodClosed()); + return license; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java index 4338c7730..8b30df485 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java @@ -27,7 +27,7 @@ import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; import org.eclipse.passage.lic.internal.emf.migration.DelegateClassifiers; import org.eclipse.passage.lic.internal.licenses.model.AssignGrantIdentifiers; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; public class LicensesResourceHandler extends MigratingResourceHandler { @@ -45,14 +45,14 @@ protected void ensureMigrations() { public void postLoad(XMLResource resource, InputStream inputStream, Map options) { super.postLoad(resource, inputStream, options); resource.getContents().stream()// - .filter(LicensePack.class::isInstance)// - .map(LicensePack.class::cast).forEach(new AssignGrantIdentifiers()); + .filter(PersonalLicensePack.class::isInstance)// + .map(PersonalLicensePack.class::cast).forEach(new AssignGrantIdentifiers()); } @Override protected void convertEntry(Entry entry) { EObject key = entry.getKey(); - if (key instanceof LicensePack) { + if (key instanceof PersonalLicensePack) { // LicensePack pack = (LicensePack) key; SimpleFeatureRoutes route = new SimpleFeatureRoutes(); route.add("productIdentifier", LicensesPackage.eINSTANCE.getProductRef_Identifier()); //$NON-NLS-1$ @@ -68,7 +68,7 @@ private void migrate033() { String nsUri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ LicensesPackage delegate = LicensesPackage.eINSTANCE; List classifiers = new ArrayList<>(); - classifiers.add(delegate.getLicensePack().getName()); + classifiers.add(delegate.getPersonalLicensePack().getName()); classifiers.add(delegate.getLicenseGrant().getName()); new DelegateClassifiers(nsUri).delegate(delegate, classifiers); } diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java index 171ec91db..2a8ea3ee9 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java @@ -40,19 +40,20 @@ import org.eclipse.passage.lic.internal.base.conditions.MatchingRuleForIdentifier; import org.eclipse.passage.lic.internal.licenses.model.migration.LicensesResourceHandler; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; +@SuppressWarnings("restriction") abstract class BaseXmiConditionTransport implements ConditionTransport { private final ContentType type = new ContentType.Xml(); - private final Predicate filter; + private final Predicate filter; protected BaseXmiConditionTransport() { this(p -> true); } - protected BaseXmiConditionTransport(Predicate filter) { + protected BaseXmiConditionTransport(Predicate filter) { this.filter = filter; } @@ -67,10 +68,10 @@ public Collection read(InputStream input) throws IOException { Resource resource = new XMIResourceImpl(); resource.load(input, loadOptions()); return resource.getContents().stream() // - .filter(LicensePack.class::isInstance) // - .map(LicensePack.class::cast) // + .filter(PersonalLicensePack.class::isInstance) // + .map(PersonalLicensePack.class::cast) // .filter(filter) // - .map(LicensePack::getLicenseGrants) // + .map(PersonalLicensePack::getGrants) // .flatMap(i -> StreamSupport.stream(i.spliterator(), false)) // .map(this::condition) // .collect(Collectors.toList()); diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/UserFilteringConditionTransport.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/UserFilteringConditionTransport.java index 3a9ba3628..a5ad24973 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/UserFilteringConditionTransport.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/UserFilteringConditionTransport.java @@ -18,7 +18,7 @@ public final class UserFilteringConditionTransport extends BaseXmiConditionTransport { public UserFilteringConditionTransport(Supplier user) { - super(pack -> user.get().equals(pack.getUserIdentifier())); + super(pack -> user.get().equals(pack.getLicense().getUser().getIdentifier())); Objects.requireNonNull(user, "UserFilteringConditionTransport::user"); //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/FloatingLicenseRequisitesDescriptor.java b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/FloatingLicenseRequisitesDescriptor.java index 74ca7285e..a1289b3f0 100644 --- a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/FloatingLicenseRequisitesDescriptor.java +++ b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/FloatingLicenseRequisitesDescriptor.java @@ -17,6 +17,6 @@ */ public interface FloatingLicenseRequisitesDescriptor extends LicenseRequisitesDescriptor { - String getCompany(); + CompanyRefDescriptor getCompany(); } diff --git a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicenseGrantDescriptor.java b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicenseGrantDescriptor.java index f52077c92..bfd279385 100644 --- a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicenseGrantDescriptor.java +++ b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicenseGrantDescriptor.java @@ -22,7 +22,7 @@ *

* * @since 0.4.0 - * @see LicensePackDescriptor + * @see PersonalLicensePackDescriptor */ public interface LicenseGrantDescriptor { @@ -110,6 +110,6 @@ public interface LicenseGrantDescriptor { * * @return the license pack */ - LicensePackDescriptor getLicensePack(); + PersonalLicensePackDescriptor getLicensePack(); } diff --git a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePackDescriptor.java b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePackDescriptor.java deleted file mode 100644 index 177c7aa27..000000000 --- a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePackDescriptor.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2020 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; - -import java.util.Date; -import java.util.List; - -/** - *

- * A "License Pack" is a container for - * "License Grant"(s). Created by "Operator" and - * transferred to the "User" to be evaluated at runtime for the - * given "Licensing Configuration". - *

- * - * @since 0.4.0 - * @see LicenseGrantDescriptor - */ -public interface LicensePackDescriptor { - - /** - * Returns the identifier of this license pack. This is the value of its - * "identifier" attribute. - * - * @return the identifier - */ - String getIdentifier(); - - /** - * Returns the date of issue of this license pack. This is the value of its - * "issueDate" attribute. - * - * @return the issue date - * - * @since 0.5.0 - */ - Date getIssueDate(); - - /** - * Returns the "User"" identifier of this license pack. This is the - * value of its "userIdentifier" attribute. - * - * @return the user identifier - */ - String getUserIdentifier(); - - /** - * Returns the "User"" full name of this license pack. This is the - * value of its "userFullName" attribute. - * - * @return the user full name - */ - String getUserFullName(); - - /** - * Returns the request identifier of this license pack, i.e. the initial request - * to obtain this license pack. This is the value of its - * "requestIdentifier" attribute. - * - * @return the request identifier - * - * @since 0.5.0 - */ - String getRequestIdentifier(); - - /** - * Returns the "License Plan"" identifier of this license pack. - * This is the value of its "planIdentifier" attribute. - * - * @return the plan identifier - * - * @since 0.5.0 - */ - String getPlanIdentifier(); - - /** - * Returns the "Product"" identifier of this license pack. This is - * the value of its "productIdentifier" attribute. - * - * @return the product identifier - */ - String getProductIdentifier(); - - /** - * Returns the "Product Version"" version of this license pack. - * This is the value of its "productVersion" attribute. - * - * @return the product version - */ - String getProductVersion(); - - /** - * Returns the "License Grant"(s) contained in this license pack. - * This is the value of its "licenseGrants" reference. - * - * @return the license grants - * @since 2.0 - */ - List getLicenseGrants(); - -} diff --git a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePlanDescriptor.java b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePlanDescriptor.java index b0ab7c6fd..6059fd5d0 100644 --- a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePlanDescriptor.java +++ b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/LicensePlanDescriptor.java @@ -22,7 +22,7 @@ *

* * @since 0.5.0 - * @see LicensePackDescriptor + * @see PersonalLicensePackDescriptor */ public interface LicensePlanDescriptor { @@ -62,7 +62,7 @@ public interface LicensePlanDescriptor { /** * @since 2.0 */ - List getPersonal(); + List getPersonal(); /** * @since 2.0 diff --git a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicensePackDescriptor.java b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicensePackDescriptor.java new file mode 100644 index 000000000..3c8928f5d --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicensePackDescriptor.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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; + +import java.util.List; + +/** + *

+ * A "License Pack" is a container for + * "License Grant"(s). Created by "Operator" and + * transferred to the "User" to be evaluated at runtime for the + * given "Licensing Configuration". + *

+ * + * @since 2.0 + * @see LicenseGrantDescriptor + */ +public interface PersonalLicensePackDescriptor { + + /** + * @since 2.0 + */ + PersonalLicenseRequisitesDescriptor getLicense(); + + /** + * @since 2.0 + */ + List getGrants(); + +} diff --git a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicenseRequisitesDescriptor.java b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicenseRequisitesDescriptor.java index 3b21ca055..baf3b1fbe 100644 --- a/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicenseRequisitesDescriptor.java +++ b/bundles/org.eclipse.passage.lic.licenses/src/org/eclipse/passage/lic/licenses/PersonalLicenseRequisitesDescriptor.java @@ -17,6 +17,6 @@ */ public interface PersonalLicenseRequisitesDescriptor extends LicenseRequisitesDescriptor { - String getUser(); + UserRefDescriptor getUser(); } diff --git a/bundles/org.eclipse.passage.loc.api/.settings/.api_filters b/bundles/org.eclipse.passage.loc.api/.settings/.api_filters deleted file mode 100644 index 8a7d7c147..000000000 --- a/bundles/org.eclipse.passage.loc.api/.settings/.api_filters +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF index e9be3b66f..e01d2cde3 100644 --- a/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Automatic-Module-Name: org.eclipse.passage.loc.api Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.passage.loc.api -Bundle-Version: 1.1.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor Bundle-Copyright: %Bundle-Copyright diff --git a/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/IssuedLicense.java b/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/IssuedLicense.java index 172c1a7c0..e1d5da94f 100644 --- a/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/IssuedLicense.java +++ b/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/IssuedLicense.java @@ -14,11 +14,11 @@ import java.nio.file.Path; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; public interface IssuedLicense { - LicensePack license(); + PersonalLicensePack license(); Path encrypted(); diff --git a/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseEvents.java b/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseEvents.java index af884c07d..8e9f4a786 100644 --- a/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseEvents.java +++ b/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseEvents.java @@ -29,12 +29,12 @@ private OperatorLicenseEvents() { public static final String TOPIC = "org/eclipse/passage/loc/api/OperatorLicenseEvents"; //$NON-NLS-1$ /** - * Sent when decoded {@link LicensePack} is issued + * Sent when decoded {@link PersonalLicensePack} is issued */ public static final String DECODED_ISSUED = TOPIC + TOPIC_SEP + "decodedIssued"; //$NON-NLS-1$ /** - * Sent when encoded {@link LicensePack} is issued in encoded form + * Sent when encoded {@link PersonalLicensePack} is issued in encoded form */ public static final String ENCODED_ISSUED = TOPIC + TOPIC_SEP + "encodedIssued"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseService.java b/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseService.java index 98b29b032..27fee5154 100644 --- a/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseService.java +++ b/bundles/org.eclipse.passage.loc.api/src/org/eclipse/passage/loc/internal/api/OperatorLicenseService.java @@ -16,7 +16,7 @@ import java.util.Optional; import org.eclipse.passage.lic.internal.api.ServiceInvocationResult; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; @@ -30,7 +30,7 @@ public interface OperatorLicenseService { * * @since 0.5.0 */ - LicensePackDescriptor createLicensePack(PersonalLicenseRequest request); + PersonalLicensePackDescriptor createLicensePack(PersonalLicenseRequest request); /** * Physically issue new Personal License Pack according to all the data supplied @@ -39,7 +39,7 @@ public interface OperatorLicenseService { * @since 0.5.0 */ ServiceInvocationResult issueLicensePack(PersonalLicenseRequest request, - LicensePackDescriptor template); + PersonalLicensePackDescriptor template); /** * Create new instance of Floating License Pack to be verified and issued. Base diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java index ef2068f86..4f01fdd42 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java @@ -57,7 +57,7 @@ private void open(IEclipseContext context, Wizard wizard) { dialog.create(); Shell shell = dialog.getShell(); // TODO: floating license pack icon - shell.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getLicensePack().getName())); + shell.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getPersonalLicensePack().getName())); shell.setSize(Math.max(800, shell.getSize().x), 700); dialog.open(); } diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java index 0f4f6904f..ac57e23a9 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java @@ -64,7 +64,7 @@ private void open(Shell shell, IssueLicenseWizard wizard) { private void shape(WizardDialog dialog) { Shell shell = dialog.getShell(); - shell.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getLicensePack().getName())); + shell.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getPersonalLicensePack().getName())); shell.setSize(Math.max(500, shell.getSize().x), 500); } diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DefaultDashboardPanelAdvisor.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DefaultDashboardPanelAdvisor.java index 019403488..3c6fa0246 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DefaultDashboardPanelAdvisor.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DefaultDashboardPanelAdvisor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -290,7 +290,7 @@ private void appendSummary(Composite parent, GridDataFactory gdf) { private void appendIssueLicenseButton(Composite parent, GridDataFactory gdf, // String text, String tooltip, Runnable issuing) { Button issue = new Button(parent, SWT.PUSH); - issue.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getLicensePack().getName())); + issue.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getPersonalLicensePack().getName())); issue.setLayoutData(gdf.create()); issue.setText(text); issue.setToolTipText(tooltip); diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseDetailsPage.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseDetailsPage.java index 94708f61f..8ff383a35 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseDetailsPage.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseDetailsPage.java @@ -21,7 +21,7 @@ import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.passage.lic.email.Mailing; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.loc.internal.dashboard.ui.i18n.IssueLicensePageMessages; import org.eclipse.passage.loc.internal.licenses.core.EmailTemplate; import org.eclipse.swt.SWT; @@ -34,12 +34,12 @@ public class IssueLicenseDetailsPage extends WizardPage { private final IEclipseContext context; - private final Supplier data; + private final Supplier data; private Text info; private Text from; private String mailFrom = ""; //$NON-NLS-1$ - protected IssueLicenseDetailsPage(String pageName, Supplier data, IEclipseContext context) { + protected IssueLicenseDetailsPage(String pageName, Supplier data, IEclipseContext context) { super(pageName); this.context = context; this.data = data; diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicensePackPage.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicensePackPage.java index 510ac2811..63644e2df 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicensePackPage.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicensePackPage.java @@ -29,9 +29,9 @@ import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.passage.lic.emf.validation.ErrorMessages; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.loc.internal.api.OperatorLicenseService; import org.eclipse.passage.loc.internal.api.PersonalLicenseRequest; import org.eclipse.passage.loc.internal.dashboard.ui.i18n.IssueLicensePageMessages; @@ -45,7 +45,7 @@ public class IssueLicensePackPage extends WizardPage { private final IEclipseContext context; private final Supplier data; private final ErrorMessages validate; - private LicensePack license; + private PersonalLicensePack license; private VViewModelProperties properties; private Composite base; @@ -61,11 +61,11 @@ protected IssueLicensePackPage(String name, Supplier dat public void init() { PersonalLicenseRequest request = data.get(); if (license != null) { - license.setPlanIdentifier(request.plan()); - license.setProductIdentifier(request.productIdentifier()); - license.setProductVersion(request.productVersion()); - license.setUserIdentifier(request.user()); - EList licenseGrants = license.getLicenseGrants(); + license.getLicense().setPlan(request.plan()); + license.getLicense().getProduct().setIdentifier(request.productIdentifier()); + license.getLicense().getProduct().setVersion(request.productVersion()); + license.getLicense().getUser().setIdentifier(request.user()); + EList licenseGrants = license.getGrants(); for (LicenseGrant licenseGrant : licenseGrants) { licenseGrant.setValidFrom(request.validFrom()); licenseGrant.setValidUntil(request.validUntil()); @@ -73,9 +73,9 @@ public void init() { return; } OperatorLicenseService operatorLicenseService = context.get(OperatorLicenseService.class); - LicensePackDescriptor licensePackDescriptor = operatorLicenseService.createLicensePack(request); - if (licensePackDescriptor instanceof LicensePack) { - license = (LicensePack) licensePackDescriptor; + PersonalLicensePackDescriptor licensePackDescriptor = operatorLicenseService.createLicensePack(request); + if (licensePackDescriptor instanceof PersonalLicensePack) { + license = (PersonalLicensePack) licensePackDescriptor; license.eAdapters().add(new EContentAdapter() { @Override public void notifyChanged(Notification notification) { @@ -123,7 +123,7 @@ protected boolean validatePage() { return errors.isEmpty(); } - public LicensePackDescriptor pack() { + public PersonalLicensePackDescriptor pack() { return license; } diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseWizard.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseWizard.java index 0d2aeddc0..8961c9fa2 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseWizard.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/IssueLicenseWizard.java @@ -25,8 +25,8 @@ import org.eclipse.passage.lic.internal.api.ServiceInvocationResult; import org.eclipse.passage.lic.internal.base.diagnostic.NoSevereErrors; import org.eclipse.passage.lic.internal.jface.dialogs.licensing.DiagnosticDialog; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.loc.dashboard.ui.wizards.license.WizardInfoBar; import org.eclipse.passage.loc.internal.api.IssuedLicense; import org.eclipse.passage.loc.internal.api.OperatorLicenseService; @@ -74,7 +74,7 @@ public IWizardPage getNextPage(IWizardPage page) { @Override public boolean performFinish() { OperatorLicenseService licenseService = context.get(OperatorLicenseService.class); - LicensePackDescriptor licensePack = pack.pack(); + PersonalLicensePackDescriptor licensePack = pack.pack(); ServiceInvocationResult result = licenseService.issueLicensePack(request.request(), licensePack); if (!new NoSevereErrors().test(result.diagnostic())) { new WizardInfoBar(this).installError("Export failed"); //$NON-NLS-1$ @@ -92,7 +92,7 @@ public boolean performFinish() { } } - private void processingMail(String from, LicensePackDescriptor licensePack, IssuedLicense result) { + private void processingMail(String from, PersonalLicensePackDescriptor licensePack, IssuedLicense result) { Mailing mailing = context.get(Mailing.class); EmailTemplate template = new EmailTemplate(mailing); try { @@ -109,7 +109,7 @@ private void processingMail(String from, LicensePackDescriptor licensePack, Issu } private void broadcast(IssuedLicense result) { - LicensePack userLicense = result.license(); + PersonalLicensePack userLicense = result.license(); String perspectiveId = UsersUi.PERSPECTIVE_MAIN; LocWokbench.switchPerspective(context, perspectiveId); IEventBroker broker = context.get(IEventBroker.class); diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/BaseIssuedLicense.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/BaseIssuedLicense.java index bb5fd4594..5377a0e19 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/BaseIssuedLicense.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/BaseIssuedLicense.java @@ -15,17 +15,17 @@ import java.nio.file.Path; import java.util.Objects; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.loc.internal.api.IssuedLicense; @SuppressWarnings("restriction") final class BaseIssuedLicense implements IssuedLicense { - private final LicensePack license; + private final PersonalLicensePack license; private final Path encrypted; private final Path decrypted; - BaseIssuedLicense(LicensePack license, Path encrypted, Path decrypted) { + BaseIssuedLicense(PersonalLicensePack license, Path encrypted, Path decrypted) { Objects.requireNonNull(license, "BaseIssuedLicense::license"); //$NON-NLS-1$ Objects.requireNonNull(encrypted, "BaseIssuedLicense::encrypted"); //$NON-NLS-1$ Objects.requireNonNull(decrypted, "BaseIssuedLicense::decrypted"); //$NON-NLS-1$ @@ -35,7 +35,7 @@ final class BaseIssuedLicense implements IssuedLicense { } @Override - public LicensePack license() { + public PersonalLicensePack license() { return license; } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/EmailTemplate.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/EmailTemplate.java index e47a2c1a1..658a99f87 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/EmailTemplate.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/EmailTemplate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 ArSysOp + * Copyright (c) 2019, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -29,7 +29,7 @@ import org.eclipse.passage.lic.email.EmailDescriptor; import org.eclipse.passage.lic.email.Mailing; import org.eclipse.passage.lic.licenses.LicenseGrantDescriptor; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.loc.internal.api.IssuedLicense; import org.eclipse.passage.loc.internal.licenses.core.i18n.LicensesCoreMessages; @@ -45,17 +45,19 @@ public EmailTemplate(Mailing mailing) { this.mailing = mailing; } - public List details(LicensePackDescriptor licensePack) { + public List details(PersonalLicensePackDescriptor pack) { List builder = new ArrayList<>(); - builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_request_lbl, licensePack.getRequestIdentifier())); + builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_request_lbl, pack.getLicense().getIdentifier())); builder.add(""); //$NON-NLS-1$ - builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_plan_lbl, licensePack.getPlanIdentifier())); - Optional.ofNullable(licensePack.getIdentifier())// + builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_plan_lbl, pack.getLicense().getPlan())); + Optional.ofNullable(pack.getLicense().getIdentifier())// .ifPresent(x -> builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_package_lbl, x))); builder.add(""); //$NON-NLS-1$ - builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_product_lbl, licensePack.getProductIdentifier())); - builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_product_version_lbl, licensePack.getProductVersion())); - for (LicenseGrantDescriptor grant : licensePack.getLicenseGrants()) { + builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_product_lbl, + pack.getLicense().getProduct().getIdentifier())); + builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_product_version_lbl, + pack.getLicense().getProduct().getVersion())); + for (LicenseGrantDescriptor grant : pack.getGrants()) { builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_feature_lbl, grant.getFeatureIdentifier())); String conditionExpression = grant.getConditionExpression(); if (conditionExpression != null && !conditionExpression.isEmpty()) { @@ -63,37 +65,39 @@ public List details(LicensePackDescriptor licensePack) { } } builder.add(""); //$NON-NLS-1$ - builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_user_lbl, licensePack.getUserIdentifier())); - builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_user_name_lbl, licensePack.getUserFullName())); + builder.add( + NLS.bind(LicensesCoreMessages.LicenseRequest_user_lbl, pack.getLicense().getUser().getIdentifier())); + builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_user_name_lbl, pack.getLicense().getUser().getName())); builder.add(""); //$NON-NLS-1$ - Optional.ofNullable(licensePack.getIssueDate())// + Optional.ofNullable(pack.getLicense().getIssueDate())// .ifPresent(x -> builder.add(NLS.bind(LicensesCoreMessages.LicenseRequest_issue_date_lbl, x))); builder.add(""); //$NON-NLS-1$ return builder; } - public String mailTo(LicensePackDescriptor licensePack) { + public String mailTo(PersonalLicensePackDescriptor pack) { StringBuilder builder = new StringBuilder("mailto:"); //$NON-NLS-1$ - builder.append(licensePack.getUserIdentifier()); + builder.append(pack.getLicense().getUser().getIdentifier()); builder.append("?subject="); //$NON-NLS-1$ builder.append(LicensesCoreMessages.LicenseRequest_mailto_subject_lbl); builder.append("&body="); //$NON-NLS-1$ - builder.append(NLS.bind(LicensesCoreMessages.LicenseRequest_mailto_appeal_lbl, licensePack.getUserFullName())); + builder.append( + NLS.bind(LicensesCoreMessages.LicenseRequest_mailto_appeal_lbl, pack.getLicense().getUser().getName())); builder.append(separator); builder.append(LicensesCoreMessages.LicenseRequest_mailto_body_base_lbl); builder.append(separator).append(separator); builder.append(LicensesCoreMessages.LicenseRequest_mailto_body_details_lbl); builder.append(separator); - builder.append(details(licensePack).stream().collect(Collectors.joining(separator))); + builder.append(details(pack).stream().collect(Collectors.joining(separator))); return builder.toString(); } - public File createEmlFile(String from, LicensePackDescriptor licensePack, IssuedLicense result) throws IOException { + public File createEmlFile(String from, PersonalLicensePackDescriptor licensePack, IssuedLicense result) throws IOException { File attachment = result.encrypted().toFile(); File emlFile = new File(attachment.toString() + dotEml); try (FileOutputStream stream = new FileOutputStream(emlFile)) { Mailing service = mailing; - EmailDescriptor descriptor = service.createMail(licensePack.getUserIdentifier(), from, + EmailDescriptor descriptor = service.createMail(licensePack.getLicense().getUser().getIdentifier(), from, LicensesCoreMessages.LicenseRequest_mailto_subject_lbl, // details(licensePack).stream().collect(Collectors.joining(System.lineSeparator())), // Collections.singleton(attachment.getPath())); 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 9425b3db3..78efcd9de 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 @@ -27,6 +27,7 @@ import org.eclipse.passage.lic.internal.base.inspection.hardware.Disk; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; +import org.eclipse.passage.lic.licenses.model.api.CompanyRef; import org.eclipse.passage.lic.licenses.model.api.EvaluationInstructions; import org.eclipse.passage.lic.licenses.model.api.FeatureGrant; import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; @@ -39,10 +40,12 @@ import org.eclipse.passage.lic.licenses.model.api.VersionMatch; import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; import org.eclipse.passage.lic.users.UserDescriptor; +import org.eclipse.passage.lic.users.UserOriginDescriptor; import org.eclipse.passage.loc.internal.api.FloatingLicenseRequest; import org.eclipse.passage.loc.internal.licenses.LicenseRegistry; import org.eclipse.passage.loc.internal.users.UserRegistry; +@SuppressWarnings("restriction") final class FloatingLicensePackFromRequest implements Supplier { private final FloatingLicenseRequest request; @@ -111,8 +114,13 @@ private String serverAuthenticationExpression() { .orElse(String.format("%s=%s", new Disk.Serial().toString(), "?")); //$NON-NLS-1$ //$NON-NLS-2$ } - private String company() { - return users.getUser(request.users().iterator().next()).getUserOrigin().getIdentifier(); + private CompanyRef company() { + UserOriginDescriptor origin = users.getUser(request.users().iterator().next()).getUserOrigin(); + CompanyRef company = LicensesFactory.eINSTANCE.createCompanyRef(); + company.setIdentifier(origin.getIdentifier()); + company.setName(origin.getName()); + company.setInfo(origin.getDescription()); + return company; } private ValidityPeriod period() { diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/IssuePersonalLicense.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/IssuePersonalLicense.java index da77c37d7..0748152a5 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/IssuePersonalLicense.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/IssuePersonalLicense.java @@ -30,7 +30,7 @@ import org.eclipse.passage.lic.internal.base.io.PassageFileExtension; import org.eclipse.passage.lic.internal.base.io.UserHomeProductResidence; import org.eclipse.passage.lic.internal.licenses.model.AssignGrantIdentifiers; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.loc.internal.api.IssuedLicense; import org.eclipse.passage.loc.internal.api.OperatorLicenseEvents; import org.eclipse.passage.loc.internal.api.OperatorProductService; @@ -58,8 +58,8 @@ final class IssuePersonalLicense { this.events = events; } - ServiceInvocationResult issue(Supplier template) { - LicensePack license = adjsut(EcoreUtil.copy(template.get())); + ServiceInvocationResult issue(Supplier template) { + PersonalLicensePack license = adjsut(EcoreUtil.copy(template.get())); Optional errors = new ErrorMessages().apply(license); if (errors.isPresent()) { return new BaseServiceInvocationResult<>(new Trouble(new LicenseValidationFailed(), errors.get())); @@ -70,13 +70,15 @@ ServiceInvocationResult issue(Supplier template) { return new BaseServiceInvocationResult<>(new Trouble(new LicenseIssuingFailed(), LicensesCoreMessages.LicenseOperatorServiceImpl_error_io, e)); } - LicensedProduct product = new BaseLicensedProduct(license.getProductIdentifier(), license.getProductVersion()); + LicensedProduct product = new BaseLicensedProduct(// + license.getLicense().getProduct().getIdentifier(), // + license.getLicense().getProduct().getVersion()); Path path = new UserHomeProductResidence(product).get(); Path decrypted; try { decrypted = new PersistedDecoded(path, license)// - .write(license.getIdentifier() + new PassageFileExtension.LicenseDecrypted().get()); + .write(license.getLicense().getIdentifier() + new PassageFileExtension.LicenseDecrypted().get()); events.postEvent(OperatorLicenseEvents.decodedIssued(decrypted.toString())); } catch (LicensingException e) { return new BaseServiceInvocationResult<>(new Trouble(new LicenseIssuingFailed(), @@ -86,7 +88,7 @@ ServiceInvocationResult issue(Supplier template) { Path encrypted; try { encrypted = new PersistedEncoded(product, decrypted, new ProductPassword(products, operator))// - .write(license.getIdentifier() + new PassageFileExtension.LicenseEncrypted().get()); + .write(license.getLicense().getIdentifier() + new PassageFileExtension.LicenseEncrypted().get()); } catch (LicensingException e) { return new BaseServiceInvocationResult<>(new Trouble(new LicenseIssuingFailed(), LicensesCoreMessages.LicenseOperatorServiceImpl_export_error, e)); @@ -95,10 +97,10 @@ ServiceInvocationResult issue(Supplier template) { return new BaseServiceInvocationResult<>(new BaseIssuedLicense(license, encrypted, decrypted)); } - private LicensePack adjsut(LicensePack license) { + private PersonalLicensePack adjsut(PersonalLicensePack license) { Date issueDate = new Date(); - license.setIdentifier(UUID.randomUUID().toString()); - license.setIssueDate(issueDate); + license.getLicense().setIdentifier(UUID.randomUUID().toString()); + license.getLicense().setIssueDate(issueDate); new AssignGrantIdentifiers().accept(license); new PersonalLicenseIssuingProtection().accept(license); return license; diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseOperatorServiceImpl.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseOperatorServiceImpl.java index 410c9ebf6..02a833da3 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseOperatorServiceImpl.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseOperatorServiceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -19,10 +19,10 @@ import org.eclipse.osgi.service.environment.EnvironmentInfo; import org.eclipse.passage.lic.internal.api.ServiceInvocationResult; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.loc.internal.api.FloatingLicenseRequest; import org.eclipse.passage.loc.internal.api.IssuedFloatingLicense; import org.eclipse.passage.loc.internal.api.IssuedLicense; @@ -114,17 +114,17 @@ public void unbindProductOperatorService(OperatorProductService productService) } @Override - public LicensePack createLicensePack(PersonalLicenseRequest request) { + public PersonalLicensePack createLicensePack(PersonalLicenseRequest request) { return new PersonalLicensePackFromRequest(request, licenses).get(); } @Override public ServiceInvocationResult issueLicensePack(PersonalLicenseRequest request, - LicensePackDescriptor template) { + PersonalLicensePackDescriptor template) { Objects.requireNonNull(request, "LicenseOperatorServiceImpl::issueLicensePack: cannot issue license for null request"); //$NON-NLS-1$ - Supplier pack = (template instanceof LicensePack) // - ? () -> LicensePack.class.cast(template)// + Supplier pack = (template instanceof PersonalLicensePack) // + ? () -> PersonalLicensePack.class.cast(template)// : () -> createLicensePack(request); return new IssuePersonalLicense(licenses, products, operator, events).issue(pack); } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/PersonalLicensePackFromRequest.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/PersonalLicensePackFromRequest.java index ee43fe168..c51838853 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/PersonalLicensePackFromRequest.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/PersonalLicensePackFromRequest.java @@ -14,16 +14,15 @@ import java.util.function.Supplier; -import org.eclipse.emf.common.util.EList; +import org.eclipse.passage.lic.internal.licenses.model.EmptyPersonalLicensePack; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; -import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; -import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.loc.internal.api.PersonalLicenseRequest; import org.eclipse.passage.loc.internal.licenses.LicenseRegistry; -final class PersonalLicensePackFromRequest implements Supplier { +@SuppressWarnings("restriction") +final class PersonalLicensePackFromRequest implements Supplier { private final PersonalLicenseRequest request; private final LicenseRegistry licenses; @@ -34,27 +33,26 @@ final class PersonalLicensePackFromRequest implements Supplier { } @Override - public LicensePack get() { - LicensesFactory licenseFactory = LicensesFactory.eINSTANCE; - LicensePack pack = licenseFactory.createLicensePack(); - pack.setRequestIdentifier(request.identifier()); - pack.setUserIdentifier(request.user()); - pack.setUserFullName(request.userFullName()); - pack.setProductIdentifier(request.productIdentifier()); - pack.setProductVersion(request.productVersion()); - String planIdentifier = request.plan(); - pack.setPlanIdentifier(planIdentifier); - LicensePlanDescriptor plan = licenses.getLicensePlan(planIdentifier); - if (plan == null) { - return pack; // FIXME: ServiceInvocationResult should probably be used - } - Iterable features = plan.getLicensePlanFeatures(); - EList grants = pack.getLicenseGrants(); - for (LicensePlanFeatureDescriptor planFeature : features) { - LicenseGrant grant = new LicenseGrantFromRequest(planFeature, request).get(); - grants.add(grant); - } + public PersonalLicensePack get() { + PersonalLicensePack pack = new EmptyPersonalLicensePack().get(); + installRequisites(pack); + installGrants(pack); return pack; } + private void installRequisites(PersonalLicensePack pack) { + pack.getLicense().getUser().setIdentifier(request.user()); + pack.getLicense().getUser().setName(request.userFullName()); + pack.getLicense().getProduct().setIdentifier(request.productIdentifier()); + pack.getLicense().getProduct().setVersion(request.productVersion()); + pack.getLicense().setPlan(request.plan()); + } + + private void installGrants(PersonalLicensePack pack) { + LicensePlanDescriptor plan = licenses.getLicensePlan(pack.getLicense().getPlan()); + for (LicensePlanFeatureDescriptor feature : plan.getLicensePlanFeatures()) { + pack.getGrants().add(new LicenseGrantFromRequest(feature, request).get()); + } + } + } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/UpdateLicensePlan.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/UpdateLicensePlan.java index 051869cb6..cc5310d60 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/UpdateLicensePlan.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/UpdateLicensePlan.java @@ -23,7 +23,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.api.LicensePlan; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; import org.eclipse.passage.loc.internal.licenses.LicenseRegistry; @@ -41,10 +41,10 @@ final class UpdateLicensePlan { : Optional.empty(); } - void withPersonal(LicensePack license) throws IOException { + void withPersonal(PersonalLicensePack license) throws IOException { updatePlan(// license, // - LicensePack::getPlanIdentifier, // + lic -> lic.getLicense().getPlan(), // LicensesPackage.eINSTANCE.getLicensePlan_Personal()); } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/issue/PersonalLicenseIssuingProtection.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/issue/PersonalLicenseIssuingProtection.java index d3efe4d5b..ff04f2cc5 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/issue/PersonalLicenseIssuingProtection.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/issue/PersonalLicenseIssuingProtection.java @@ -24,10 +24,10 @@ import org.eclipse.passage.lic.internal.base.conditions.BaseValidityPeriodClosed; import org.eclipse.passage.lic.internal.equinox.EquinoxPassage; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; @SuppressWarnings("restriction") -public final class PersonalLicenseIssuingProtection implements Consumer { +public final class PersonalLicenseIssuingProtection implements Consumer { private final String feature = "org.eclipse.passage.loc.operator.issue.personal.full"; //$NON-NLS-1$ private final List> reductions; @@ -39,15 +39,15 @@ public PersonalLicenseIssuingProtection() { } @Override - public void accept(LicensePack license) { + public void accept(PersonalLicensePack license) { if (new EquinoxPassage().canUse(feature)) { return; } diminish(license); } - private void diminish(LicensePack license) { - license.getLicenseGrants().forEach(this::diminishGrant); + private void diminish(PersonalLicensePack license) { + license.getGrants().forEach(this::diminishGrant); } private void diminishGrant(LicenseGrant grant) { diff --git a/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/parts/LicensesDetailsPart.java b/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/parts/LicensesDetailsPart.java index 6e70f6088..7270afb71 100644 --- a/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/parts/LicensesDetailsPart.java +++ b/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/parts/LicensesDetailsPart.java @@ -20,7 +20,7 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.workbench.modeling.ESelectionService; import org.eclipse.emfforms.spi.swt.treemasterdetail.util.CreateElementCallback; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.api.LicensePlan; import org.eclipse.passage.loc.internal.licenses.LicenseRegistryEvents; import org.eclipse.passage.loc.workbench.emfforms.parts.DetailsView; @@ -41,7 +41,7 @@ public void showLicensePlan(@UIEventTopic(LicenseRegistryEvents.LICENSE_PLAN_CRE @Inject @Optional - public void showLicensePack(@UIEventTopic(LicenseRegistryEvents.LICENSE_PACK_CREATE) LicensePack input, + public void showLicensePack(@UIEventTopic(LicenseRegistryEvents.LICENSE_PACK_CREATE) PersonalLicensePack input, IEclipseContext context) { show(input, context); } diff --git a/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductIdentifierRendererService.java b/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductIdentifierRendererService.java index 458ddc2f8..aca2089b0 100644 --- a/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductIdentifierRendererService.java +++ b/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductIdentifierRendererService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -27,7 +27,10 @@ public class ProductIdentifierRendererService extends StructuredFeatureRendererS implements EMFFormsDIRendererService { public ProductIdentifierRendererService() { - super(ProductIdentifierRenderer.class, LicensesPackage.eINSTANCE.getLicensePack_ProductIdentifier()); + super(ProductIdentifierRenderer.class, // + LicensesPackage.eINSTANCE.getPersonalLicensePack_License(), // + LicensesPackage.eINSTANCE.getLicenseRequisites_Product(), // + LicensesPackage.eINSTANCE.getProductRef_Identifier()); } @Reference diff --git a/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductVersionRendererService.java b/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductVersionRendererService.java index 2b7ac104d..454ff7b0d 100644 --- a/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductVersionRendererService.java +++ b/bundles/org.eclipse.passage.loc.licenses.emfforms/src/org/eclipse/passage/loc/licenses/emfforms/renderers/ProductVersionRendererService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -27,7 +27,10 @@ public class ProductVersionRendererService extends StructuredFeatureRendererServ implements EMFFormsDIRendererService { public ProductVersionRendererService() { - super(ProductVersionRenderer.class, LicensesPackage.eINSTANCE.getLicensePack_ProductVersion()); + super(ProductVersionRenderer.class, // + LicensesPackage.eINSTANCE.getPersonalLicensePack_License(), // + LicensesPackage.eINSTANCE.getLicenseRequisites_Product(), // + LicensesPackage.eINSTANCE.getProductRef_Version()); } @Reference diff --git a/bundles/org.eclipse.passage.loc.licenses.ui/src/org/eclipse/passage/loc/internal/licenses/ui/handlers/LicenseExportHandler.java b/bundles/org.eclipse.passage.loc.licenses.ui/src/org/eclipse/passage/loc/internal/licenses/ui/handlers/LicenseExportHandler.java index 4bfd6c9ff..bbba9b7b1 100644 --- a/bundles/org.eclipse.passage.loc.licenses.ui/src/org/eclipse/passage/loc/internal/licenses/ui/handlers/LicenseExportHandler.java +++ b/bundles/org.eclipse.passage.loc.licenses.ui/src/org/eclipse/passage/loc/internal/licenses/ui/handlers/LicenseExportHandler.java @@ -30,9 +30,9 @@ import org.eclipse.passage.lic.internal.api.ServiceInvocationResult; import org.eclipse.passage.lic.internal.base.diagnostic.NoSevereErrors; import org.eclipse.passage.lic.internal.jface.dialogs.licensing.DiagnosticDialog; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.products.ProductVersionDescriptor; import org.eclipse.passage.lic.users.UserDescriptor; import org.eclipse.passage.lic.users.UserOriginDescriptor; @@ -99,7 +99,7 @@ public String isValid(String newText) { PersonalLicenseRequest request = createLicensingRequest(user.get(), licensePlan, productVersion, fromLocal.toLocalDate(), untilLocal.toLocalDate()); - LicensePackDescriptor licensePack = licenseService.createLicensePack(request); + PersonalLicensePackDescriptor licensePack = licenseService.createLicensePack(request); ServiceInvocationResult result = licenseService.issueLicensePack(request, licensePack); if (new NoSevereErrors().test(result.diagnostic()) && result.data().isPresent()) { @@ -107,7 +107,7 @@ public String isValid(String newText) { String.format(LicensesUiMessages.LicenseExportHandler_success_description, // result.data().get().encrypted().toAbsolutePath().toString(), // result.data().get().decrypted().toAbsolutePath().toString())); - LicensePack userLicense = result.data().get().license(); + PersonalLicensePack userLicense = result.data().get().license(); String perspectiveId = UsersUi.PERSPECTIVE_MAIN; LocWokbench.switchPerspective(context, perspectiveId); IEventBroker broker = context.get(IEventBroker.class); diff --git a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReport.java b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReport.java index ec94c8da4..e526357d1 100644 --- a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReport.java +++ b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -17,8 +17,8 @@ import java.util.Map; import java.util.stream.Collectors; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.loc.yars.internal.api.DosHandleMedia; import org.eclipse.passage.loc.yars.internal.api.ExportData; import org.eclipse.passage.loc.yars.internal.api.Progress; @@ -34,11 +34,11 @@ public final class LicensePlanReport implements ExportData> licenses; + private final Map> licenses; private final boolean explain; private final SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd"); //$NON-NLS-1$ - LicensePlanReport(LicensePlanDescriptor plan, int amount, Map> licenses, + LicensePlanReport(LicensePlanDescriptor plan, int amount, Map> licenses, boolean explain) { this.plan = plan; this.amount = amount; @@ -65,7 +65,7 @@ private String user(String user) { return String.format("%s (%s)", //$NON-NLS-1$ user, // licenses.get(user).stream()// - .map(LicensePackDescriptor::getIssueDate)// + .map(pack -> pack.getLicense().getIssueDate())// .map(format::format) // .collect(Collectors.joining(", "))//$NON-NLS-1$ ); diff --git a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReportFetch.java b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReportFetch.java index c84b3d710..2743da243 100644 --- a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReportFetch.java +++ b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicensePlanReportFetch.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -16,8 +16,8 @@ import java.util.Optional; import java.util.stream.Collectors; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.loc.yars.internal.api.FetchedData; /** @@ -48,16 +48,16 @@ private Optional entry(String id) { if (!plan.isPresent()) { return Optional.empty(); } - List licenses = storage.licenses(id).stream()// - .filter(lic -> lic.getIssueDate().after(parameters.from())) // - .filter(lic -> lic.getIssueDate().before(parameters.to()))// + List licenses = storage.licenses(id).stream()// + .filter(lic -> lic.getLicense().getIssueDate().after(parameters.from())) // + .filter(lic -> lic.getLicense().getIssueDate().before(parameters.to()))// .collect(Collectors.toList()); return Optional.of(// new LicensePlanReport(// plan.get(), // licenses.size(), // licenses.stream() // - .collect(Collectors.groupingBy(LicensePackDescriptor::getUserIdentifier)), // + .collect(Collectors.groupingBy(lic -> lic.getLicense().getUser().getIdentifier())), // parameters.explain()// )// ); diff --git a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicenseStorage.java b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicenseStorage.java index 2c30d3a45..1f4e93044 100644 --- a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicenseStorage.java +++ b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/LicenseStorage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -15,17 +15,17 @@ import java.util.List; import java.util.Optional; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.loc.yars.internal.api.Storage; /** * @since 0.2 */ @SuppressWarnings("restriction") -public interface LicenseStorage extends Storage { +public interface LicenseStorage extends Storage { - List licenses(String plan); + List licenses(String plan); List plans(); diff --git a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/Licenses.java b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/Licenses.java index 159ee9fe6..95d17d853 100644 --- a/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/Licenses.java +++ b/bundles/org.eclipse.passage.loc.report.core/src/org/eclipse/passage/loc/report/internal/core/license/Licenses.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -18,8 +18,8 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.loc.internal.licenses.LicenseRegistry; import org.eclipse.passage.loc.internal.users.UserRegistry; import org.osgi.service.component.annotations.Component; @@ -41,7 +41,7 @@ public List plans() { } @Override - public List licenses(String plan) { + public List licenses(String plan) { return Collections.emptyList(); // TODO: 573488 } diff --git a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/ConditionsTest.java b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/ConditionsTest.java index 49b9ee7bc..87e3b1034 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/ConditionsTest.java +++ b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/ConditionsTest.java @@ -66,7 +66,7 @@ private List mineForUserAndProduct(String user, String product, in RawRequest request = request(user, product); NetResponse response = new FlotingRequestHandled(request).get(); assertFalse(response.failed()); - EList grants = new DecodedResponse.License(response, request).get().getLicenseGrants(); + EList grants = new DecodedResponse.License(response, request).get().getGrants(); assertEquals(conditions, grants.size()); return grants; } diff --git a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java index 2e4e2c192..b4d653b08 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java +++ b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java @@ -27,7 +27,7 @@ import org.eclipse.passage.lic.internal.net.handle.ProductUserRequest; import org.eclipse.passage.lic.internal.net.io.SafePayload; import org.eclipse.passage.lic.licenses.model.api.GrantAcqisition; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; @@ -56,15 +56,15 @@ private byte[] decoded(byte[] raw) throws LicensingException { return new SafePayload(new PathKeyKeeper(product, request.state()::source), new MD5Hashes()).decode(raw); } - static final class License extends DecodedResponse { + static final class License extends DecodedResponse { License(NetResponse response, RawRequest request) { super(response, request, Collections.singletonMap(LicensesPackage.eNS_URI, LicensesPackage.eINSTANCE)); } @Override - protected Class target() { - return LicensePack.class; + protected Class target() { + return PersonalLicensePack.class; } } diff --git a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FloatingCycleActionsDryRunTest.java b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FloatingCycleActionsDryRunTest.java index 459394227..237d95c66 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FloatingCycleActionsDryRunTest.java +++ b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FloatingCycleActionsDryRunTest.java @@ -49,7 +49,7 @@ public void mineNothing() throws LicensingException, IOException { RawRequest request = request(new PassageAction.Mine()); NetResponse response = new FlotingRequestHandled(request).get(); assertFalse(response.failed()); - EList grants = new DecodedResponse.License(response, request).get().getLicenseGrants(); + EList grants = new DecodedResponse.License(response, request).get().getGrants(); assertTrue(ofFeature(grants, request).isEmpty()); } diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java index e33d52995..2a29f3096 100644 --- a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java @@ -27,7 +27,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; import org.junit.Test; @@ -69,14 +69,14 @@ private void loaded(String path) throws IOException, ParseException { EList contents = resource.getContents(); EObject eObject = contents.get(0); - LicensePack pack = LicensePack.class.cast(eObject); - assertEquals("org.eclipse.passage.lic.evaluation", pack.getIdentifier()); //$NON-NLS-1$ - assertEquals(null, pack.getIssueDate()); - assertEquals("org.eclipse.passage.lic.product", pack.getProductIdentifier()); //$NON-NLS-1$ - assertEquals("0.4.0", pack.getProductVersion()); //$NON-NLS-1$ - assertEquals("", pack.getUserIdentifier()); //$NON-NLS-1$ + PersonalLicensePack pack = PersonalLicensePack.class.cast(eObject); + assertEquals("org.eclipse.passage.lic.evaluation", pack.getLicense().getIdentifier()); //$NON-NLS-1$ + assertEquals(null, pack.getLicense().getIssueDate()); + assertEquals("org.eclipse.passage.lic.product", pack.getLicense().getProduct().getIdentifier()); //$NON-NLS-1$ + assertEquals("0.4.0", pack.getLicense().getProduct().getVersion()); //$NON-NLS-1$ + assertEquals("", pack.getLicense().getUser().getIdentifier()); //$NON-NLS-1$ - EList grants = pack.getLicenseGrants(); + EList grants = pack.getGrants(); assertEquals(1, grants.size()); LicenseGrant grant = grants.get(0); diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/XmiLicensingConditionExtractorTest.java b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/XmiLicensingConditionExtractorTest.java index dbe5ef487..0b6289709 100644 --- a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/XmiLicensingConditionExtractorTest.java +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/XmiLicensingConditionExtractorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -28,12 +28,13 @@ import org.eclipse.passage.lic.internal.api.conditions.Condition; import org.eclipse.passage.lic.internal.licenses.model.toberemoved.XmiConditionTransport; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +@SuppressWarnings("restriction") public class XmiLicensingConditionExtractorTest { private static final String COND1_FEATURE_ID = "loc.workbench"; //$NON-NLS-1$ @@ -66,8 +67,8 @@ public void testExtractorPositive() throws Exception { XmiConditionTransport extractor = new XmiConditionTransport(); LicensesFactory factory = LicensesFactory.eINSTANCE; - LicensePack license = factory.createLicensePack(); - EList licenseGrants = license.getLicenseGrants(); + PersonalLicensePack license = factory.createPersonalLicensePack(); + EList licenseGrants = license.getGrants(); LicenseGrant cond1 = factory.createLicenseGrant(); cond1.setFeatureIdentifier(COND1_FEATURE_ID); cond1.setConditionType(COND1_CONDITION_TYPE); diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java index a80e866d1..2badc3aca 100644 --- a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -17,31 +17,46 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.passage.lic.internal.licenses.model.AssignGrantIdentifiers; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; -import org.eclipse.passage.lic.licenses.model.api.LicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; import org.junit.Test; public class AssignGrantIdentifiersTest { + private final String id = "pack-id"; //$NON-NLS-1$ + @Test public void positive() { - LicensesFactory factory = LicensesFactory.eINSTANCE; - LicensePack pack = factory.createLicensePack(); - pack.setIdentifier("pack-id"); //$NON-NLS-1$ - EList grants = pack.getLicenseGrants(); - LicenseGrant nullId = factory.createLicenseGrant(); - nullId.setIdentifier(null); - grants.add(nullId); - LicenseGrant emptyId = factory.createLicenseGrant(); - emptyId.setIdentifier(""); //$NON-NLS-1$ - grants.add(emptyId); - LicenseGrant hasId = factory.createLicenseGrant(); - hasId.setIdentifier("grant-id"); //$NON-NLS-1$ - grants.add(hasId); + // given + PersonalLicensePack pack = pack(); + addGrantOfIdentifier(pack, null); + addGrantOfIdentifier(pack, ""); //$NON-NLS-1$ + addGrantOfIdentifier(pack, "grant-id"); //$NON-NLS-1$ + // when new AssignGrantIdentifiers().accept(pack); - assertEquals("pack-id#0", grants.get(0).getIdentifier()); //$NON-NLS-1$ - assertEquals("pack-id#1", grants.get(1).getIdentifier()); //$NON-NLS-1$ - assertEquals("grant-id", grants.get(2).getIdentifier()); //$NON-NLS-1$ + // then + expect("pack-id#0", pack, 0); //$NON-NLS-1$ + assertEquals("pack-id#1", pack, 1); //$NON-NLS-1$ + assertEquals("grant-id", pack, 2); //$NON-NLS-1$ + } + + private void expect(String expected, PersonalLicensePack pack, int no) { + assertEquals(expected, pack.getGrants().get(no).getIdentifier()); + } + + private PersonalLicensePack pack() { + PersonalLicensePack pack = LicensesFactory.eINSTANCE.createPersonalLicensePack(); + PersonalLicenseRequisites license = LicensesFactory.eINSTANCE.createPersonalLicenseRequisites(); + license.setIdentifier(id); + return pack; + } + + private void addGrantOfIdentifier(PersonalLicensePack pack, String identifier) { + EList grants = pack.getGrants(); + LicenseGrant grant = LicensesFactory.eINSTANCE.createLicenseGrant(); + grant.setIdentifier(identifier); + grants.add(grant); } } diff --git a/tests/org.eclipse.passage.loc.report.core.tests/src/org/eclipse/passage/loc/report/internal/core/FakeLicensePlanDescriptor.java b/tests/org.eclipse.passage.loc.report.core.tests/src/org/eclipse/passage/loc/report/internal/core/FakeLicensePlanDescriptor.java index 105266ea1..077f13a3a 100644 --- a/tests/org.eclipse.passage.loc.report.core.tests/src/org/eclipse/passage/loc/report/internal/core/FakeLicensePlanDescriptor.java +++ b/tests/org.eclipse.passage.loc.report.core.tests/src/org/eclipse/passage/loc/report/internal/core/FakeLicensePlanDescriptor.java @@ -15,7 +15,7 @@ import java.util.List; import org.eclipse.passage.lic.licenses.FloatingLicensePackDescriptor; -import org.eclipse.passage.lic.licenses.LicensePackDescriptor; +import org.eclipse.passage.lic.licenses.PersonalLicensePackDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanDescriptor; import org.eclipse.passage.lic.licenses.LicensePlanFeatureDescriptor; @@ -50,7 +50,7 @@ public List getLicensePlanFeatures() { } @Override - public List getPersonal() { + public List getPersonal() { throw new UnsupportedOperationException("MUST be implemented for test purposes"); //$NON-NLS-1$ } From 3830e7dedb4d84e646009bcd7375dfdcc730f803 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Fri, 14 May 2021 15:38:42 +0300 Subject: [PATCH 2/8] Bug 572650 - upgrade licenses domain model reissue test floating license Signed-off-by: eparovyshnaya --- .../core/FloatingLicensePackFromRequest.java | 2 +- ...2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flic} | 7 +++--- ...fa76bd6-f1b0-4d6b-9e86-280483aedc32.flicen | 23 +++++++++++++++++++ ...86-280483aedc32_Albert_Rose@garden.ga.fla} | 2 +- ...6-280483aedc32_Albert_Rose@garden.ga.flaen | 17 ++++++++++++++ ...5c32f83-41c9-4f17-b580-cce3f7f0d4f1.flicen | 23 ------------------- ...0-cce3f7f0d4f1_Albert_Rose@garden.ga.flaen | 17 -------------- .../passage/lbc/base/tests/TestData.java | 4 ++-- 8 files changed, 48 insertions(+), 47 deletions(-) rename tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/{35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flic => 2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flic} (79%) create mode 100644 tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flicen rename tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/{35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.fla => 2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.fla} (83%) create mode 100644 tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.flaen delete mode 100644 tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flicen delete mode 100644 tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.flaen 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 78efcd9de..d2373424f 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 @@ -119,7 +119,7 @@ private CompanyRef company() { CompanyRef company = LicensesFactory.eINSTANCE.createCompanyRef(); company.setIdentifier(origin.getIdentifier()); company.setName(origin.getName()); - company.setInfo(origin.getDescription()); + company.setInfo(Optional.ofNullable(origin.getDescription()).orElse("")); //$NON-NLS-1$ return company; } diff --git a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flic b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flic similarity index 79% rename from tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flic rename to tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flic index b2d177061..a0837fca1 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flic +++ b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flic @@ -1,8 +1,9 @@ - + + @@ -10,11 +11,11 @@ - + - + diff --git a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flicen b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flicen new file mode 100644 index 000000000..b134a95a1 --- /dev/null +++ b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32.flicen @@ -0,0 +1,23 @@ +-----BEGIN PGP MESSAGE----- +Version: BCPG v1.65 + +owJ4nNVVTWgUSRSeuBHdQHRE1kUUbDsg/lVPzfRkkozTUYmuZo2QNbJ605rump7C +7uqmqjuT8RIEBYm7kpMHQQ+CCqsIgqwgEs3Zg7CQQ0BEDyr4c1fQZV/P9EwysBGC +HhR6mpqq7733ve+91zXZ+UOio2102pmcPdn1tu3R6+IyZnNPUOv4ZX6msHPMdZRR +KiTzuKGmNawqlJuexbhtqLtHBgYH1Z39nR0FT9gaNR3mS6r5REpiU81hZv4XxyMB +gIeYSbmkw8Q8oYy5LN90mYlcQhAu87BvqOUg8POpVKVS0TzX1sBv6ujBwSZEtkIq +eg2RwTgNsKERs0xdghiXAeEmbVgtQK7FU+M8chdjUoCJfhFxmQKiQBVyVZRCvKkw +i/KAlRgVkEiJ9OSKVg6V0kWMslauiPpobw5lenG2VyfUMvWMqjApQ7qHBBQMcCaN +cDdKZw+nu/N6Np/VtVxP3zasY5DEdwio4xKbmQgCOBaKg6LopM4DmPjCs0IzaGFC +YIXKoUs4qtlrMUidKyTWMlpaTTW8jBKHWQqImw+qPlBbqJq/RzgWVIepYJ414HiS +WqpSEp7bSCeLcO9hjPO1R8MYx+mEwMmZy/l/QU06puf6hFdbkqplwgiXqsKJCxwP +zm0wXvIMNbYvNEpW/1f2ZKs6jY5EI1SAHmh3U0sSBuUIZ8K5x5W6FGUirAoR0Et0 +zBdU1vXzpFYiLnOqxtZm2ChSfRlK0FmJ3jAjTpGK4NghkGqXDb4o12zytULWAtXX +JUqCEMCL7skuqE5sbKi+YNO3YXJQ4CEoqw0tw0aZZag5QJnEJyZU31D1ZgJxR83/ +RHRHEy1CJ3JHRYlC432TjVZINTT7UgXT8xT8zPAtUklc++DEStZGImBFh34HYhZS +i7gOAH/27/ZEW0dCWbokunPWrl9Iw0THj8nGTfXTeHviT2xsfPLxQ/Kf8QfVA4/b +/zI6XxX1iUv3Bt6cOvvrjMh0bTx/Jbnv/LE/Vv3bXxbOrfe72NM1N/Ys33A9O/Fu +xbOxi/qF1dvC05Obr618fq4vuWL/zanrO/ZWjgw54882XXWT3ZVP1eTel3cml275 ++fTy/VMnj959sem3yoeH/RP3Z2bXbf8PtP1WhA== +=VTMl +-----END PGP MESSAGE----- diff --git a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.fla b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.fla similarity index 83% rename from tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.fla rename to tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.fla index a85d389bc..5ef895fd9 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.fla +++ b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.fla @@ -1,5 +1,5 @@ - + diff --git a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.flaen b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.flaen new file mode 100644 index 000000000..aaa4790f3 --- /dev/null +++ b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/2fa76bd6-f1b0-4d6b-9e86-280483aedc32/2fa76bd6-f1b0-4d6b-9e86-280483aedc32_Albert_Rose@garden.ga.flaen @@ -0,0 +1,17 @@ +-----BEGIN PGP MESSAGE----- +Version: BCPG v1.65 + +owJ4nJvAy8zAxVh2MGfCzSrlN4ynD2omsWem5+UXpaYkzMtrtbGvyM1RKEstKs7M +z7NVMtQzUFJIzUvOT8nMS7dVcgx29vRUsrfj5bLJL0rXS03OySwoTtUrSCwuTkxP +1cvJTLZyy8lPLAEq9slMTs0rTnVMTk4tLlaoyM20ghtqBDIUaE1esRVQ3FYpo6Sk +wEpfv7y8XC8/N10PaLJ+hK8nTAkOi1C0weRBWqFq9IFqQBjkiGJ9oJUgS0uLU4uA +vshJSi0qiQ/KL051SE8sSknN00tPVFLIL8pMz8yDujsgMTkb6NK0RHOzpBQz3TTD +JANdkxSzJF3LVAszXSMLAxML48TUlGRjIyVgaCgo2ABNBnpQIbPAViknPzkxJyO/ +uERJoSC/qMRWycLA0gCiDKgwsbQkIzWvJDMZGEz5eQollQWpQL8AnVGeWJQKDOyK +giJgiIEDKr9YLy0xNzOn0lZLSR9ijT7EHlAM6JMUBUAdHdtYGBi5GBRYmUAxLSmT +CHSFbkZpbmKebm5iemayXkFRfkppcgkDF6cALIFcPs78PylmAoMiE1PZ5NkPK75k +5WrdTs3lbmas/zihOfTeyblp+TWvtK+/XXf69RnzTw83t31bfirP7Ej3joJCv4ig +BhWNzb37dDcfECn7aOPfdOOGrJr47tn3tvRve/npi7WP6DVJxy69SbeYxG1Ovw8v +EC14JWZ8RpbT5Ip94P96r6C2P+8fW+x6AgCdewGt +=Eryj +-----END PGP MESSAGE----- diff --git a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flicen b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flicen deleted file mode 100644 index 36feb1ad7..000000000 --- a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1.flicen +++ /dev/null @@ -1,23 +0,0 @@ ------BEGIN PGP MESSAGE----- -Version: BCPG v1.65 - -owJ4nNVVTWgTQRRO/UGNiB48WPSwbA+CMpvZTdvUkFSLWghWrG0RFcROZ2c3o/vH -zKZpPSiCguilKCI9eFILXgUVxYNFT3pQxIM/INKDh1IsRfGgVHybbKJFWxA9KCRh -MvPN9773vfd2R1YtTiQbBsedkZfHmqYaHk8OLOO25wtm9o/SO7mtQ66jDDIhue/l -VV3DqsI86pvcs/NqR+/2QkHd2r4qmfOFrTHq8EAyLSBSEptpDqfZTscnIYC7OGWe -ZN2EHlWGXJ6tUxoRJQTxZBb282oxDINsKlUulzXftTXgTe3fXahD5FxIOV1BGBjr -AOvqpUXmEsQ9GRKPstqtecTNYaqdR3QxJgWY6BsJlykQClIhV0XJxZsKN5kXcosz -kVfTLTRtWG1p1KzTLajZ0jNooKUNI0pZ2spY2IQtVeFSltgOEjLIHBs6wi1Ix336 -lmxzJqsbWqthbMZpDJYEDgF3XGJziiCAY6I4KIpOVIX6bkC84RjCiSer2kBdIHyz -RMM56gisULHkEg9VLmgxSP1eXKwZmq6maiyDxOGmAoZnw+EA5M5X4X0RjofD3Uxw -39zu+JKZqmIJ362l2IxwWx/G2cpHwxjHKZZAk/Pdh1+CqnJytTJU/xV9OTe7Wpeh -XiYgH9RR94KUwmKEo3Due0o1lSIRZpkI6A82FAgmq/n7UrOIy53h/KZ62ChSdVmS -4JMS/ULfOwNMhId7INVtNnAxT7PJ3wpZCVRdW4yEJQD/dp81gbvx5bwaCA6zgEIf -QVFsKDgf5GZebQUMJQGhUDtgrcsfPx13xI9j3xJNqSg5ER0TFoPG+UcbpebZnzqo -/+DgAsOzsJc/OYkrD5HYycoIh3zAYf+BmbnUbzziAX/m1pJEQzKhLF0UvUcaN8zn -YSK5Yk3t7TNhLP68aP22tef6j3y4JEdfF2b2Tr5fPX3oy6v7sz1vj+86f+Rcq/7w -fKL/UKbzQe/m4sp9U/ja+KPZp89HZMeO050bnzw7cAPdG0su2SPeYNu5epudffLm -Y+LUCX7tSmJi3dSJ5Qc/fW2aPrnLW18cudnef+zFu7tuZqdoLOy8evniWHrmwvVv -8XZQjg== -=URGU ------END PGP MESSAGE----- diff --git a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.flaen b/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.flaen deleted file mode 100644 index 4390b00d7..000000000 --- a/tests/org.eclipse.passage.lbc.base.tests/resource/lics/anti-human-magic.product/0.2.1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1/35c32f83-41c9-4f17-b580-cce3f7f0d4f1_Albert_Rose@garden.ga.flaen +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP MESSAGE----- -Version: BCPG v1.65 - -owJ4nJvAy8zAxVh2MGfCzSrlN4ynD2omsWem5+UXpaYkzEzeaWNfkZujUJZaVJyZ -n2erZKhnoKSQmpecn5KZl26r5Bjs7OmpZG/Hy2WTX5Sul5qck1lQnKpXkFhcnJie -qpeTmWzllpOfWAJU7JOZnJpXnOqYnJxaXKxQkZtpBTfUCGQo0Jq8YiuguK1SRklJ -gZW+fnl5uV5+broe0GT9CF9PmBIcFqFog8mDtELV6APVgDDIEcX6QCtBlpYWpxYB -fZGTlFpUEh+UX5zqkJ5YlJKap5eeqKSQX5SZnpkHdXdAYnK2rZKxabKxUZqFsa6J -YbKlrkmaoblukqmFgS7QU8Zp5mkGKUAhJWBoKCjYAE0GelAhs8BWKSc/OTEnI7+4 -REmhIL+oxFbJwsDSAKIMqDCxtCQjNa8kMxkYTPl5CiWVBalAvwCdUZ5YlAoM7IqC -ImCIgQMqv1gvLTE3M6fSVktJH2KNPsQeUAzokxQFQB0d21gYGLkYFFiZQDEtKZMI -dIVuRmluYp5ubmJ6ZrJeQVF+SmlyCQMXpwAsgfSkszAs0/nM/5J9LscTszUHOcxl -ZmZanFp5/f1Fz0Qf/mUF73SmLYnVc92VFpXte7eupfJoyBw9qSWexw1PfYo9cNd8 -2R3pi/9SZRR8EwQuHd7xyGSV/uLIc65dz/bKf18b8cjszzXeA/K+Js+yNpwoCJoV -svfTnHC/rnm7/D7oHtniMVN03m6/zfWrAIVNABk= -=zJQ9 ------END PGP MESSAGE----- diff --git a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/TestData.java b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/TestData.java index 809fd0276..11107a177 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/TestData.java +++ b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/TestData.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -35,7 +35,7 @@ void assertGrantIsValid(LicenseGrant grant) { assertEquals("hardware", grant.getConditionType()); //$NON-NLS-1$ assertEquals("os.family=*", grant.getConditionExpression()); //$NON-NLS-1$ assertEquals("anti-human-magic.product", grant.getFeatureIdentifier()); //$NON-NLS-1$ - assertEquals("35c32f83-41c9-4f17-b580-cce3f7f0d4f1#1", grant.getIdentifier()); //$NON-NLS-1$ + assertEquals("2fa76bd6-f1b0-4d6b-9e86-280483aedc32#1", grant.getIdentifier()); //$NON-NLS-1$ assertEquals("0.0.0", grant.getMatchVersion()); //$NON-NLS-1$ assertEquals("compatible", grant.getMatchRule()); //$NON-NLS-1$ assertEquals(1, grant.getCapacity()); From fee47edaddfef203f7269da60bf86bb069ef66d9 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Fri, 14 May 2021 15:53:16 +0300 Subject: [PATCH 3/8] Bug 572650 - upgrade licenses domain model Bump service version for affected bundle Signed-off-by: eparovyshnaya --- .../org.eclipse.passage.lic.licenses.e4.ui/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.passage.lic.licenses.e4.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.licenses.e4.ui/META-INF/MANIFEST.MF index 0e7d54ea1..8f5a118db 100644 --- a/bundles/org.eclipse.passage.lic.licenses.e4.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.licenses.e4.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.passage.lic.licenses.e4.ui Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.passage.lic.licenses.e4.ui;singleton:=true -Bundle-Version: 0.5.300.qualifier +Bundle-Version: 0.5.400.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Copyright: %Bundle-Copyright Bundle-RequiredExecutionEnvironment: JavaSE-1.8 From 4a901674e2cbac02cf234f721834eb0ae56259d4 Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Fri, 14 May 2021 16:16:23 +0300 Subject: [PATCH 4/8] Bug 573540 - [Passage][Operator] forms cannot be viewed/edited Use Resource as an input Signed-off-by: Alexander Fedorov --- .../workbench/emfforms/parts/DetailsView.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java b/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java index 41f22e2a0..9fc253ac8 100644 --- a/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java +++ b/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java @@ -132,26 +132,26 @@ protected void show(Notifier input, IEclipseContext context) { for (Control control : children) { control.dispose(); } - if (!root.isEmpty()) { + if (!root.isEmpty() && resource.isPresent()) { try { - TreeMasterDetailComposite rootView = createRootView(content, resource, getCreateElementCallback(), + TreeMasterDetailComposite rootView = createRootView(content, resource.get(), getCreateElementCallback(), context); - TreeViewer selectionProvider = rootView.getSelectionProvider(); - selectionProvider.addSelectionChangedListener(selectionChangedListener); - selectionProvider.refresh(); - EObject objectToReveal = root.get(0); - while (objectToReveal != null) { - selectionProvider.reveal(objectToReveal); - if (selectionProvider.testFindItem(objectToReveal) != null) { + TreeViewer viewer = rootView.getSelectionProvider(); + viewer.addSelectionChangedListener(selectionChangedListener); + viewer.refresh(); + EObject reveal = root.get(0); + while (reveal != null) { + viewer.reveal(reveal); + if (viewer.testFindItem(reveal) != null) { break; } - objectToReveal = objectToReveal.eContainer(); + reveal = reveal.eContainer(); } - if (objectToReveal == null) { + if (reveal == null) { return; } - rootView.setSelection(new StructuredSelection(objectToReveal)); + rootView.setSelection(new StructuredSelection(reveal)); } catch (final Exception e) { e.printStackTrace(); } From 11b02cbfbe59102654f37f1270cccdabf0ebf3f4 Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Sat, 15 May 2021 12:13:26 +0300 Subject: [PATCH 5/8] Bug 572650 - upgrade licenses domain model Add migration functionality for licenses package Signed-off-by: eparovyshnaya --- .../lic/emf/migration/ApplyFeatureMap.java | 47 ---------- .../emf/migration/DelegateClassifiers.java | 28 +++--- .../lic/emf/migration/EClassRoutes.java | 60 ++++++++++++ .../lic/emf/migration/EFeatureRoutes.java | 7 +- .../lic/emf/migration/SimpleClassRoutes.java | 49 ++++++++++ .../emf/migration/SimpleFeatureRoutes.java | 4 +- .../emf/migration/DelegateEPackage.java | 14 +-- .../emf/migration/DelegatingEFactory.java | 26 ++---- .../emf/migration/DelegatingEPackage.java | 4 +- .../emf/migration/RecognizeFeatures.java | 92 +++++++++++++++++++ .../migration/FeaturesResourceHandler.java | 22 ++--- .../model/AssignGrantIdentifiers.java | 2 + .../migration/EnsurePersonalPackLicense.java | 35 +++++++ .../migration/EnsurePersonalPackProduct.java | 35 +++++++ .../migration/EnsurePersonalPackUser.java | 35 +++++++ .../migration/LicensesResourceHandler.java | 74 +++++++++------ .../migration/ProductsResourceHandler.java | 24 ++--- .../model/migration/UsersResourceHandler.java | 14 +-- .../tests/AssignGrantIdentifiersTest.java | 8 +- 19 files changed, 425 insertions(+), 155 deletions(-) delete mode 100644 bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/ApplyFeatureMap.java rename bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/{internal => }/emf/migration/DelegateClassifiers.java (54%) create mode 100644 bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EClassRoutes.java create mode 100644 bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleClassRoutes.java create mode 100644 bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackLicense.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackProduct.java create mode 100644 bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackUser.java diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/ApplyFeatureMap.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/ApplyFeatureMap.java deleted file mode 100644 index 915a96e8a..000000000 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/ApplyFeatureMap.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021 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.emf.migration; - -import java.util.Iterator; -import java.util.Objects; -import java.util.Optional; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.ecore.util.FeatureMap.Entry; - -/** - * @since 2.0 - */ -public final class ApplyFeatureMap { - - private final FeatureMap features; - private final EFeatureRoutes routes; - - public ApplyFeatureMap(FeatureMap features, EFeatureRoutes routes) { - Objects.requireNonNull(features, "ApplyFeatureMap::features"); //$NON-NLS-1$ - Objects.requireNonNull(routes, "ApplyFeatureMap::routes"); //$NON-NLS-1$ - this.features = features; - this.routes = routes; - } - - public void apply(EObject object) { - for (Iterator iterator = features.iterator(); iterator.hasNext();) { - Entry entry = iterator.next(); - Optional.of(entry.getEStructuralFeature().getName())// - .flatMap(routes)// - .ifPresent(f -> object.eSet(f, entry.getValue())); - } - } - -} diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateClassifiers.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/DelegateClassifiers.java similarity index 54% rename from bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateClassifiers.java rename to bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/DelegateClassifiers.java index e1c81833e..d198f2e7c 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateClassifiers.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/DelegateClassifiers.java @@ -10,15 +10,17 @@ * Contributors: * ArSysOp - initial API and implementation *******************************************************************************/ -package org.eclipse.passage.lic.internal.emf.migration; +package org.eclipse.passage.lic.emf.migration; import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.passage.lic.internal.emf.migration.DelegateEPackage; +import org.eclipse.passage.lic.internal.emf.migration.DelegatingEFactory; +import org.eclipse.passage.lic.internal.emf.migration.DelegatingEPackage; /** * @since 2.0 @@ -31,19 +33,19 @@ public DelegateClassifiers(String uri) { this.uri = uri; } - public void delegate(EPackage delegate, Iterable classifierNames) { + public void delegate(EClassRoutes routes) { DelegatingEPackage delegating = new DelegateEPackage().apply(uri); + DelegatingEFactory factory = delegating.getDelegatingEFactory(); Map delegated = new HashMap<>(); - for (String name : classifierNames) { - EClassifier eClassifier = delegate.getEClassifier(name); - if (eClassifier instanceof EClass) { - EClass eClass = (EClass) eClassifier; - EClass key = EcoreUtil.copy(eClass); - delegated.put(key, eClass); - } + Map defined = routes.defined(); + for (Entry entry : defined.entrySet()) { + EClass to = entry.getValue(); + EClass from = EcoreUtil.copy(to); + from.setName(entry.getKey()); + delegated.put(from, to); + delegating.getEClassifiers().add(from); + factory.delegateEClass(to.getEPackage().getEFactoryInstance(), from, to); } - delegating.getEClassifiers().addAll(delegated.keySet()); - delegating.getDelegatingEFactory().addEClassDelegate(delegate.getEFactoryInstance(), delegated); } } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EClassRoutes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EClassRoutes.java new file mode 100644 index 000000000..b5f77be6c --- /dev/null +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EClassRoutes.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2021 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.emf.migration; + +import java.util.Map; +import java.util.Optional; + +import org.eclipse.emf.ecore.EClass; + +/** + * @since 2.0 + */ +public interface EClassRoutes { + + void define(String found, EClass destination); + + Map defined(); + + Optional route(String found); + + public static final class Smart implements EClassRoutes { + + private final EClassRoutes delegate; + + public Smart(EClassRoutes delegate) { + this.delegate = delegate; + } + + @Override + public void define(String found, EClass destination) { + delegate.define(found, destination); + } + + public void define(EClass destination) { + delegate.define(destination.getName(), destination); + } + + @Override + public Map defined() { + return delegate.defined(); + } + + @Override + public Optional route(String found) { + return delegate.route(found); + } + + } + +} diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java index 08db062b4..0fb8b0be1 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java @@ -13,15 +13,16 @@ package org.eclipse.passage.lic.emf.migration; import java.util.Optional; -import java.util.function.Function; import org.eclipse.emf.ecore.EStructuralFeature; /** * @since 2.0 */ -public interface EFeatureRoutes extends Function> { +public interface EFeatureRoutes { - void add(String found, EStructuralFeature destination); + void define(String found, EStructuralFeature destination); + + Optional route(String found); } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleClassRoutes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleClassRoutes.java new file mode 100644 index 000000000..d4c061642 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleClassRoutes.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2021 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.emf.migration; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.emf.ecore.EClass; + +/** + * + * @since 2.0 + * + */ +public final class SimpleClassRoutes implements EClassRoutes { + + private final Map map; + + public SimpleClassRoutes() { + map = new LinkedHashMap<>(); + } + + @Override + public void define(String found, EClass destination) { + map.put(found, destination); + } + + @Override + public Map defined() { + return new LinkedHashMap<>(map); + } + + @Override + public Optional route(String found) { + return Optional.ofNullable(map.get(found)); + } + +} diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java index 5332317e9..c45959aca 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java @@ -32,12 +32,12 @@ public SimpleFeatureRoutes() { } @Override - public Optional apply(String found) { + public Optional route(String found) { return Optional.ofNullable(map.get(found)); } @Override - public void add(String found, EStructuralFeature destination) { + public void define(String found, EStructuralFeature destination) { map.put(found, destination); } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateEPackage.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateEPackage.java index ac64b859a..223ce3f63 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateEPackage.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegateEPackage.java @@ -1,7 +1,5 @@ package org.eclipse.passage.lic.internal.emf.migration; -import java.util.HashMap; -import java.util.Map; import java.util.function.Function; import org.eclipse.emf.common.util.EList; @@ -22,19 +20,17 @@ public DelegatingEPackage apply(String nsUri) { return (DelegatingEPackage) existing; } else { DelegatingEPackage delegating = new DelegatingEPackage(nsUri); + DelegatingEFactory factory = delegating.getDelegatingEFactory(); if (existing != null) { - Map wrapped = new HashMap<>(); EList classifiers = existing.getEClassifiers(); for (EClassifier eClassifier : classifiers) { if (eClassifier instanceof EClass) { - EClass eClass = (EClass) eClassifier; - EClass key = EcoreUtil.copy(eClass); - wrapped.put(key, eClass); + EClass to = (EClass) eClassifier; + EClass from = EcoreUtil.copy(to); + delegating.getEClassifiers().add(from); + factory.delegateEClass(existing.getEFactoryInstance(), from, to); } } - delegating.getEClassifiers().addAll(wrapped.keySet()); - DelegatingEFactory factory = delegating.getDelegatingEFactory(); - factory.addEClassDelegate(existing.getEFactoryInstance(), wrapped); } EPackage.Registry.INSTANCE.put(nsUri, delegating); return delegating; diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEFactory.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEFactory.java index c9c0ccfca..badec1873 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEFactory.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEFactory.java @@ -14,8 +14,6 @@ import java.util.HashMap; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; @@ -25,7 +23,7 @@ import org.eclipse.passage.lic.emf.QualifiedNames; import org.eclipse.passage.lic.emf.SimpleQualifiedNames; -final class DelegatingEFactory extends EFactoryImpl { +public final class DelegatingEFactory extends EFactoryImpl { public final Map eClassMap = new HashMap<>(); public final Map eDataTypeMap = new HashMap<>(); @@ -38,22 +36,16 @@ final class DelegatingEFactory extends EFactoryImpl { names = new SimpleQualifiedNames(); } - void addEClassDelegate(EFactory factory, Map eClasses) { - Set> entrySet = eClasses.entrySet(); - for (Entry entry : entrySet) { - String key = names.caseEClass(entry.getKey()); - eClassFactories.put(key, factory); - eClassMap.put(key, entry.getValue()); - } + public void delegateEClass(EFactory factory, EClass from, EClass to) { + String key = names.caseEClass(from); + eClassFactories.put(key, factory); + eClassMap.put(key, to); } - void addEDataTypeDelegate(EFactory factory, Map eDataTypes) { - Set> entrySet = eDataTypes.entrySet(); - for (Entry entry : entrySet) { - String key = names.caseEDataType(entry.getKey()); - eDataTypeFactories.put(key, factory); - eDataTypeMap.put(key, entry.getValue()); - } + public void delegateEDataType(EFactory factory, EDataType from, EDataType to) { + String key = names.caseEDataType(from); + eDataTypeFactories.put(key, factory); + eDataTypeMap.put(key, to); } @Override diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEPackage.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEPackage.java index 5ab92137b..bfcce089a 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEPackage.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/DelegatingEPackage.java @@ -14,7 +14,7 @@ import org.eclipse.emf.ecore.impl.EPackageImpl; -final class DelegatingEPackage extends EPackageImpl { +public final class DelegatingEPackage extends EPackageImpl { private final DelegatingEFactory factory = new DelegatingEFactory(); @@ -23,7 +23,7 @@ final class DelegatingEPackage extends EPackageImpl { setEFactoryInstance(factory); } - DelegatingEFactory getDelegatingEFactory() { + public DelegatingEFactory getDelegatingEFactory() { return factory; } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java new file mode 100644 index 000000000..30cf565cd --- /dev/null +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2021 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.internal.emf.migration; + +import java.util.Collections; +import java.util.Iterator; +import java.util.Objects; +import java.util.Optional; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.FeatureMap.Entry; +import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.passage.lic.emf.migration.EFeatureRoutes; + +/** + * @since 2.0 + */ +public final class RecognizeFeatures { + + private final AnyType any; + private final EFeatureRoutes features; + + public RecognizeFeatures(AnyType any, EFeatureRoutes features) { + Objects.requireNonNull(any, "ApplyFeatureMap::any"); //$NON-NLS-1$ + Objects.requireNonNull(features, "ApplyFeatureMap::features"); //$NON-NLS-1$ + this.any = any; + this.features = features; + } + + public RecognizeFeatures mixed(EObject object) { + EList references = object.eClass().getEAllReferences(); + for (Iterator iterator = any.getMixed().iterator(); iterator.hasNext();) { + Entry entry = iterator.next(); + Optional candidate = features.route(entry.getEStructuralFeature().getName())// + .filter(references::contains); + if (!candidate.isPresent()) { + continue; + } + // FIXME: different routes for attributes and references? + EReference feature = (EReference) candidate.get(); + EClass type = feature.getEReferenceType(); + Object value = entry.getValue(); + if (value instanceof AnyType) { + AnyType child = (AnyType) value; + EObject created = type.getEPackage().getEFactoryInstance().create(type); + new RecognizeFeatures(child, features).attributes(created); + if (feature.isMany()) { + object.eSet(feature, Collections.singletonList(created)); + } else { + object.eSet(feature, created); + } + } + } + return this; + } + + public RecognizeFeatures attributes(EObject object) { + EList attributes = object.eClass().getEAllAttributes(); + for (Iterator iterator = any.getAnyAttribute().iterator(); iterator.hasNext();) { + Entry entry = iterator.next(); + Optional candidate = features.route(entry.getEStructuralFeature().getName())// + .filter(attributes::contains); + if (!candidate.isPresent()) { + continue; + } + // FIXME: different routes for attributes and references? + EAttribute feature = (EAttribute) candidate.get(); + EDataType type = feature.getEAttributeType(); + Object value = type.getEPackage().getEFactoryInstance().createFromString(type, + String.valueOf(entry.getValue())); + object.eSet(feature, value); + } + return this; + } + +} diff --git a/bundles/org.eclipse.passage.lic.features.model/src/org/eclipse/passage/lic/internal/features/model/migration/FeaturesResourceHandler.java b/bundles/org.eclipse.passage.lic.features.model/src/org/eclipse/passage/lic/internal/features/model/migration/FeaturesResourceHandler.java index 9be818ffe..432223e8f 100644 --- a/bundles/org.eclipse.passage.lic.features.model/src/org/eclipse/passage/lic/internal/features/model/migration/FeaturesResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.features.model/src/org/eclipse/passage/lic/internal/features/model/migration/FeaturesResourceHandler.java @@ -12,16 +12,16 @@ *******************************************************************************/ package org.eclipse.passage.lic.internal.features.model.migration; -import java.util.ArrayList; -import java.util.List; import java.util.Map.Entry; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.passage.lic.emf.migration.DelegateClassifiers; +import org.eclipse.passage.lic.emf.migration.EClassRoutes; +import org.eclipse.passage.lic.emf.migration.SimpleClassRoutes; import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; import org.eclipse.passage.lic.features.model.meta.FeaturesPackage; -import org.eclipse.passage.lic.internal.emf.migration.DelegateClassifiers; public final class FeaturesResourceHandler extends MigratingResourceHandler { @@ -37,18 +37,18 @@ protected void convertEntry(Entry entry) { } private void migrate033() { - String nsUri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ + String uri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ FeaturesPackage delegate = FeaturesPackage.eINSTANCE; - List classifiers = new ArrayList<>(); - classifiers.add(delegate.getFeatureSet().getName()); - classifiers.add(delegate.getFeature().getName()); - classifiers.add(delegate.getFeatureVersion().getName()); - new DelegateClassifiers(nsUri).delegate(delegate, classifiers); + EClassRoutes.Smart smart = new EClassRoutes.Smart(new SimpleClassRoutes()); + smart.define(delegate.getFeatureSet()); + smart.define(delegate.getFeature()); + smart.define(delegate.getFeatureVersion()); + new DelegateClassifiers(uri).delegate(smart); } private void migrate040() { - String nsUri = "http://www.eclipse.org/passage/lic/features/0.4.0"; //$NON-NLS-1$ + String uri = "http://www.eclipse.org/passage/lic/features/0.4.0"; //$NON-NLS-1$ FeaturesPackage delegate = FeaturesPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(nsUri, ns -> delegate); + EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate); } } diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java index 9145ee419..ab9e317c5 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/AssignGrantIdentifiers.java @@ -17,6 +17,7 @@ import java.util.function.Predicate; import org.eclipse.emf.common.util.EList; +import org.eclipse.passage.lic.internal.licenses.model.migration.EnsurePersonalPackProduct; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; @@ -30,6 +31,7 @@ public AssignGrantIdentifiers() { @Override public void accept(PersonalLicensePack pack) { + new EnsurePersonalPackProduct().apply(pack); String identifier = pack.getLicense().getIdentifier(); EList grants = pack.getGrants(); for (int i = 0; i < grants.size(); i++) { diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackLicense.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackLicense.java new file mode 100644 index 000000000..ebbb728f3 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackLicense.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2021 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.internal.licenses.model.migration; + +import java.util.Optional; +import java.util.function.Function; + +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; +import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; + +public final class EnsurePersonalPackLicense implements Function { + + @Override + public PersonalLicenseRequisites apply(PersonalLicensePack pack) { + return Optional.ofNullable(pack.getLicense()).orElseGet(() -> reset(pack)); + } + + private PersonalLicenseRequisites reset(PersonalLicensePack pack) { + PersonalLicenseRequisites license = LicensesFactory.eINSTANCE.createPersonalLicenseRequisites(); + pack.setLicense(license); + return license; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackProduct.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackProduct.java new file mode 100644 index 000000000..f950e6bbc --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackProduct.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2021 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.internal.licenses.model.migration; + +import java.util.function.Function; + +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; +import org.eclipse.passage.lic.licenses.model.api.ProductRef; +import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; + +public final class EnsurePersonalPackProduct implements Function { + + @Override + public ProductRef apply(PersonalLicensePack pack) { + PersonalLicenseRequisites license = new EnsurePersonalPackLicense().apply(pack); + ProductRef product = license.getProduct(); + if (product == null) { + product = LicensesFactory.eINSTANCE.createProductRef(); + license.setProduct(product); + } + return product; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackUser.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackUser.java new file mode 100644 index 000000000..0aae36e01 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/EnsurePersonalPackUser.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2021 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.internal.licenses.model.migration; + +import java.util.function.Function; + +import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; +import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; +import org.eclipse.passage.lic.licenses.model.api.UserRef; +import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory; + +public final class EnsurePersonalPackUser implements Function { + + @Override + public UserRef apply(PersonalLicensePack pack) { + PersonalLicenseRequisites license = new EnsurePersonalPackLicense().apply(pack); + UserRef user = license.getUser(); + if (user == null) { + user = LicensesFactory.eINSTANCE.createUserRef(); + license.setUser(user); + } + return user; + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java index 8b30df485..de8af62a4 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java @@ -13,19 +13,18 @@ package org.eclipse.passage.lic.internal.licenses.model.migration; import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.ecore.xml.type.AnyType; -import org.eclipse.passage.lic.emf.migration.ApplyFeatureMap; +import org.eclipse.passage.lic.emf.migration.DelegateClassifiers; +import org.eclipse.passage.lic.emf.migration.EClassRoutes; +import org.eclipse.passage.lic.emf.migration.SimpleClassRoutes; import org.eclipse.passage.lic.emf.migration.SimpleFeatureRoutes; import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; -import org.eclipse.passage.lic.internal.emf.migration.DelegateClassifiers; +import org.eclipse.passage.lic.internal.emf.migration.RecognizeFeatures; import org.eclipse.passage.lic.internal.licenses.model.AssignGrantIdentifiers; import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; @@ -53,48 +52,65 @@ public void postLoad(XMLResource resource, InputStream inputStream, Map op protected void convertEntry(Entry entry) { EObject key = entry.getKey(); if (key instanceof PersonalLicensePack) { -// LicensePack pack = (LicensePack) key; - SimpleFeatureRoutes route = new SimpleFeatureRoutes(); - route.add("productIdentifier", LicensesPackage.eINSTANCE.getProductRef_Identifier()); //$NON-NLS-1$ - route.add("productVersion", LicensesPackage.eINSTANCE.getProductRef_Version()); //$NON-NLS-1$ - new ApplyFeatureMap(entry.getValue().getAnyAttribute(), route)// - // FIXME: here we will create a ProductRef -// .apply(product.apply(pack)); + PersonalLicensePack pack = (PersonalLicensePack) key; + SimpleFeatureRoutes attributes = new SimpleFeatureRoutes(); +//LicensePack + attributes.define("identifier", LicensesPackage.eINSTANCE.getLicenseRequisites_Identifier()); //$NON-NLS-1$ + attributes.define("productIdentifier", LicensesPackage.eINSTANCE.getProductRef_Identifier()); //$NON-NLS-1$ + attributes.define("productVersion", LicensesPackage.eINSTANCE.getProductRef_Version()); //$NON-NLS-1$ + attributes.define("userIdentifier", LicensesPackage.eINSTANCE.getUserRef_Identifier()); //$NON-NLS-1$ + attributes.define("licenseGrants", LicensesPackage.eINSTANCE.getPersonalLicensePack_Grants()); //$NON-NLS-1$ +//LicenseGrant + attributes.define("conditionExpression", LicensesPackage.eINSTANCE.getLicenseGrant_ConditionExpression()); //$NON-NLS-1$ + attributes.define("conditionType", LicensesPackage.eINSTANCE.getLicenseGrant_ConditionType()); //$NON-NLS-1$ + attributes.define("featureIdentifier", LicensesPackage.eINSTANCE.getLicenseGrant_FeatureIdentifier()); //$NON-NLS-1$ + attributes.define("matchRule", LicensesPackage.eINSTANCE.getLicenseGrant_MatchRule()); //$NON-NLS-1$ + attributes.define("matchVersion", LicensesPackage.eINSTANCE.getLicenseGrant_MatchVersion()); //$NON-NLS-1$ + attributes.define("validFrom", LicensesPackage.eINSTANCE.getLicenseGrant_ValidFrom()); //$NON-NLS-1$ + attributes.define("validUntil", LicensesPackage.eINSTANCE.getLicenseGrant_ValidUntil()); //$NON-NLS-1$ + RecognizeFeatures unknown = new RecognizeFeatures(entry.getValue(), attributes); + unknown// + .mixed(pack)// + .attributes(new EnsurePersonalPackLicense().apply(pack))// + .attributes(new EnsurePersonalPackUser().apply(pack))// + .attributes(new EnsurePersonalPackProduct().apply(pack))// ; + } else { + System.out.println(entry); } } private void migrate033() { - String nsUri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ - LicensesPackage delegate = LicensesPackage.eINSTANCE; - List classifiers = new ArrayList<>(); - classifiers.add(delegate.getPersonalLicensePack().getName()); - classifiers.add(delegate.getLicenseGrant().getName()); - new DelegateClassifiers(nsUri).delegate(delegate, classifiers); + String uri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ + new DelegateClassifiers(uri).delegate(classRoutes200()); } private void migrate040() { - String nsUri = "http://www.eclipse.org/passage/lic/licenses/0.4.0"; //$NON-NLS-1$ - LicensesPackage delegate = LicensesPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(nsUri, ns -> delegate); + String uri = "http://www.eclipse.org/passage/lic/licenses/0.4.0"; //$NON-NLS-1$ + new DelegateClassifiers(uri).delegate(classRoutes200()); } private void migrate050() { - String nsUri = "http://www.eclipse.org/passage/lic/licenses/0.5.0"; //$NON-NLS-1$ - LicensesPackage delegate = LicensesPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(nsUri, ns -> delegate); + String uri = "http://www.eclipse.org/passage/lic/licenses/0.5.0"; //$NON-NLS-1$ + new DelegateClassifiers(uri).delegate(classRoutes200()); } private void migrate100() { - String nsUri = "http://www.eclipse.org/passage/lic/licenses/1.0.0"; //$NON-NLS-1$ - LicensesPackage delegate = LicensesPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(nsUri, ns -> delegate); + String uri = "http://www.eclipse.org/passage/lic/licenses/1.0.0"; //$NON-NLS-1$ + new DelegateClassifiers(uri).delegate(classRoutes200()); } private void migrate110() { - String nsUri = "http://www.eclipse.org/passage/lic/licenses/1.1.0"; //$NON-NLS-1$ + String uri = "http://www.eclipse.org/passage/lic/licenses/1.1.0"; //$NON-NLS-1$ + new DelegateClassifiers(uri).delegate(classRoutes200()); + } + + private EClassRoutes classRoutes200() { LicensesPackage delegate = LicensesPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(nsUri, ns -> delegate); + EClassRoutes smart = new SimpleClassRoutes(); + smart.define("LicensePack", delegate.getPersonalLicensePack()); //$NON-NLS-1$ + smart.define("LicenseGrant", delegate.getLicenseGrant()); //$NON-NLS-1$ + return smart; } } diff --git a/bundles/org.eclipse.passage.lic.products.model/src/org/eclipse/passage/lic/internal/products/model/migration/ProductsResourceHandler.java b/bundles/org.eclipse.passage.lic.products.model/src/org/eclipse/passage/lic/internal/products/model/migration/ProductsResourceHandler.java index 32bf0ceba..77110acf4 100644 --- a/bundles/org.eclipse.passage.lic.products.model/src/org/eclipse/passage/lic/internal/products/model/migration/ProductsResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.products.model/src/org/eclipse/passage/lic/internal/products/model/migration/ProductsResourceHandler.java @@ -12,15 +12,15 @@ *******************************************************************************/ package org.eclipse.passage.lic.internal.products.model.migration; -import java.util.ArrayList; -import java.util.List; import java.util.Map.Entry; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.passage.lic.emf.migration.DelegateClassifiers; +import org.eclipse.passage.lic.emf.migration.EClassRoutes; +import org.eclipse.passage.lic.emf.migration.SimpleClassRoutes; import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; -import org.eclipse.passage.lic.internal.emf.migration.DelegateClassifiers; import org.eclipse.passage.lic.products.model.meta.ProductsPackage; public final class ProductsResourceHandler extends MigratingResourceHandler { @@ -37,20 +37,20 @@ protected void convertEntry(Entry entry) { } private void migrate030() { - String nsUri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ + String uri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ ProductsPackage delegate = ProductsPackage.eINSTANCE; - List classifiers = new ArrayList<>(); - classifiers.add(delegate.getProductLine().getName()); - classifiers.add(delegate.getProduct().getName()); - classifiers.add(delegate.getProductVersion().getName()); - classifiers.add(delegate.getProductVersionFeature().getName()); - new DelegateClassifiers(nsUri).delegate(delegate, classifiers); + EClassRoutes.Smart smart = new EClassRoutes.Smart(new SimpleClassRoutes()); + smart.define(delegate.getProductLine()); + smart.define(delegate.getProduct()); + smart.define(delegate.getProductVersion()); + smart.define(delegate.getProductVersionFeature()); + new DelegateClassifiers(uri).delegate(smart); } private void migrate040() { - String nsUri = "http://www.eclipse.org/passage/lic/products/0.4.0"; //$NON-NLS-1$ + String uri = "http://www.eclipse.org/passage/lic/products/0.4.0"; //$NON-NLS-1$ ProductsPackage delegate = ProductsPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(nsUri, ns -> delegate); + EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate); } } diff --git a/bundles/org.eclipse.passage.lic.users.model/src/org/eclipse/passage/lic/internal/users/model/migration/UsersResourceHandler.java b/bundles/org.eclipse.passage.lic.users.model/src/org/eclipse/passage/lic/internal/users/model/migration/UsersResourceHandler.java index 20f64e17a..5e2684506 100644 --- a/bundles/org.eclipse.passage.lic.users.model/src/org/eclipse/passage/lic/internal/users/model/migration/UsersResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.users.model/src/org/eclipse/passage/lic/internal/users/model/migration/UsersResourceHandler.java @@ -12,15 +12,15 @@ *******************************************************************************/ package org.eclipse.passage.lic.internal.users.model.migration; -import java.util.ArrayList; -import java.util.List; import java.util.Map.Entry; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.passage.lic.emf.migration.DelegateClassifiers; +import org.eclipse.passage.lic.emf.migration.EClassRoutes; +import org.eclipse.passage.lic.emf.migration.SimpleClassRoutes; import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; -import org.eclipse.passage.lic.internal.emf.migration.DelegateClassifiers; import org.eclipse.passage.lic.users.model.meta.UsersPackage; public final class UsersResourceHandler extends MigratingResourceHandler { @@ -40,10 +40,10 @@ protected void convertEntry(Entry entry) { private void migrate033() { String nsUri = "http://www.eclipse.org/passage/lic/0.3.3"; //$NON-NLS-1$ UsersPackage delegate = UsersPackage.eINSTANCE; - List classifiers = new ArrayList<>(); - classifiers.add(delegate.getUserOrigin().getName()); - classifiers.add(delegate.getUser().getName()); - new DelegateClassifiers(nsUri).delegate(delegate, classifiers); + EClassRoutes.Smart smart = new EClassRoutes.Smart(new SimpleClassRoutes()); + smart.define(delegate.getUserOrigin()); + smart.define(delegate.getUser()); + new DelegateClassifiers(nsUri).delegate(smart); } private void migrate040() { diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java index 2badc3aca..c246b694a 100644 --- a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/tests/AssignGrantIdentifiersTest.java @@ -16,6 +16,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.passage.lic.internal.licenses.model.AssignGrantIdentifiers; +import org.eclipse.passage.lic.internal.licenses.model.migration.EnsurePersonalPackLicense; import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites; @@ -37,8 +38,8 @@ public void positive() { new AssignGrantIdentifiers().accept(pack); // then expect("pack-id#0", pack, 0); //$NON-NLS-1$ - assertEquals("pack-id#1", pack, 1); //$NON-NLS-1$ - assertEquals("grant-id", pack, 2); //$NON-NLS-1$ + expect("pack-id#1", pack, 1); //$NON-NLS-1$ + expect("grant-id", pack, 2); //$NON-NLS-1$ } private void expect(String expected, PersonalLicensePack pack, int no) { @@ -47,7 +48,8 @@ private void expect(String expected, PersonalLicensePack pack, int no) { private PersonalLicensePack pack() { PersonalLicensePack pack = LicensesFactory.eINSTANCE.createPersonalLicensePack(); - PersonalLicenseRequisites license = LicensesFactory.eINSTANCE.createPersonalLicenseRequisites(); + new EnsurePersonalPackLicense().apply(pack); + PersonalLicenseRequisites license = pack.getLicense(); license.setIdentifier(id); return pack; } From b4462c18b20379a4e9611b43cb7a72db8ec7b212 Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Sat, 15 May 2021 12:33:11 +0300 Subject: [PATCH 6/8] Bug 572650 - upgrade licenses domain model BaseXmiConditionTransport should use LicensesResourceImpl Signed-off-by: eparovyshnaya --- .../licenses/model/toberemoved/BaseXmiConditionTransport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java index 2a8ea3ee9..d6ba37c36 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/toberemoved/BaseXmiConditionTransport.java @@ -26,7 +26,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; import org.eclipse.passage.lic.internal.api.EvaluationType; import org.eclipse.passage.lic.internal.api.conditions.Condition; import org.eclipse.passage.lic.internal.api.conditions.MatchingRule; @@ -42,6 +41,7 @@ import org.eclipse.passage.lic.licenses.model.api.LicenseGrant; import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; +import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; @SuppressWarnings("restriction") abstract class BaseXmiConditionTransport implements ConditionTransport { @@ -65,7 +65,7 @@ public ContentType id() { @Override public Collection read(InputStream input) throws IOException { // FIXME:AF: should be done via factory - Resource resource = new XMIResourceImpl(); + Resource resource = new LicensesResourceImpl(); resource.load(input, loadOptions()); return resource.getContents().stream() // .filter(PersonalLicensePack.class::isInstance) // From 8660db9e24d549a5bb036315719a861ecdaa0bbc Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Sun, 16 May 2021 18:32:51 +0300 Subject: [PATCH 7/8] Bug 572650 - upgrade licenses domain model - evolve LicResourceHandler to read legacy licenses - extend test coverage Signed-off-by: eparovyshnaya --- .../lic/emf/migration/EFeatureRoutes.java | 3 +- .../emf/migration/SimpleFeatureRoutes.java | 21 ++++++- .../emf/migration/RecognizeFeatures.java | 18 ++++-- .../migration/LicensesResourceHandler.java | 24 +++++--- .../model/1_0_0.lic | 34 ++++++++++++ .../migration/tests/LicenseMigratorTest.java | 55 ++++++++++++++++--- .../demo/tests/access/AccessAcquireTest.java | 3 +- 7 files changed, 130 insertions(+), 28 deletions(-) create mode 100644 tests/org.eclipse.passage.lic.licenses.model.tests/model/1_0_0.lic diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java index 0fb8b0be1..85a70bff1 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/EFeatureRoutes.java @@ -14,6 +14,7 @@ import java.util.Optional; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; /** @@ -23,6 +24,6 @@ public interface EFeatureRoutes { void define(String found, EStructuralFeature destination); - Optional route(String found); + Optional route(String found, EClass scope); } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java index c45959aca..a25fc3c5b 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/migration/SimpleFeatureRoutes.java @@ -16,6 +16,7 @@ import java.util.Map; import java.util.Optional; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; /** @@ -32,13 +33,27 @@ public SimpleFeatureRoutes() { } @Override - public Optional route(String found) { - return Optional.ofNullable(map.get(found)); + public Optional route(String found, EClass context) { + Optional candidate = Optional.ofNullable(map.get(key(found, context))); + if (candidate.isPresent()) { + return candidate; + } + for (EClass upper : context.getEAllSuperTypes()) { + Optional inherited = route(found, upper); + if (inherited.isPresent()) { + return inherited; + } + } + return Optional.empty(); } @Override public void define(String found, EStructuralFeature destination) { - map.put(found, destination); + map.put(destination.getEContainingClass().getName() + '.' + found, destination); + } + + private String key(String found, EClass scope) { + return scope.getName() + '.' + found; } } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java index 30cf565cd..8e846aa76 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/migration/RecognizeFeatures.java @@ -12,8 +12,9 @@ *******************************************************************************/ package org.eclipse.passage.lic.internal.emf.migration; -import java.util.Collections; +import java.util.Collection; import java.util.Iterator; +import java.util.List; import java.util.Objects; import java.util.Optional; @@ -43,12 +44,12 @@ public RecognizeFeatures(AnyType any, EFeatureRoutes features) { this.features = features; } + @SuppressWarnings("unchecked") public RecognizeFeatures mixed(EObject object) { EList references = object.eClass().getEAllReferences(); for (Iterator iterator = any.getMixed().iterator(); iterator.hasNext();) { Entry entry = iterator.next(); - Optional candidate = features.route(entry.getEStructuralFeature().getName())// - .filter(references::contains); + Optional candidate = candidate(object, entry, references); if (!candidate.isPresent()) { continue; } @@ -61,7 +62,7 @@ public RecognizeFeatures mixed(EObject object) { EObject created = type.getEPackage().getEFactoryInstance().create(type); new RecognizeFeatures(child, features).attributes(created); if (feature.isMany()) { - object.eSet(feature, Collections.singletonList(created)); + ((List) object.eGet(feature)).add(created); } else { object.eSet(feature, created); } @@ -70,12 +71,17 @@ public RecognizeFeatures mixed(EObject object) { return this; } + private Optional candidate(EObject object, Entry entry, + Collection all) { + return features.route(entry.getEStructuralFeature().getName(), object.eClass())// + .filter(all::contains); + } + public RecognizeFeatures attributes(EObject object) { EList attributes = object.eClass().getEAllAttributes(); for (Iterator iterator = any.getAnyAttribute().iterator(); iterator.hasNext();) { Entry entry = iterator.next(); - Optional candidate = features.route(entry.getEStructuralFeature().getName())// - .filter(attributes::contains); + Optional candidate = candidate(object, entry, attributes); if (!candidate.isPresent()) { continue; } diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java index de8af62a4..16c4e6daf 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src/org/eclipse/passage/lic/internal/licenses/model/migration/LicensesResourceHandler.java @@ -54,16 +54,26 @@ protected void convertEntry(Entry entry) { if (key instanceof PersonalLicensePack) { PersonalLicensePack pack = (PersonalLicensePack) key; SimpleFeatureRoutes attributes = new SimpleFeatureRoutes(); -//LicensePack - attributes.define("identifier", LicensesPackage.eINSTANCE.getLicenseRequisites_Identifier()); //$NON-NLS-1$ - attributes.define("productIdentifier", LicensesPackage.eINSTANCE.getProductRef_Identifier()); //$NON-NLS-1$ + attributes.define("identifier", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getLicenseRequisites_Identifier()); + attributes.define("issueDate", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getLicenseRequisites_IssueDate()); + attributes.define("licenseGrants", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getPersonalLicensePack_Grants()); + attributes.define("planIdentifier", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getLicenseRequisites_Plan()); + attributes.define("productIdentifier", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getProductRef_Identifier()); attributes.define("productVersion", LicensesPackage.eINSTANCE.getProductRef_Version()); //$NON-NLS-1$ attributes.define("userIdentifier", LicensesPackage.eINSTANCE.getUserRef_Identifier()); //$NON-NLS-1$ - attributes.define("licenseGrants", LicensesPackage.eINSTANCE.getPersonalLicensePack_Grants()); //$NON-NLS-1$ -//LicenseGrant - attributes.define("conditionExpression", LicensesPackage.eINSTANCE.getLicenseGrant_ConditionExpression()); //$NON-NLS-1$ + attributes.define("userFullName", LicensesPackage.eINSTANCE.getUserRef_Name()); //$NON-NLS-1$ + attributes.define("conditionExpression", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getLicenseGrant_ConditionExpression()); attributes.define("conditionType", LicensesPackage.eINSTANCE.getLicenseGrant_ConditionType()); //$NON-NLS-1$ - attributes.define("featureIdentifier", LicensesPackage.eINSTANCE.getLicenseGrant_FeatureIdentifier()); //$NON-NLS-1$ + attributes.define("featureIdentifier", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getLicenseGrant_FeatureIdentifier()); + attributes.define("identifier", //$NON-NLS-1$ + LicensesPackage.eINSTANCE.getLicenseGrant_Identifier()); attributes.define("matchRule", LicensesPackage.eINSTANCE.getLicenseGrant_MatchRule()); //$NON-NLS-1$ attributes.define("matchVersion", LicensesPackage.eINSTANCE.getLicenseGrant_MatchVersion()); //$NON-NLS-1$ attributes.define("validFrom", LicensesPackage.eINSTANCE.getLicenseGrant_ValidFrom()); //$NON-NLS-1$ diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/model/1_0_0.lic b/tests/org.eclipse.passage.lic.licenses.model.tests/model/1_0_0.lic new file mode 100644 index 000000000..4d6de4a75 --- /dev/null +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/model/1_0_0.lic @@ -0,0 +1,34 @@ + + + + + + + + + diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java index 2a29f3096..0131b8936 100644 --- a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java @@ -19,6 +19,11 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.Month; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.util.Date; import java.util.HashMap; import java.util.Locale; @@ -60,16 +65,13 @@ public void from0_5_0() throws Exception { loaded("model/0_5_0.lic"); //$NON-NLS-1$ } - private void loaded(String path) throws IOException, ParseException { - File legacy = new File(System.getProperty("user.dir") + File.separator + path); //$NON-NLS-1$ - URI uri = URI.createFileURI(legacy.getPath()); - // FIXME:AF: should be done via factory - Resource resource = new LicensesResourceImpl(uri); - resource.load(new HashMap<>()); - EList contents = resource.getContents(); - EObject eObject = contents.get(0); + @Test + public void from1_0_0() throws Exception { + loadedTwoGrants("model/1_0_0.lic"); //$NON-NLS-1$ + } - PersonalLicensePack pack = PersonalLicensePack.class.cast(eObject); + private void loaded(String path) throws IOException, ParseException { + PersonalLicensePack pack = pack(path); assertEquals("org.eclipse.passage.lic.evaluation", pack.getLicense().getIdentifier()); //$NON-NLS-1$ assertEquals(null, pack.getLicense().getIssueDate()); assertEquals("org.eclipse.passage.lic.product", pack.getLicense().getProduct().getIdentifier()); //$NON-NLS-1$ @@ -92,4 +94,39 @@ private void loaded(String path) throws IOException, ParseException { assertEquals(getLicensingDateFormat().parse("2019-06-14T00:00:00.000+0300"), //$NON-NLS-1$ grant.getValidUntil()); } + + private PersonalLicensePack pack(String path) throws IOException { + File legacy = new File(System.getProperty("user.dir") + File.separator + path); //$NON-NLS-1$ + URI uri = URI.createFileURI(legacy.getPath()); + // FIXME:AF: should be done via factory + Resource resource = new LicensesResourceImpl(uri); + resource.load(new HashMap<>()); + EList contents = resource.getContents(); + EObject eObject = contents.get(0); + + PersonalLicensePack pack = PersonalLicensePack.class.cast(eObject); + return pack; + } + + private void loadedTwoGrants(String path) throws IOException { + PersonalLicensePack pack = pack(path); + assertEquals("3251ddf1-bd2c-48e4-993a-26fbf7eb3a42", pack.getLicense().getIdentifier()); //$NON-NLS-1$ + assertEquals(issueDate().getTime(), pack.getLicense().getIssueDate().getTime()); // $NON-NLS-1$ + assertEquals("anti-human-magic.product", pack.getLicense().getProduct().getIdentifier()); //$NON-NLS-1$ + assertEquals("0.2.1", pack.getLicense().getProduct().getVersion()); //$NON-NLS-1$ + assertEquals("elder@magic.com", pack.getLicense().getUser().getIdentifier()); //$NON-NLS-1$ + assertEquals("The Elder", pack.getLicense().getUser().getName()); //$NON-NLS-1$ + assertEquals("magic-field-license-plan", pack.getLicense().getPlan()); //$NON-NLS-1$ + + EList grants = pack.getGrants(); + assertEquals(2, grants.size()); + } + + private final Date issueDate() { + return Date.from(// + ZonedDateTime + .of(2020, Month.DECEMBER.getValue(), 2, 16, 30, 50, 176000000, + ZoneId.ofOffset("", ZoneOffset.ofHours(3))) //$NON-NLS-1$ + .toInstant()); + } } diff --git a/tests/org.eclipse.passage.seal.demo.tests/src/org/eclipse/passage/seal/demo/tests/access/AccessAcquireTest.java b/tests/org.eclipse.passage.seal.demo.tests/src/org/eclipse/passage/seal/demo/tests/access/AccessAcquireTest.java index 9b86a6acb..adb0920c6 100644 --- a/tests/org.eclipse.passage.seal.demo.tests/src/org/eclipse/passage/seal/demo/tests/access/AccessAcquireTest.java +++ b/tests/org.eclipse.passage.seal.demo.tests/src/org/eclipse/passage/seal/demo/tests/access/AccessAcquireTest.java @@ -54,8 +54,7 @@ public void acquireTentativeGrant() { */ public void acquireLicenseGrant() { successfullyAcquireAndRelease("prince-to-frog", //$NON-NLS-1$ - diagnostic -> { - }); + diagnostic -> System.out.println(new DiagnosticExplained(diagnostic).get())); } @Test From 05647e3431397fe3287cbb5b733e3a638fb9feb2 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Sun, 16 May 2021 18:56:52 +0300 Subject: [PATCH 8/8] Bug 572650 - upgrade licenses domain model - evolve test coverage for license grants reading Signed-off-by: eparovyshnaya --- .../migration/tests/LicenseMigratorTest.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java index 0131b8936..45173c571 100644 --- a/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java +++ b/tests/org.eclipse.passage.lic.licenses.model.tests/src/org/eclipse/passage/lic/internal/licenses/model/migration/tests/LicenseMigratorTest.java @@ -13,6 +13,7 @@ package org.eclipse.passage.lic.internal.licenses.model.migration.tests; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; @@ -108,9 +109,12 @@ private PersonalLicensePack pack(String path) throws IOException { return pack; } - private void loadedTwoGrants(String path) throws IOException { + private void loadedTwoGrants(String path) throws IOException, ParseException { PersonalLicensePack pack = pack(path); - assertEquals("3251ddf1-bd2c-48e4-993a-26fbf7eb3a42", pack.getLicense().getIdentifier()); //$NON-NLS-1$ + String identifier = pack.getLicense().getIdentifier(); + assertEquals("3251ddf1-bd2c-48e4-993a-26fbf7eb3a42", identifier); //$NON-NLS-1$ + assertEquals(getLicensingDateFormat().parse("2020-12-02T16:30:50.176+0300"), //$NON-NLS-1$ + pack.getLicense().getIssueDate()); assertEquals(issueDate().getTime(), pack.getLicense().getIssueDate().getTime()); // $NON-NLS-1$ assertEquals("anti-human-magic.product", pack.getLicense().getProduct().getIdentifier()); //$NON-NLS-1$ assertEquals("0.2.1", pack.getLicense().getProduct().getVersion()); //$NON-NLS-1$ @@ -120,6 +124,32 @@ private void loadedTwoGrants(String path) throws IOException { EList grants = pack.getGrants(); assertEquals(2, grants.size()); + + assertGrant(grant(identifier, grants, 0), "prince-to-frog", "0.1.0"); //$NON-NLS-1$//$NON-NLS-2$ + assertGrant(grant(identifier, grants, 1), "anti-human-magic.product", "0.2.1"); //$NON-NLS-1$//$NON-NLS-2$ + } + + private LicenseGrant grant(String pack, EList grants, int no) { + String id = String.format("%s#%d", pack, no); //$NON-NLS-1$ + for (LicenseGrant grant : grants) { + if (id.equals(grant.getIdentifier())) { + return grant; + } + } + fail(String.format("There is no grant with id %s", id)); //$NON-NLS-1$ + return null;// unreachable + } + + private void assertGrant(LicenseGrant grant, String feature, String version) throws ParseException { + assertEquals(feature, grant.getFeatureIdentifier()); + assertEquals(version, grant.getMatchVersion()); + assertEquals(null, grant.getMatchRule()); + assertEquals("hardware", grant.getConditionType()); //$NON-NLS-1$ + assertEquals("os.family=*", grant.getConditionExpression()); //$NON-NLS-1$ + assertEquals(getLicensingDateFormat().parse("2020-12-02T00:00:00.000+0300"), //$NON-NLS-1$ + grant.getValidFrom()); + assertEquals(getLicensingDateFormat().parse("2021-12-02T00:00:00.000+0300"), //$NON-NLS-1$ + grant.getValidUntil()); } private final Date issueDate() { @@ -129,4 +159,5 @@ private final Date issueDate() { ZoneId.ofOffset("", ZoneOffset.ofHours(3))) //$NON-NLS-1$ .toInstant()); } + }