From 850dcf3393b5f30c4147eec142d26849fdebafb4 Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Tue, 30 Apr 2024 14:25:59 +0300 Subject: [PATCH] [#1346] Remove RO descriptors layer apply to Agreements domain Signed-off-by: Alexander Fedorov --- .../model/agreements.ecore | 10 +- .../plugin.properties | 17 +-- .../plugin.xml | 4 +- .../model/agreements.genmodel | 4 +- .../plugin.xml | 2 +- .../lic/agreements/model/api/Agreement.java | 13 +- .../agreements/model/api/AgreementGroup.java | 11 +- .../model/impl/AgreementGroupImpl.java | 10 +- .../agreements/model/impl/AgreementImpl.java | 8 +- .../model/impl/AgreementsFactoryImpl.java | 11 +- .../model/impl/AgreementsPackageImpl.java | 56 +------- .../model/meta/AgreementsFactory.java | 5 +- .../model/meta/AgreementsPackage.java | 124 ++++-------------- .../model/util/AgreementsAdapterFactory.java | 64 ++------- .../util/AgreementsResourceFactoryImpl.java | 6 +- .../model/util/AgreementsResourceImpl.java | 15 ++- .../model/util/AgreementsSwitch.java | 52 -------- .../model/AgreementsClassMetadata.java | 10 +- .../migration/AgreementsResourceHandler.java | 45 +++++++ .../.classpath | 7 - .../.project | 24 +--- .../META-INF/MANIFEST.MF | 1 - .../build.properties | 4 +- .../lic/agreements/AgreementDescriptor.java | 27 ---- .../agreements/AgreementGroupDescriptor.java | 27 ---- ...greements.core.AgreementDomainRegistry.xml | 2 +- .../agreements/AgreementRegistry.java | 15 ++- .../core/AgreementDomainRegistry.java | 66 +++++----- .../core/AgreementsDomainRegistryTracker.java | 6 +- .../AgreementIdentifierRenderer.java | 8 +- .../loc/agreements/ui/SelectedAgreement.java | 14 +- .../ui/AgreementsInstanceSupply.java | 4 +- .../agreements/ui/SelectAgreement.java | 13 +- .../agreements/ui/SelectAgreementsGroup.java | 12 +- .../agreements/ui/SupplyAgreementsGroup.java | 10 +- .../ui/panel/DashboardPanelPart.java | 14 +- .../passage/loc/features/ui/FeaturesUi.java | 6 +- .../licenses/core/LicenseAgreements.java | 24 ++-- .../licenses/core/LicenseDomainRegistry.java | 2 +- .../core/i18n/LicensesCoreMessages.java | 4 +- .../core/i18n/LicensesCoreMessages.properties | 3 +- .../passage/loc/products/ui/ProductsUi.java | 12 +- .../passage/loc/workbench/LocWokbench.java | 2 +- 43 files changed, 248 insertions(+), 526 deletions(-) create mode 100644 bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/migration/AgreementsResourceHandler.java delete mode 100644 bundles/org.eclipse.passage.lic.agreements/.classpath delete mode 100644 bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementDescriptor.java delete mode 100644 bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementGroupDescriptor.java diff --git a/bundles/org.eclipse.passage.lic.agreements.ecore/model/agreements.ecore b/bundles/org.eclipse.passage.lic.agreements.ecore/model/agreements.ecore index d71ea7b61..95a69dbd3 100644 --- a/bundles/org.eclipse.passage.lic.agreements.ecore/model/agreements.ecore +++ b/bundles/org.eclipse.passage.lic.agreements.ecore/model/agreements.ecore @@ -1,12 +1,8 @@ - - - + @@ -14,7 +10,7 @@ - + diff --git a/bundles/org.eclipse.passage.lic.agreements.edit/plugin.properties b/bundles/org.eclipse.passage.lic.agreements.edit/plugin.properties index 754ea6a8c..ce0fe6b9f 100644 --- a/bundles/org.eclipse.passage.lic.agreements.edit/plugin.properties +++ b/bundles/org.eclipse.passage.lic.agreements.edit/plugin.properties @@ -21,6 +21,7 @@ available under the terms of the Eclipse Public License 2.0\n\ which is available at https://www.eclipse.org/legal/epl-2.0/\n\ \n\ SPDX-License-Identifier: EPL-2.0\n\ + _UI_CreateChild_text = {0} _UI_CreateChild_text2 = {1} {0} _UI_CreateChild_text3 = {1} @@ -28,23 +29,19 @@ _UI_CreateChild_tooltip = Create New {0} Under {1} Feature _UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. _UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. _UI_PropertyDescriptor_description = The {0} of the {1} - _UI_Agreement_type = Agreement -_UI_AgreementDescriptor_type = Agreement Descriptor -_UI_AgreementGroupDescriptor_type = Agreement Group Descriptor + +_UI_Agreement_type = Agreement _UI_AgreementGroup_type = Agreement Group -_UI_Unknown_type = Object -_UI_Unknown_datatype= Value -_UI_Agreement_identifier_feature = Identifier +_UI_Unknown_type = Object + _UI_Unknown_datatype= Value + _UI_Agreement_identifier_feature = Identifier _UI_Agreement_spdx_feature = Spdx _UI_Agreement_name_feature = Name _UI_Agreement_file_feature = File _UI_Agreement_mime_feature = Mime - _UI_AgreementGroup_identifier_feature = Identifier _UI_AgreementGroup_name_feature = Name _UI_AgreementGroup_description_feature = Description _UI_AgreementGroup_agreements_feature = Agreements - _UI_Unknown_feature = Unspecified - -_UI_CreateChild_text = {0} + diff --git a/bundles/org.eclipse.passage.lic.agreements.edit/plugin.xml b/bundles/org.eclipse.passage.lic.agreements.edit/plugin.xml index d445755ed..bc3aad828 100644 --- a/bundles/org.eclipse.passage.lic.agreements.edit/plugin.xml +++ b/bundles/org.eclipse.passage.lic.agreements.edit/plugin.xml @@ -17,9 +17,9 @@ - + @@ -18,8 +18,6 @@ classPackageSuffix="model.impl" utilityPackageSuffix="model.util" providerPackageSuffix="edit.providers" presentationPackageSuffix="editor" testsPackageSuffix="model.tests" literalsInterface="false" ecorePackage="../../org.eclipse.passage.lic.agreements.ecore/model/agreements.ecore#/"> - - diff --git a/bundles/org.eclipse.passage.lic.agreements.model/plugin.xml b/bundles/org.eclipse.passage.lic.agreements.model/plugin.xml index 615655297..e6f1a6c5a 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/plugin.xml +++ b/bundles/org.eclipse.passage.lic.agreements.model/plugin.xml @@ -17,7 +17,7 @@ diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/Agreement.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/Agreement.java index b6c788f1e..f836df3f6 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/Agreement.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/Agreement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -14,8 +14,6 @@ import org.eclipse.emf.ecore.EObject; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; - /** * * A representation of the model object 'Agreement'. @@ -33,10 +31,10 @@ * * * @see org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage#getAgreement() - * @model superTypes="org.eclipse.passage.lic.agreements.model.api.AgreementDescriptor" + * @model * @generated */ -public interface Agreement extends EObject, AgreementDescriptor { +public interface Agreement extends EObject { /** * Returns the value of the 'Identifier' attribute. * @@ -47,7 +45,6 @@ public interface Agreement extends EObject, AgreementDescriptor { * @model required="true" * @generated */ - @Override String getIdentifier(); /** @@ -70,7 +67,6 @@ public interface Agreement extends EObject, AgreementDescriptor { * @model * @generated */ - @Override String getSpdx(); /** @@ -93,7 +89,6 @@ public interface Agreement extends EObject, AgreementDescriptor { * @model required="true" * @generated */ - @Override String getName(); /** @@ -116,7 +111,6 @@ public interface Agreement extends EObject, AgreementDescriptor { * @model required="true" * @generated */ - @Override String getFile(); /** @@ -139,7 +133,6 @@ public interface Agreement extends EObject, AgreementDescriptor { * @model required="true" * @generated */ - @Override String getMime(); /** diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/AgreementGroup.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/AgreementGroup.java index a65873af9..152db6b73 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/AgreementGroup.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/api/AgreementGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -14,7 +14,6 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; /** * @@ -32,10 +31,10 @@ * * * @see org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage#getAgreementGroup() - * @model superTypes="org.eclipse.passage.lic.agreements.model.api.AgreementGroupDescriptor" + * @model * @generated */ -public interface AgreementGroup extends EObject, AgreementGroupDescriptor { +public interface AgreementGroup extends EObject { /** * Returns the value of the 'Identifier' attribute. * @@ -46,7 +45,6 @@ public interface AgreementGroup extends EObject, AgreementGroupDescriptor { * @model required="true" * @generated */ - @Override String getIdentifier(); /** @@ -69,7 +67,6 @@ public interface AgreementGroup extends EObject, AgreementGroupDescriptor { * @model required="true" * @generated */ - @Override String getName(); /** @@ -92,7 +89,6 @@ public interface AgreementGroup extends EObject, AgreementGroupDescriptor { * @model required="true" * @generated */ - @Override String getDescription(); /** @@ -115,7 +111,6 @@ public interface AgreementGroup extends EObject, AgreementGroupDescriptor { * @model containment="true" * @generated */ - @Override EList getAgreements(); } // AgreementsGroup diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementGroupImpl.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementGroupImpl.java index 4fc281ad5..38853659c 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementGroupImpl.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementGroupImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 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,21 +17,15 @@ 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.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; - import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; - import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; /** @@ -361,4 +355,4 @@ public String toString() { return result.toString(); } -} //AgreementsGroupImpl +} // AgreementsGroupImpl diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementImpl.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementImpl.java index d3273cd21..573e512b5 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementImpl.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 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,14 +15,10 @@ 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.agreements.model.api.Agreement; - import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; /** @@ -412,4 +408,4 @@ public String toString() { return result.toString(); } -} //AgreementImpl +} // AgreementImpl diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsFactoryImpl.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsFactoryImpl.java index 0842d5b95..7716bc351 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsFactoryImpl.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsFactoryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 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,13 +15,10 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; - import org.eclipse.emf.ecore.impl.EFactoryImpl; - import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.passage.lic.agreements.model.api.*; - +import org.eclipse.passage.lic.agreements.model.api.Agreement; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsFactory; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; @@ -121,4 +118,4 @@ public static AgreementsPackage getPackage() { return AgreementsPackage.eINSTANCE; } -} //AgreementsFactoryImpl +} // AgreementsFactoryImpl diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsPackageImpl.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsPackageImpl.java index 81c2b5b17..33dc106e6 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsPackageImpl.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/impl/AgreementsPackageImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 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,15 +15,9 @@ import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; - import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.passage.lic.agreements.AgreementDescriptor; - -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; import org.eclipse.passage.lic.agreements.model.api.Agreement; - import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsFactory; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; @@ -49,20 +43,6 @@ public class AgreementsPackageImpl extends EPackageImpl implements AgreementsPac */ private EClass agreementGroupEClass = null; - /** - * - * - * @generated - */ - private EClass agreementDescriptorEClass = null; - - /** - * - * - * @generated - */ - private EClass agreementGroupDescriptorEClass = null; - /** * Creates an instance of the model Package, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package @@ -237,26 +217,6 @@ public EReference getAgreementGroup_Agreements() { return (EReference) agreementGroupEClass.getEStructuralFeatures().get(3); } - /** - * - * - * @generated - */ - @Override - public EClass getAgreementDescriptor() { - return agreementDescriptorEClass; - } - - /** - * - * - * @generated - */ - @Override - public EClass getAgreementGroupDescriptor() { - return agreementGroupDescriptorEClass; - } - /** * * @@ -287,10 +247,6 @@ public void createPackageContents() { isCreated = true; // Create classes and their features - agreementDescriptorEClass = createEClass(AGREEMENT_DESCRIPTOR); - - agreementGroupDescriptorEClass = createEClass(AGREEMENT_GROUP_DESCRIPTOR); - agreementEClass = createEClass(AGREEMENT); createEAttribute(agreementEClass, AGREEMENT__IDENTIFIER); createEAttribute(agreementEClass, AGREEMENT__SPDX); @@ -334,16 +290,8 @@ public void initializePackageContents() { // Set bounds for type parameters // Add supertypes to classes - agreementEClass.getESuperTypes().add(this.getAgreementDescriptor()); - agreementGroupEClass.getESuperTypes().add(this.getAgreementGroupDescriptor()); // Initialize classes, features, and operations; add parameters - initEClass(agreementDescriptorEClass, AgreementDescriptor.class, "AgreementDescriptor", IS_ABSTRACT, //$NON-NLS-1$ - IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); - - initEClass(agreementGroupDescriptorEClass, AgreementGroupDescriptor.class, "AgreementGroupDescriptor", //$NON-NLS-1$ - IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); - initEClass(agreementEClass, Agreement.class, "Agreement", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ IS_GENERATED_INSTANCE_CLASS); initEAttribute(getAgreement_Identifier(), ecorePackage.getEString(), "identifier", null, 1, 1, Agreement.class, //$NON-NLS-1$ @@ -375,4 +323,4 @@ public void initializePackageContents() { createResource(eNS_URI); } -} //AgreementsPackageImpl +} // AgreementsPackageImpl diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsFactory.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsFactory.java index 909b4f2dc..9dcb81686 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsFactory.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -13,7 +13,6 @@ package org.eclipse.passage.lic.agreements.model.meta; import org.eclipse.emf.ecore.EFactory; - import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; @@ -61,4 +60,4 @@ public interface AgreementsFactory extends EFactory { */ AgreementsPackage getAgreementsPackage(); -} //AgreementsFactory +} // AgreementsFactory diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsPackage.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsPackage.java index 417ef44e8..9dd4eb7c9 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsPackage.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/meta/AgreementsPackage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 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,11 @@ * The Package for the model. * It contains accessors for the meta objects to represent *
    - *
  • each class,
  • - *
  • each feature of each class,
  • - *
  • each operation of each class,
  • - *
  • each enum,
  • - *
  • and each data type
  • + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • *
* * @see org.eclipse.passage.lic.agreements.model.meta.AgreementsFactory @@ -48,7 +48,7 @@ public interface AgreementsPackage extends EPackage { * * @generated */ - String eNS_URI = "http://www.eclipse.org/passage/lic/agreements/0.1.0"; //$NON-NLS-1$ + String eNS_URI = "http://www.eclipse.org/passage/lic/agreements/3.0.0"; //$NON-NLS-1$ /** * The package namespace name. @@ -66,62 +66,6 @@ public interface AgreementsPackage extends EPackage { */ AgreementsPackage eINSTANCE = org.eclipse.passage.lic.agreements.model.impl.AgreementsPackageImpl.init(); - /** - * The meta object id for the '{@link org.eclipse.passage.lic.agreements.AgreementDescriptor Agreement Descriptor}' class. - * - * - * @see org.eclipse.passage.lic.agreements.AgreementDescriptor - * @see org.eclipse.passage.lic.agreements.model.impl.AgreementsPackageImpl#getAgreementDescriptor() - * @generated - */ - int AGREEMENT_DESCRIPTOR = 0; - - /** - * The number of structural features of the 'Agreement Descriptor' class. - * - * - * @generated - * @ordered - */ - int AGREEMENT_DESCRIPTOR_FEATURE_COUNT = 0; - - /** - * The number of operations of the 'Agreement Descriptor' class. - * - * - * @generated - * @ordered - */ - int AGREEMENT_DESCRIPTOR_OPERATION_COUNT = 0; - - /** - * The meta object id for the '{@link org.eclipse.passage.lic.agreements.AgreementGroupDescriptor Agreement Group Descriptor}' class. - * - * - * @see org.eclipse.passage.lic.agreements.AgreementGroupDescriptor - * @see org.eclipse.passage.lic.agreements.model.impl.AgreementsPackageImpl#getAgreementGroupDescriptor() - * @generated - */ - int AGREEMENT_GROUP_DESCRIPTOR = 1; - - /** - * The number of structural features of the 'Agreement Group Descriptor' class. - * - * - * @generated - * @ordered - */ - int AGREEMENT_GROUP_DESCRIPTOR_FEATURE_COUNT = 0; - - /** - * The number of operations of the 'Agreement Group Descriptor' class. - * - * - * @generated - * @ordered - */ - int AGREEMENT_GROUP_DESCRIPTOR_OPERATION_COUNT = 0; - /** * The meta object id for the '{@link org.eclipse.passage.lic.agreements.model.impl.AgreementImpl Agreement}' class. * @@ -130,7 +74,7 @@ public interface AgreementsPackage extends EPackage { * @see org.eclipse.passage.lic.agreements.model.impl.AgreementsPackageImpl#getAgreement() * @generated */ - int AGREEMENT = 2; + int AGREEMENT = 0; /** * The feature id for the 'Identifier' attribute. @@ -139,7 +83,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT__IDENTIFIER = AGREEMENT_DESCRIPTOR_FEATURE_COUNT + 0; + int AGREEMENT__IDENTIFIER = 0; /** * The feature id for the 'Spdx' attribute. @@ -148,7 +92,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT__SPDX = AGREEMENT_DESCRIPTOR_FEATURE_COUNT + 1; + int AGREEMENT__SPDX = 1; /** * The feature id for the 'Name' attribute. @@ -157,7 +101,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT__NAME = AGREEMENT_DESCRIPTOR_FEATURE_COUNT + 2; + int AGREEMENT__NAME = 2; /** * The feature id for the 'File' attribute. @@ -166,7 +110,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT__FILE = AGREEMENT_DESCRIPTOR_FEATURE_COUNT + 3; + int AGREEMENT__FILE = 3; /** * The feature id for the 'Mime' attribute. @@ -175,7 +119,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT__MIME = AGREEMENT_DESCRIPTOR_FEATURE_COUNT + 4; + int AGREEMENT__MIME = 4; /** * The number of structural features of the 'Agreement' class. @@ -184,7 +128,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_FEATURE_COUNT = AGREEMENT_DESCRIPTOR_FEATURE_COUNT + 5; + int AGREEMENT_FEATURE_COUNT = 5; /** * The number of operations of the 'Agreement' class. @@ -193,7 +137,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_OPERATION_COUNT = AGREEMENT_DESCRIPTOR_OPERATION_COUNT + 0; + int AGREEMENT_OPERATION_COUNT = 0; /** * The meta object id for the '{@link org.eclipse.passage.lic.agreements.model.impl.AgreementGroupImpl Agreement Group}' class. @@ -203,7 +147,7 @@ public interface AgreementsPackage extends EPackage { * @see org.eclipse.passage.lic.agreements.model.impl.AgreementsPackageImpl#getAgreementGroup() * @generated */ - int AGREEMENT_GROUP = 3; + int AGREEMENT_GROUP = 1; /** * The feature id for the 'Identifier' attribute. @@ -212,7 +156,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_GROUP__IDENTIFIER = AGREEMENT_GROUP_DESCRIPTOR_FEATURE_COUNT + 0; + int AGREEMENT_GROUP__IDENTIFIER = 0; /** * The feature id for the 'Name' attribute. @@ -221,7 +165,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_GROUP__NAME = AGREEMENT_GROUP_DESCRIPTOR_FEATURE_COUNT + 1; + int AGREEMENT_GROUP__NAME = 1; /** * The feature id for the 'Description' attribute. @@ -230,7 +174,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_GROUP__DESCRIPTION = AGREEMENT_GROUP_DESCRIPTOR_FEATURE_COUNT + 2; + int AGREEMENT_GROUP__DESCRIPTION = 2; /** * The feature id for the 'Agreements' containment reference list. @@ -239,7 +183,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_GROUP__AGREEMENTS = AGREEMENT_GROUP_DESCRIPTOR_FEATURE_COUNT + 3; + int AGREEMENT_GROUP__AGREEMENTS = 3; /** * The number of structural features of the 'Agreement Group' class. @@ -248,7 +192,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_GROUP_FEATURE_COUNT = AGREEMENT_GROUP_DESCRIPTOR_FEATURE_COUNT + 4; + int AGREEMENT_GROUP_FEATURE_COUNT = 4; /** * The number of operations of the 'Agreement Group' class. @@ -257,7 +201,7 @@ public interface AgreementsPackage extends EPackage { * @generated * @ordered */ - int AGREEMENT_GROUP_OPERATION_COUNT = AGREEMENT_GROUP_DESCRIPTOR_OPERATION_COUNT + 0; + int AGREEMENT_GROUP_OPERATION_COUNT = 0; /** * Returns the meta object for class '{@link org.eclipse.passage.lic.agreements.model.api.Agreement Agreement}'. @@ -378,28 +322,6 @@ public interface AgreementsPackage extends EPackage { */ EReference getAgreementGroup_Agreements(); - /** - * Returns the meta object for class '{@link org.eclipse.passage.lic.agreements.AgreementDescriptor Agreement Descriptor}'. - * - * - * @return the meta object for class 'Agreement Descriptor'. - * @see org.eclipse.passage.lic.agreements.AgreementDescriptor - * @model instanceClass="org.eclipse.passage.lic.agreements.AgreementDescriptor" - * @generated - */ - EClass getAgreementDescriptor(); - - /** - * Returns the meta object for class '{@link org.eclipse.passage.lic.agreements.AgreementGroupDescriptor Agreement Group Descriptor}'. - * - * - * @return the meta object for class 'Agreement Group Descriptor'. - * @see org.eclipse.passage.lic.agreements.AgreementGroupDescriptor - * @model instanceClass="org.eclipse.passage.lic.agreements.AgreementGroupDescriptor" - * @generated - */ - EClass getAgreementGroupDescriptor(); - /** * Returns the factory that creates the instances of the model. * @@ -409,4 +331,4 @@ public interface AgreementsPackage extends EPackage { */ AgreementsFactory getAgreementsFactory(); -} //AgreementsPackage +} // AgreementsPackage diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsAdapterFactory.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsAdapterFactory.java index bd49f71d6..83bde7e50 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsAdapterFactory.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -14,22 +14,17 @@ import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; - import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - import org.eclipse.emf.ecore.EObject; - -import org.eclipse.passage.lic.agreements.AgreementDescriptor; - -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; -import org.eclipse.passage.lic.agreements.model.api.*; - +import org.eclipse.passage.lic.agreements.model.api.Agreement; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; /** * * The Adapter Factory for the model. - * It provides an adapter createXXX method for each class of the model. + * It provides an adapter createXXX method for each class of the + * model. * * @see org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage * @generated @@ -58,7 +53,8 @@ public AgreementsAdapterFactory() { /** * Returns whether this factory is applicable for the type of the object. * - * This implementation returns true if the object is either the model's package or is an instance object of the model. + * This implementation returns true if the object is either the + * model's package or is an instance object of the model. * * @return whether this factory is applicable for the type of the object. * @generated @@ -81,16 +77,6 @@ public boolean isFactoryForType(Object object) { * @generated */ protected AgreementsSwitch modelSwitch = new AgreementsSwitch() { - @Override - public Adapter caseAgreementDescriptor(AgreementDescriptor object) { - return createAgreementDescriptorAdapter(); - } - - @Override - public Adapter caseAgreementGroupDescriptor(AgreementGroupDescriptor object) { - return createAgreementGroupDescriptorAdapter(); - } - @Override public Adapter caseAgreement(Agreement object) { return createAgreementAdapter(); @@ -124,7 +110,8 @@ public Adapter createAdapter(Notifier target) { * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.agreements.model.api.Agreement Agreement}'. * * 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. + * it's useful to ignore a case when inheritance will catch all the cases + * anyway. * * @return the new adapter. * @see org.eclipse.passage.lic.agreements.model.api.Agreement @@ -138,7 +125,8 @@ public Adapter createAgreementAdapter() { * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.agreements.model.api.AgreementGroup Agreement Group}'. * * 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. + * it's useful to ignore a case when inheritance will catch all the cases + * anyway. * * @return the new adapter. * @see org.eclipse.passage.lic.agreements.model.api.AgreementGroup @@ -148,34 +136,6 @@ public Adapter createAgreementGroupAdapter() { return null; } - /** - * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.agreements.AgreementDescriptor Agreement 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.agreements.AgreementDescriptor - * @generated - */ - public Adapter createAgreementDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.passage.lic.agreements.AgreementGroupDescriptor Agreement Group 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.agreements.AgreementGroupDescriptor - * @generated - */ - public Adapter createAgreementGroupDescriptorAdapter() { - return null; - } - /** * Creates a new adapter for the default case. * @@ -188,4 +148,4 @@ public Adapter createEObjectAdapter() { return null; } -} //AgreementsAdapterFactory +} // AgreementsAdapterFactory diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceFactoryImpl.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceFactoryImpl.java index e13aa3280..be0cade46 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceFactoryImpl.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceFactoryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -13,9 +13,7 @@ package org.eclipse.passage.lic.agreements.model.util; import org.eclipse.emf.common.util.URI; - import org.eclipse.emf.ecore.resource.Resource; - import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; /** @@ -48,4 +46,4 @@ public Resource createResource(URI uri) { return result; } -} //AgreementsResourceFactoryImpl +} // AgreementsResourceFactoryImpl diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceImpl.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceImpl.java index 95bbe5a3d..74246ed55 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceImpl.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsResourceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,16 +12,19 @@ *******************************************************************************/ package org.eclipse.passage.lic.agreements.model.util; +import java.util.Map; + import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; +import org.eclipse.passage.lic.internal.agreements.model.migration.AgreementsResourceHandler; /** * * The Resource associated with the package. * * @see org.eclipse.passage.lic.agreements.model.util.AgreementsResourceFactoryImpl - * @generated + * @generated NOT */ public class AgreementsResourceImpl extends XMIResourceImpl { /** @@ -35,4 +38,12 @@ public AgreementsResourceImpl(URI uri) { super(uri); } + @Override + protected void init() { + super.init(); + Map options = getDefaultLoadOptions(); + options.put(OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); + options.put(OPTION_RESOURCE_HANDLER, new AgreementsResourceHandler()); + } + } //AgreementsResourceImpl diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsSwitch.java b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsSwitch.java index 8e9eddf57..ac942dcae 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsSwitch.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src-gen/org/eclipse/passage/lic/agreements/model/util/AgreementsSwitch.java @@ -16,10 +16,6 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.Switch; - -import org.eclipse.passage.lic.agreements.AgreementDescriptor; - -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; import org.eclipse.passage.lic.agreements.model.api.*; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; @@ -81,25 +77,9 @@ protected boolean isSwitchFor(EPackage ePackage) { @Override protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { - case AgreementsPackage.AGREEMENT_DESCRIPTOR: { - AgreementDescriptor agreementDescriptor = (AgreementDescriptor) theEObject; - T result = caseAgreementDescriptor(agreementDescriptor); - if (result == null) - result = defaultCase(theEObject); - return result; - } - case AgreementsPackage.AGREEMENT_GROUP_DESCRIPTOR: { - AgreementGroupDescriptor agreementGroupDescriptor = (AgreementGroupDescriptor) theEObject; - T result = caseAgreementGroupDescriptor(agreementGroupDescriptor); - if (result == null) - result = defaultCase(theEObject); - return result; - } case AgreementsPackage.AGREEMENT: { Agreement agreement = (Agreement) theEObject; T result = caseAgreement(agreement); - if (result == null) - result = caseAgreementDescriptor(agreement); if (result == null) result = defaultCase(theEObject); return result; @@ -107,8 +87,6 @@ protected T doSwitch(int classifierID, EObject theEObject) { case AgreementsPackage.AGREEMENT_GROUP: { AgreementGroup agreementGroup = (AgreementGroup) theEObject; T result = caseAgreementGroup(agreementGroup); - if (result == null) - result = caseAgreementGroupDescriptor(agreementGroup); if (result == null) result = defaultCase(theEObject); return result; @@ -148,36 +126,6 @@ public T caseAgreementGroup(AgreementGroup object) { return null; } - /** - * Returns the result of interpreting the object as an instance of 'Agreement 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 'Agreement Descriptor'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAgreementDescriptor(AgreementDescriptor object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'Agreement Group 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 'Agreement Group Descriptor'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAgreementGroupDescriptor(AgreementGroupDescriptor object) { - return null; - } - /** * Returns the result of interpreting the object as an instance of 'EObject'. * diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/AgreementsClassMetadata.java b/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/AgreementsClassMetadata.java index 0acb595cd..3c1c42ff7 100644 --- a/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/AgreementsClassMetadata.java +++ b/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/AgreementsClassMetadata.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 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,6 @@ import java.util.Map; import java.util.Optional; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; @@ -33,18 +31,16 @@ public final class AgreementsClassMetadata implements ClassMetadata { public AgreementsClassMetadata() { meta = AgreementsPackage.eINSTANCE; map = new HashMap, EntityMetadata>(); - map.put(AgreementGroupDescriptor.class, // + map.put(AgreementGroup.class, // new PlainEntityMetadata(// meta.getAgreementGroup(), // meta.getAgreementGroup_Identifier(), // meta.getAgreementGroup_Name())); - map.put(AgreementGroup.class, map.get(AgreementGroupDescriptor.class)); - map.put(AgreementDescriptor.class, // + map.put(Agreement.class, // new PlainEntityMetadata(// meta.getAgreement(), // meta.getAgreement_Identifier(), // meta.getAgreement_Name())); - map.put(Agreement.class, map.get(AgreementDescriptor.class)); } @Override diff --git a/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/migration/AgreementsResourceHandler.java b/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/migration/AgreementsResourceHandler.java new file mode 100644 index 000000000..fe52ef876 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.agreements.model/src/org/eclipse/passage/lic/internal/agreements/model/migration/AgreementsResourceHandler.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2024 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.agreements.model.migration; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; +import org.eclipse.passage.lic.emf.migration.MigrationRoutes; +import org.eclipse.passage.lic.emf.migration.SimpleMigrationRoutes; +import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; + +public final class AgreementsResourceHandler extends MigratingResourceHandler { + + @Override + protected void complete(XMLResource resource) { + // do nothing + } + + @Override + protected void register() { + migrate010(); + } + + @Override + protected MigrationRoutes attributes() { + return new SimpleMigrationRoutes(); + } + + private void migrate010() { + String uri = "http://www.eclipse.org/passage/lic/agreements/0.1.0"; //$NON-NLS-1$ + AgreementsPackage delegate = AgreementsPackage.eINSTANCE; + EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate); + } + +} diff --git a/bundles/org.eclipse.passage.lic.agreements/.classpath b/bundles/org.eclipse.passage.lic.agreements/.classpath deleted file mode 100644 index 81fe078c2..000000000 --- a/bundles/org.eclipse.passage.lic.agreements/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/bundles/org.eclipse.passage.lic.agreements/.project b/bundles/org.eclipse.passage.lic.agreements/.project index 04c6bcbfb..6230a00d2 100644 --- a/bundles/org.eclipse.passage.lic.agreements/.project +++ b/bundles/org.eclipse.passage.lic.agreements/.project @@ -5,11 +5,6 @@ - - org.eclipse.jdt.core.javabuilder - - - org.eclipse.pde.ManifestBuilder @@ -20,22 +15,15 @@ - - org.eclipse.pde.api.tools.apiAnalysisBuilder - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.pde.api.tools.apiAnalysisNature - - .settings - 2 - $%7BPARENT-2-PROJECT_LOC%7D/.settings - - + + .settings + 2 + $%7BPARENT-2-PROJECT_LOC%7D/.settings + + diff --git a/bundles/org.eclipse.passage.lic.agreements/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.agreements/META-INF/MANIFEST.MF index 9a437bf27..5f3aff912 100644 --- a/bundles/org.eclipse.passage.lic.agreements/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.agreements/META-INF/MANIFEST.MF @@ -7,4 +7,3 @@ Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor Bundle-Copyright: %Bundle-Copyright Bundle-RequiredExecutionEnvironment: JavaSE-17 -Export-Package: org.eclipse.passage.lic.agreements diff --git a/bundles/org.eclipse.passage.lic.agreements/build.properties b/bundles/org.eclipse.passage.lic.agreements/build.properties index 6649eb20d..497031022 100644 --- a/bundles/org.eclipse.passage.lic.agreements/build.properties +++ b/bundles/org.eclipse.passage.lic.agreements/build.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2021 ArSysOp +# Copyright (c) 2021, 2024 ArSysOp # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License 2.0 which is available at @@ -11,8 +11,6 @@ # ArSysOp - initial API and implementation ############################################################################### -source.. = src/ -output.. = bin/ bin.includes = META-INF/,\ .,\ OSGI-INF/,\ diff --git a/bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementDescriptor.java b/bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementDescriptor.java deleted file mode 100644 index 7f3b15ac7..000000000 --- a/bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementDescriptor.java +++ /dev/null @@ -1,27 +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.agreements; - -public interface AgreementDescriptor { - - String getIdentifier(); - - String getSpdx(); - - String getName(); - - String getFile(); - - String getMime(); - -} diff --git a/bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementGroupDescriptor.java b/bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementGroupDescriptor.java deleted file mode 100644 index 4d6aec524..000000000 --- a/bundles/org.eclipse.passage.lic.agreements/src/org/eclipse/passage/lic/agreements/AgreementGroupDescriptor.java +++ /dev/null @@ -1,27 +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.agreements; - -import java.util.List; - -public interface AgreementGroupDescriptor { - - String getIdentifier(); - - String getName(); - - String getDescription(); - - List getAgreements(); - -} diff --git a/bundles/org.eclipse.passage.loc.agreements.core/OSGI-INF/org.eclipse.passage.loc.internal.agreements.core.AgreementDomainRegistry.xml b/bundles/org.eclipse.passage.loc.agreements.core/OSGI-INF/org.eclipse.passage.loc.internal.agreements.core.AgreementDomainRegistry.xml index 32024895d..d31ccf1a3 100644 --- a/bundles/org.eclipse.passage.loc.agreements.core/OSGI-INF/org.eclipse.passage.loc.internal.agreements.core.AgreementDomainRegistry.xml +++ b/bundles/org.eclipse.passage.loc.agreements.core/OSGI-INF/org.eclipse.passage.loc.internal.agreements.core.AgreementDomainRegistry.xml @@ -1,5 +1,5 @@ - + diff --git a/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/AgreementRegistry.java b/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/AgreementRegistry.java index 21b4ec9a0..fd079e183 100644 --- a/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/AgreementRegistry.java +++ b/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/AgreementRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -13,18 +13,19 @@ package org.eclipse.passage.loc.internal.agreements; import java.util.Collection; +import java.util.Optional; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.Agreement; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; public interface AgreementRegistry { - Collection groups(); + Collection groups(); - AgreementGroupDescriptor group(String id); + Optional group(String id); - Collection agreements(); + Collection agreements(); - AgreementDescriptor agreement(String id); + Optional agreement(String id); } diff --git a/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementDomainRegistry.java b/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementDomainRegistry.java index 945291742..a409ed358 100644 --- a/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementDomainRegistry.java +++ b/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementDomainRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 ArSysOp + * Copyright (c) 2021, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -14,18 +14,18 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.osgi.util.NLS; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; import org.eclipse.passage.lic.agreements.model.util.AgreementsResourceImpl; @@ -51,11 +51,11 @@ @SuppressWarnings("restriction") @Component(property = { EditingDomainRegistryAccess.PROPERTY_DOMAIN_NAME + '=' + AgreementsPackage.eNAME, EditingDomainRegistryAccess.PROPERTY_FILE_EXTENSION + '=' + "agreements_xmi" }) -public final class AgreementDomainRegistry extends BaseDomainRegistry - implements AgreementRegistry, EditingDomainRegistry { +public final class AgreementDomainRegistry extends BaseDomainRegistry + implements AgreementRegistry, EditingDomainRegistry { - private final Map groups = new HashMap<>(); - private final Map agreements = new HashMap<>(); + private final Map groups = new HashMap<>(); + private final Map agreements = new HashMap<>(); private EventAdmin events; @Override @@ -98,51 +98,49 @@ public String getFileExtension() { } @Override - public Class getContentClass() { - return AgreementGroupDescriptor.class; + public Class getContentClass() { + return AgreementGroup.class; } @Override - public String resolveIdentifier(AgreementGroupDescriptor content) { + public String resolveIdentifier(AgreementGroup content) { return content.getIdentifier(); } @Override - public Collection groups() { + public Collection groups() { return new ArrayList<>(groups.values()); } @Override - public AgreementGroupDescriptor group(String identifier) { - return groups.get(identifier); + public Optional group(String identifier) { + return Optional.ofNullable(groups.get(identifier)); } @Override - public Collection agreements() { + public Collection agreements() { return new ArrayList<>(agreements.values()); } - @SuppressWarnings("unchecked") - public Collection agreements(String id) { - AgreementGroupDescriptor group = groups.get(id); - if (group == null) { - return Collections.emptyList(); - } - return (Collection) group.getAgreements(); + public Collection agreements(String id) { + return group(id)// + .map(AgreementGroup::getAgreements)// + .orElseGet(BasicEList::new)// + .stream().toList(); } @Override - public AgreementDescriptor agreement(String identifier) { - return agreements.get(identifier); + public Optional agreement(String identifier) { + return Optional.ofNullable(agreements.get(identifier)); } @Override - protected DomainContentAdapter createContentAdapter() { + protected DomainContentAdapter createContentAdapter() { return new AgreementsDomainRegistryTracker(this); } - public void registerAgreementGroup(AgreementGroupDescriptor group) { - AgreementGroupDescriptor existing = groups.put(group.getIdentifier(), group); + public void registerAgreementGroup(AgreementGroup group) { + AgreementGroup existing = groups.put(group.getIdentifier(), group); if ((existing != null) && (existing != group)) { String msg = NLS.bind(AgreementsCoreMessages.AgreementDomain_instance_duplication_message, existing, group); Platform.getLog(getClass()).warn(msg); @@ -152,15 +150,15 @@ public void registerAgreementGroup(AgreementGroupDescriptor group) { group.getAgreements().forEach(u -> registerAgreement(u)); } - private void brush(AgreementGroupDescriptor group) { + private void brush(AgreementGroup group) { if (group.getDescription() == null) { - ((AgreementGroup) group).setDescription(""); //$NON-NLS-1$ + group.setDescription(""); //$NON-NLS-1$ } } - public void registerAgreement(AgreementDescriptor agreement) { + public void registerAgreement(Agreement agreement) { String identifier = agreement.getIdentifier(); - AgreementDescriptor existing = agreements.put(identifier, agreement); + Agreement existing = agreements.put(identifier, agreement); if ((existing != null) && (existing != agreement)) { String msg = NLS.bind(AgreementsCoreMessages.AgreementDomain_instance_duplication_message, existing, agreement); @@ -170,7 +168,7 @@ public void registerAgreement(AgreementDescriptor agreement) { } public void unregisterAgreementGroup(String id) { - AgreementGroupDescriptor removed = groups.remove(id); + AgreementGroup removed = groups.remove(id); if (removed != null) { events.postEvent(new EquinoxEvent(AgreementRegistryEvents.AGREEMENT_GROUP_DELETE, removed).get()); removed.getAgreements().forEach(u -> unregisterAgreement(u.getIdentifier())); @@ -178,7 +176,7 @@ public void unregisterAgreementGroup(String id) { } public void unregisterAgreement(String id) { - AgreementDescriptor removed = agreements.remove(id); + Agreement removed = agreements.remove(id); if (removed != null) { events.postEvent(new EquinoxEvent(AgreementRegistryEvents.AGREEMENT_DELETE, removed).get()); } @@ -200,7 +198,7 @@ public EStructuralFeature getContentNameAttribute() { } @Override - public void registerContent(AgreementGroupDescriptor content) { + public void registerContent(AgreementGroup content) { registerAgreementGroup(content); } diff --git a/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementsDomainRegistryTracker.java b/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementsDomainRegistryTracker.java index 44f463183..fb4e89405 100644 --- a/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementsDomainRegistryTracker.java +++ b/bundles/org.eclipse.passage.loc.agreements.core/src/org/eclipse/passage/loc/internal/agreements/core/AgreementsDomainRegistryTracker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -13,15 +13,13 @@ package org.eclipse.passage.loc.internal.agreements.core; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; import org.eclipse.passage.loc.internal.emf.DomainContentAdapter; @SuppressWarnings("restriction") -public class AgreementsDomainRegistryTracker - extends DomainContentAdapter { +public class AgreementsDomainRegistryTracker extends DomainContentAdapter { public AgreementsDomainRegistryTracker(AgreementDomainRegistry registry) { super(registry); diff --git a/bundles/org.eclipse.passage.loc.agreements.emfforms/src/org/eclipse/passage/loc/agreements/emfforms/renderers/AgreementIdentifierRenderer.java b/bundles/org.eclipse.passage.loc.agreements.emfforms/src/org/eclipse/passage/loc/agreements/emfforms/renderers/AgreementIdentifierRenderer.java index 6686b91e4..941fc172a 100644 --- a/bundles/org.eclipse.passage.loc.agreements.emfforms/src/org/eclipse/passage/loc/agreements/emfforms/renderers/AgreementIdentifierRenderer.java +++ b/bundles/org.eclipse.passage.loc.agreements.emfforms/src/org/eclipse/passage/loc/agreements/emfforms/renderers/AgreementIdentifierRenderer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -24,7 +24,7 @@ import org.eclipse.emfforms.spi.core.services.databinding.DatabindingFailedReport; import org.eclipse.emfforms.spi.core.services.databinding.EMFFormsDatabinding; import org.eclipse.emfforms.spi.core.services.label.EMFFormsLabelProvider; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; +import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.loc.agreements.ui.SelectedAgreement; import org.eclipse.passage.loc.internal.agreements.AgreementRegistry; import org.eclipse.passage.loc.workbench.emfforms.renderers.TextWithButtonRenderer; @@ -70,7 +70,7 @@ protected String getUnsetText() { protected void selectIdentifier() { Shell shell = Display.getDefault().getActiveShell(); - AgreementDescriptor initial = null; + Optional initial = Optional.empty(); try { Object value = getModelValue().getValue(); if (value instanceof String) { @@ -80,7 +80,7 @@ protected void selectIdentifier() { } catch (DatabindingFailedException e) { getReportService().report(new DatabindingFailedReport(e)); } - Optional descriptor = new SelectedAgreement(shell, registry, initial).get(); + Optional descriptor = new SelectedAgreement(shell, registry, initial).get(); if (descriptor.isPresent()) { String identifier = descriptor.get().getIdentifier(); if (identifier != null) { diff --git a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/agreements/ui/SelectedAgreement.java b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/agreements/ui/SelectedAgreement.java index 7a9ae7583..30703c622 100644 --- a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/agreements/ui/SelectedAgreement.java +++ b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/agreements/ui/SelectedAgreement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 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,27 +15,27 @@ import java.util.Optional; import java.util.function.Supplier; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; +import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; import org.eclipse.passage.loc.internal.agreements.AgreementRegistry; import org.eclipse.passage.loc.internal.agreements.ui.i18n.AgreementsUiMessages; import org.eclipse.passage.loc.workbench.LocWokbench; import org.eclipse.swt.widgets.Shell; -public final class SelectedAgreement implements Supplier> { +public final class SelectedAgreement implements Supplier> { private final Shell shell; private final AgreementRegistry registry; - private final AgreementDescriptor initial; + private final Optional initial; - public SelectedAgreement(Shell shell, AgreementRegistry registry, AgreementDescriptor initial) { + public SelectedAgreement(Shell shell, AgreementRegistry registry, Optional initial) { this.shell = shell; this.registry = registry; this.initial = initial; } @Override - public Optional get() { + public Optional get() { return Optional.ofNullable(// LocWokbench.selectClassifier(// shell, // @@ -43,7 +43,7 @@ public Optional get() { AgreementsUiMessages.AgreementsUi_select_agreement, // registry.agreements(), // initial, // - AgreementDescriptor.class)// + Agreement.class)// ); } diff --git a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/AgreementsInstanceSupply.java b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/AgreementsInstanceSupply.java index 72286597b..ac6fab654 100644 --- a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/AgreementsInstanceSupply.java +++ b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/AgreementsInstanceSupply.java @@ -14,7 +14,7 @@ import java.util.Optional; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.api.MandatoryService; import org.eclipse.passage.loc.internal.api.ClassSupply; import org.eclipse.passage.loc.internal.api.InstanceSupply; @@ -26,7 +26,7 @@ public final class AgreementsInstanceSupply implements ClassSupply { @Override public Optional> find(Class clazz, MandatoryService context) { - if (AgreementGroupDescriptor.class.isAssignableFrom(clazz)) { + if (AgreementGroup.class.isAssignableFrom(clazz)) { return Optional.of(new SupplyAgreementsGroup(context)); } return Optional.empty(); diff --git a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreement.java b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreement.java index 64e14d648..96705698f 100644 --- a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreement.java +++ b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 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,8 +15,7 @@ import java.util.ArrayList; import java.util.function.Supplier; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; import org.eclipse.passage.lic.api.MandatoryService; import org.eclipse.passage.lic.jface.resource.LicensingImages; @@ -32,18 +31,18 @@ * */ @SuppressWarnings("restriction") -public final class SelectAgreement extends SupplySelectRequest { +public final class SelectAgreement extends SupplySelectRequest { public SelectAgreement(MandatoryService context) { super(context); } @Override - public SelectRequest get() { - return new SelectRequest<>(AgreementDescriptor.class, domain(), input(), appearance()); + public SelectRequest get() { + return new SelectRequest<>(Agreement.class, domain(), input(), appearance()); } - private Supplier> input() { + private Supplier> input() { return () -> new ArrayList<>(context.get(AgreementRegistry.class).agreements()); } diff --git a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreementsGroup.java b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreementsGroup.java index ac2c0c35e..d6c7516d1 100644 --- a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreementsGroup.java +++ b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SelectAgreementsGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 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,7 +15,7 @@ import java.util.ArrayList; import java.util.function.Supplier; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.agreements.model.meta.AgreementsPackage; import org.eclipse.passage.lic.api.MandatoryService; import org.eclipse.passage.lic.jface.resource.LicensingImages; @@ -31,18 +31,18 @@ * */ @SuppressWarnings("restriction") -public final class SelectAgreementsGroup extends SupplySelectRequest { +public final class SelectAgreementsGroup extends SupplySelectRequest { public SelectAgreementsGroup(MandatoryService context) { super(context); } @Override - public SelectRequest get() { - return new SelectRequest<>(AgreementGroupDescriptor.class, domain(), input(), appearance()); + public SelectRequest get() { + return new SelectRequest<>(AgreementGroup.class, domain(), input(), appearance()); } - private Supplier> input() { + private Supplier> input() { return () -> new ArrayList<>(context.get(AgreementRegistry.class).groups()); } diff --git a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SupplyAgreementsGroup.java b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SupplyAgreementsGroup.java index cc5f8520f..005d18371 100644 --- a/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SupplyAgreementsGroup.java +++ b/bundles/org.eclipse.passage.loc.agreements.ui/src/org/eclipse/passage/loc/internal/agreements/ui/SupplyAgreementsGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 ArSysOp + * Copyright (c) 2021, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -14,13 +14,13 @@ import java.util.Optional; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.api.MandatoryService; import org.eclipse.passage.loc.internal.api.InstanceSupply; import org.eclipse.passage.loc.internal.workbench.SelectRoot; @SuppressWarnings("restriction") -public final class SupplyAgreementsGroup implements InstanceSupply { +public final class SupplyAgreementsGroup implements InstanceSupply { private final MandatoryService context; @@ -29,8 +29,8 @@ public SupplyAgreementsGroup(MandatoryService context) { } @Override - public Optional supply() { - return new SelectRoot(new SelectAgreementsGroup(context).get(), context).get(); + public Optional supply() { + return new SelectRoot<>(new SelectAgreementsGroup(context).get(), context).get(); } } diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DashboardPanelPart.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DashboardPanelPart.java index 9d428ced0..6f9e197d1 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DashboardPanelPart.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/panel/DashboardPanelPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2021 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -24,8 +24,8 @@ import org.eclipse.e4.ui.di.UIEventTopic; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; -import org.eclipse.passage.lic.agreements.AgreementGroupDescriptor; +import org.eclipse.passage.lic.agreements.model.api.Agreement; +import org.eclipse.passage.lic.agreements.model.api.AgreementGroup; import org.eclipse.passage.lic.emf.meta.ComposableClassMetadata; import org.eclipse.passage.lic.features.FeatureDescriptor; import org.eclipse.passage.lic.features.FeatureSetDescriptor; @@ -255,26 +255,26 @@ public void deletedUser(@UIEventTopic(UserRegistryEvents.USER_DELETE) UserDescri @Inject @Optional public void createdAgreementsGroup( - @UIEventTopic(AgreementRegistryEvents.AGREEMENT_GROUP_CREATE) AgreementGroupDescriptor input) { + @UIEventTopic(AgreementRegistryEvents.AGREEMENT_GROUP_CREATE) AgreementGroup input) { dashboard.updateAgreementInfo(agreements); } @Inject @Optional public void deletedAgreementsGroup( - @UIEventTopic(AgreementRegistryEvents.AGREEMENT_GROUP_DELETE) AgreementGroupDescriptor input) { + @UIEventTopic(AgreementRegistryEvents.AGREEMENT_GROUP_DELETE) AgreementGroup input) { dashboard.updateAgreementInfo(agreements); } @Inject @Optional - public void createdAgreement(@UIEventTopic(AgreementRegistryEvents.AGREEMENT_CREATE) AgreementDescriptor input) { + public void createdAgreement(@UIEventTopic(AgreementRegistryEvents.AGREEMENT_CREATE) Agreement input) { dashboard.updateAgreementInfo(agreements); } @Inject @Optional - public void deletedAgreement(@UIEventTopic(AgreementRegistryEvents.AGREEMENT_DELETE) AgreementDescriptor input) { + public void deletedAgreement(@UIEventTopic(AgreementRegistryEvents.AGREEMENT_DELETE) Agreement input) { dashboard.updateAgreementInfo(agreements); } diff --git a/bundles/org.eclipse.passage.loc.features.ui/src/org/eclipse/passage/loc/features/ui/FeaturesUi.java b/bundles/org.eclipse.passage.loc.features.ui/src/org/eclipse/passage/loc/features/ui/FeaturesUi.java index 735cdd7f2..ed600471a 100644 --- a/bundles/org.eclipse.passage.loc.features.ui/src/org/eclipse/passage/loc/features/ui/FeaturesUi.java +++ b/bundles/org.eclipse.passage.loc.features.ui/src/org/eclipse/passage/loc/features/ui/FeaturesUi.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.passage.loc.features.ui; +import java.util.Optional; + import org.eclipse.passage.lic.features.FeatureDescriptor; import org.eclipse.passage.lic.features.model.meta.FeaturesPackage; import org.eclipse.passage.loc.internal.features.FeatureRegistry; @@ -31,7 +33,7 @@ public static FeatureDescriptor selectFeatureDescriptor(Shell shell, FeatureRegi String title = FeatureUiMessages.FeaturesUi_select_feature_title; Iterable input = registry.getFeatures(); Class clazz = FeatureDescriptor.class; - return LocWokbench.selectClassifier(shell, classifier, title, input, initial, clazz); + return LocWokbench.selectClassifier(shell, classifier, title, input, Optional.ofNullable(initial), clazz); } } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseAgreements.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseAgreements.java index 0ca4af8cf..683efff83 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseAgreements.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseAgreements.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Optional; -import org.eclipse.passage.lic.agreements.AgreementDescriptor; +import org.eclipse.osgi.util.NLS; import org.eclipse.passage.lic.agreements.model.api.Agreement; import org.eclipse.passage.lic.api.LicensingException; import org.eclipse.passage.lic.api.io.Hashes; @@ -43,24 +43,26 @@ void install(LicensePlanDescriptor plan, LicenseRequisites license) throws Licen Agreements service = new AgreementsService().get(); // TODO: cashed field Hashes hashes = hashes();// TODO: cashed field for (String identifier : plan.getAgreements()) { - installAgreement(license, registry.agreement(identifier), service, hashes); + installAgreement(license, + registry.agreement(identifier).orElseThrow( + () -> new LicensingException(NLS.bind(LicensesCoreMessages.LicenseAgreements_e_agreement_not_found, identifier))), + service, hashes); } } - private void installAgreement(LicenseRequisites license, AgreementDescriptor agreement, Agreements service, - Hashes hashes) throws LicensingException { - if (!service.exists(agreement.getFile(), (Agreement) agreement)) { + private void installAgreement(LicenseRequisites license, Agreement agreement, Agreements service, Hashes hashes) + throws LicensingException { + if (!service.exists(agreement.getFile(), agreement)) { throw new LicensingException(String.format(// LicensesCoreMessages.LicenseOperatorServiceImpl_failed_to_find_agreement_file, // - service.located(agreement.getFile(), (Agreement) agreement).info(), // + service.located(agreement.getFile(), agreement).info(), // agreement.getName())); } license.getAgreements().add(data(agreement, service, hashes)); } - private AgreementData data(AgreementDescriptor agreement, Agreements service, Hashes hashes) - throws LicensingException { + private AgreementData data(Agreement agreement, Agreements service, Hashes hashes) throws LicensingException { AgreementData data = LicensesFactory.eINSTANCE.createAgreementData(); data.setIdentifier(agreement.getIdentifier()); data.setName(agreement.getName()); @@ -73,14 +75,14 @@ private AgreementData data(AgreementDescriptor agreement, Agreements service, Ha return data; } - private byte[] content(AgreementDescriptor agreement, Agreements service) throws LicensingException { + private byte[] content(Agreement agreement, Agreements service) throws LicensingException { try { - return service.located(agreement.getFile(), (Agreement) agreement).content(); + return service.located(agreement.getFile(), agreement).content(); } catch (Exception e) { throw new LicensingException(String.format(// LicensesCoreMessages.LicenseOperatorServiceImpl_failed_to_attach_agreement, // agreement.getName(), // - service.located(agreement.getFile(), (Agreement) agreement).info(), // + service.located(agreement.getFile(), agreement).info(), // e)); } } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseDomainRegistry.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseDomainRegistry.java index 1ca4617ea..f6737ddf7 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseDomainRegistry.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicenseDomainRegistry.java @@ -74,8 +74,8 @@ public void unbindGear(OperatorGearSupplier supplier) { super.unbindGear(supplier); } - @Override @Activate + @Override public void activate(Map properties) { super.activate(properties); } diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.java index 2559fd559..d45563536 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2021 ArSysOp and others + * Copyright (c) 2019, 2024 ArSysOp and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -20,6 +20,8 @@ public final class LicensesCoreMessages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.passage.loc.internal.licenses.core.i18n.LicensesCoreMessages"; //$NON-NLS-1$ public static String EmfObjectPersisted_failed; + public static String LicenseAgreements_e_agreement_not_found; + public static String LicenseOperatorServiceImpl_error_io; public static String LicenseOperatorServiceImpl_export_error; public static String LicenseOperatorServiceImpl_export_success; diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.properties b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.properties index 8ad104f46..55df8e130 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.properties +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/i18n/LicensesCoreMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2019, 2021 ArSysOp and others +# Copyright (c) 2019, 2024 ArSysOp and others # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License 2.0 which is available at @@ -13,6 +13,7 @@ ############################################################################### EmfObjectPersisted_failed=Failed to persist emf object %s to %s +LicenseAgreements_e_agreement_not_found=Agreement not found for {0} LicenseOperatorServiceImpl_error_io=Failed on I/O operation LicenseOperatorServiceImpl_export_error=License Pack export error LicenseOperatorServiceImpl_export_success=License pack exported successfully: \n\n %s \n diff --git a/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/ProductsUi.java b/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/ProductsUi.java index b29335b0c..4270d9ad7 100644 --- a/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/ProductsUi.java +++ b/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/ProductsUi.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 ArSysOp + * Copyright (c) 2018, 2024 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.passage.loc.products.ui; +import java.util.Optional; + import org.eclipse.passage.lic.products.ProductDescriptor; import org.eclipse.passage.lic.products.ProductVersionDescriptor; import org.eclipse.passage.lic.products.model.meta.ProductsPackage; @@ -32,16 +34,16 @@ public static ProductDescriptor selectProductDescriptor(Shell shell, ProductRegi String title = ProductsUiMessages.ProductsUi_select_product; Iterable input = registry.getProducts(); Class clazz = ProductDescriptor.class; - return LocWokbench.selectClassifier(shell, classifier, title, input, initial, clazz); + return LocWokbench.selectClassifier(shell, classifier, title, input, Optional.ofNullable(initial), clazz); } - public static ProductVersionDescriptor selectProductVersionDescriptor(Shell shell, - ProductRegistry registry, ProductVersionDescriptor initial) { + public static ProductVersionDescriptor selectProductVersionDescriptor(Shell shell, ProductRegistry registry, + ProductVersionDescriptor initial) { String classifier = ProductsPackage.eINSTANCE.getProductVersion().getName(); String title = ProductsUiMessages.ProductsUi_select_product_line; Iterable input = registry.getProductVersions(); Class clazz = ProductVersionDescriptor.class; - return LocWokbench.selectClassifier(shell, classifier, title, input, initial, clazz); + return LocWokbench.selectClassifier(shell, classifier, title, input, Optional.ofNullable(initial), clazz); } } diff --git a/bundles/org.eclipse.passage.loc.workbench/src/org/eclipse/passage/loc/workbench/LocWokbench.java b/bundles/org.eclipse.passage.loc.workbench/src/org/eclipse/passage/loc/workbench/LocWokbench.java index 39f1992ea..978f3f2ee 100644 --- a/bundles/org.eclipse.passage.loc.workbench/src/org/eclipse/passage/loc/workbench/LocWokbench.java +++ b/bundles/org.eclipse.passage.loc.workbench/src/org/eclipse/passage/loc/workbench/LocWokbench.java @@ -139,7 +139,7 @@ public static Object selectClassifier(IEclipseContext context, String classi * @since 1.0 */ public static C selectClassifier(Shell shell, String classifier, String title, Iterable input, - C initial, Class clazz) { + Optional initial, Class clazz) { Object selected = selectClassifier(shell, classifier, title, input, initial); if (clazz.isInstance(selected)) { return clazz.cast(selected);