Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2021-05-07 15:07:51 +0000
committerptessier2021-05-07 15:07:51 +0000
commit70902137a256c0e118a045e5812a32e0a13fb307 (patch)
tree988c64bb067b3bb67c40c8bed1e35b4e600465ec
parentcd906b5a18619dd4697d6673d62c8f0af05c37e1 (diff)
downloadorg.eclipse.papyrus-privacydesigner-70902137a256c0e118a045e5812a32e0a13fb307.tar.gz
org.eclipse.papyrus-privacydesigner-70902137a256c0e118a045e5812a32e0a13fb307.tar.xz
org.eclipse.papyrus-privacydesigner-70902137a256c0e118a045e5812a32e0a13fb307.zip
Bug 573434 - [PrivacyDesigner]add article 6
Change-Id: I0a3c54d6359a0bd6b859cb951927f103ff4f84e2 Signed-off-by: ptessier <Patrick.Tessier@cea.fr>
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AbstractLawfulRequirementByCreateCommand.java171
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByConsentCreateCommand.java34
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByContractCreateCommand.java156
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegalObligationCreateCommand.java73
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegitimateInterestCreateCommand.java70
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByPublicInterestCreateCommand.java70
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementBySafeGuardCreateCommand.java161
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByVitalInterestCreateCommand.java70
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/RequirementTestGeneratorImpl.java140
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/src/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.xtend86
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/xtend-gen/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.java218
-rw-r--r--plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/src/org/eclipse/papyrus/pdp4eng/req/ui/GenerateGDPRRequirementHandler.java5
12 files changed, 1048 insertions, 206 deletions
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AbstractLawfulRequirementByCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AbstractLawfulRequirementByCreateCommand.java
new file mode 100644
index 0000000..1f463b0
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AbstractLawfulRequirementByCreateCommand.java
@@ -0,0 +1,171 @@
+/*****************************************************************************
+ * Copyright (c)2020 CEA LIST, Committer Name, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr
+ * Gabriel Pedroza (CEA LIST) gabriel.pedroza@cea.fr
+ *****************************************************************************/
+package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+public abstract class AbstractLawfulRequirementByCreateCommand extends BasicGDPRRequirementCreateCommand {
+
+ private DataSubject dataSubject;
+ public AbstractLawfulRequirementByCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
+ super(domain, owner, id, text,processRequirement);
+ this.dataSubject= dataSubject;
+ }
+
+ @Override
+ protected void createRequirement(Package owner, String id, String text) {
+ StereotypeApplicationHelper stereotypeApplicationHelper = StereotypeApplicationHelper.getInstance(null);
+ GDPRRequirements gdprRrequiement= new GDPRRequirements();
+
+ Class lawfullReq =null;
+ //1. look for LawfulRequirement
+ lawfullReq = lookForLawFullRequirement(owner, lawfullReq);
+
+
+ //2. create the sub requirement
+ Object lawfulObject =getLawfulObject(processRequirement);
+ if( lawfulObject!=null) {
+
+ //1.1 create the class
+ Class requirementClass =UMLFactory.eINSTANCE.createClass();
+
+ //2.1 set the owner
+ setTheOwner(owner, lawfullReq, requirementClass);
+ //3. apply the stereotype
+ stereotypeApplicationHelper.applyStereotype(requirementClass,org.eclipse.papyrus.sysml14.requirements.RequirementsPackage.eINSTANCE.getRequirement(),null );
+ Requirement reqStereotype= (Requirement)UMLUtil.getStereotypeApplication(requirementClass, Requirement.class);
+
+ org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful lawful = applyStereotype(stereotypeApplicationHelper, requirementClass);
+
+ //4. set attribute of the applied stereotype
+ setAttributeAppliedStereotype(gdprRrequiement, lawfulObject, reqStereotype, lawful);
+ //5.set the ID
+ setTheID(id, lawfullReq, requirementClass, reqStereotype);
+ }
+ }
+
+ protected abstract Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass);
+
+ /**get the lawful object to the applied stereotype, fore example a contract to lawfulByContract
+ *
+ * @return
+ */
+ protected abstract Object getLawfulObject(ProcessRequirement process);
+
+ private void setAttributeAppliedStereotype(GDPRRequirements gdprRrequiement, Object lawfulObject, Requirement reqStereotype, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful lawful) {
+ associateLawfulObjectToAppliedStereotype(lawful,lawfulObject);
+ lawful.setDataSubject(dataSubject);
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ lawful.getPersonalData().add((PersonalDataRequirement) personalData);
+ }
+ lawful.setProcess(this.processRequirement);
+
+ setTextOnRequirement( gdprRrequiement,reqStereotype, lawful);
+ }
+
+ /**
+ * apply text on stereotype by taking the type of the lawfulBy
+ * @param reqStereotype
+ * @param lawfulBy
+ */
+ protected abstract void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype,EObject lawfulBy);
+
+ /**set the lawful object to the applied stereotype, fore example a contract to lawfulByContract
+ *
+ * @param lawfulByContract
+ * @param lawfulObject
+ */
+ protected abstract void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject);
+
+ /**
+ * set the id of the requirement
+ * @param id
+ * @param lawfullReq
+ * @param requirementClass
+ * @param reqStereotype
+ */
+ private void setTheID(String id, Class lawfullReq, Class requirementClass, Requirement reqStereotype) {
+ if(lawfullReq==null) {
+ reqStereotype.setId(id);
+ requirementClass.setName(id);
+ }
+ else {
+ reqStereotype.setId(lawfullReq.getName()+"."+lawfullReq.getNestedClassifiers().size());
+ requirementClass.setName(lawfullReq.getName()+"."+lawfullReq.getNestedClassifiers().size());
+ }
+ }
+
+ /** tSet the owner the of the requirement
+ *
+ * @param owner
+ * @param lawfullReq
+ * @param requirementClass
+ */
+ private void setTheOwner(Package owner, Class lawfullReq, Class requirementClass) {
+ if(lawfullReq==null) {
+ owner.getPackagedElements().add(requirementClass);
+ }
+ else {
+ lawfullReq.getNestedClassifiers().add(requirementClass);
+
+ }
+ }
+
+ /**
+ * look for lawfull requirement that could be the owner
+ * @param owner
+ * @param lawfullReq
+ * @return
+ */
+ private Class lookForLawFullRequirement(Package owner, Class lawfullReq) {
+ TreeIterator<EObject> iterator= owner.eAllContents();
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ //test if is is a class
+ if (eObject instanceof Class) {
+ Class aclass=(Class)eObject;
+ org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful lawful= (org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful)UMLUtil.getStereotypeApplication(aclass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful.class);
+ // test if this is a lawfull req.
+ if( lawful!=null) {
+ //test attributes
+ if(lawful.getProcess().equals(this.processRequirement) && lawful.getDataSubject().equals(this.dataSubject)) {
+ lawfullReq=(Class)lawful.getBase_NamedElement();
+ return lawfullReq;
+ }
+ }
+ }
+
+ }
+ return lawfullReq;
+ }
+
+}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByConsentCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByConsentCreateCommand.java
index 44b7246..be49464 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByConsentCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByConsentCreateCommand.java
@@ -17,39 +17,29 @@ package org.eclipse.pdp4eng.req.gdprananalysis.internal;
import java.util.Iterator;
-import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
-/**
- * Copyright (c) 2019 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are the property of the CEA.
- * Any use is subject to specific agreement with the CEA.
- * Contributors:
- *
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- *
- */
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.sysml14.requirements.Requirement;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.util.UMLUtil;
-import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
-
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Consent;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Purpose;
import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
-import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+/**
+ * command for 6.1.a
+ *
+ */
public class LawfulRequirementByConsentCreateCommand extends BasicGDPRRequirementCreateCommand {
private DataSubject dataSubject;
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByContractCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByContractCreateCommand.java
index 337965b..4bcbb32 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByContractCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByContractCreateCommand.java
@@ -15,154 +15,58 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
-/**
- * Copyright (c) 2019 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are the property of the CEA.
- * Any use is subject to specific agreement with the CEA.
- * Contributors:
- *
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- *
- */
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Contract;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
import org.eclipse.papyrus.sysml14.requirements.Requirement;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+/**
+ * command for 6.1.b
+ *
+ */
+public class LawfulRequirementByContractCreateCommand extends AbstractLawfulRequirementByCreateCommand{
-import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Consent;
-import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Contract;
-import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
-import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData;
-import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Purpose;
-import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
-import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
-import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
-import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
-
-public class LawfulRequirementByContractCreateCommand extends BasicGDPRRequirementCreateCommand {
-
- private DataSubject dataSubject;
public LawfulRequirementByContractCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
- super(domain, owner, id, text,processRequirement);
- this.dataSubject= dataSubject;
+ super(domain, owner, id, text,processRequirement, dataSubject);
}
- @Override
- protected void createRequirement(Package owner, String id, String text) {
- StereotypeApplicationHelper stereotypeApplicationHelper = StereotypeApplicationHelper.getInstance(null);
- GDPRRequirements gdprRrequiement= new GDPRRequirements();
-
- Class lawfullReq =null;
- //1. look for LawfulRequirement
- lawfullReq = lookForLawFullRequirement(owner, lawfullReq);
-
-
- //2. create the sub requirement
- for (Iterator<Consent> iteratorConsent = dataSubject.getGivenConsent().iterator(); iteratorConsent.hasNext();) {
- Contract aContract =this.processRequirement.getPerformAContract();
- if( aContract!=null) {
-
- //1.1 create the class
- Class requirementClass =UMLFactory.eINSTANCE.createClass();
-
- //2.1 set the owner
- setTheOwner(owner, lawfullReq, requirementClass);
- //3. apply the stereotype
- stereotypeApplicationHelper.applyStereotype(requirementClass,org.eclipse.papyrus.sysml14.requirements.RequirementsPackage.eINSTANCE.getRequirement(),null );
- Requirement reqStereotype= (Requirement)UMLUtil.getStereotypeApplication(requirementClass, Requirement.class);
- stereotypeApplicationHelper.applyStereotype(requirementClass,pdp4engReqGDPRPackage.eINSTANCE.getLawfulByConsent(),null );
- org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract lawfulRbyContract= (org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract)UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract.class);
- //4. set attribute of the applied stereotype
- setAttributeAppliedStereotype(gdprRrequiement, aContract, reqStereotype, lawfulRbyContract);
- //5.set the ID
- setTheID(id, lawfullReq, requirementClass, reqStereotype);
- }
- }
-
- }
- private void setAttributeAppliedStereotype(GDPRRequirements gdprRrequiement, Contract aContract, Requirement reqStereotype, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract lawfulByContract) {
- lawfulByContract.setContract(aContract);
- lawfulByContract.setDataSubject(dataSubject);
- for (PersonalData personalData : processRequirement.getPersonaldata()) {
- lawfulByContract.getPersonalData().add((PersonalDataRequirement) personalData);
- }
- lawfulByContract.setProcess(this.processRequirement);
- reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByConsent(lawfulByContract));
+ @Override
+ protected Object getLawfulObject(ProcessRequirement process) {
+ return process.getPerformAContract();
}
- /**
- * set the id of the requirement
- * @param id
- * @param lawfullReq
- * @param requirementClass
- * @param reqStereotype
- */
- private void setTheID(String id, Class lawfullReq, Class requirementClass, Requirement reqStereotype) {
- if(lawfullReq==null) {
- reqStereotype.setId(id);
- requirementClass.setName(id);
- }
- else {
- reqStereotype.setId(lawfullReq.getName()+"."+lawfullReq.getNestedClassifiers().size());
- requirementClass.setName(lawfullReq.getName()+"."+lawfullReq.getNestedClassifiers().size());
+ @Override
+ protected void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype, EObject lawfulBy) {
+ if( lawfulBy instanceof LawfulByContract) {
+ LawfulByContract lawfulByContract = (LawfulByContract) lawfulBy;
+ reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByContract(lawfulByContract));
}
}
- /** tSet the owner the of the requirement
- *
- * @param owner
- * @param lawfullReq
- * @param requirementClass
- */
- private void setTheOwner(Package owner, Class lawfullReq, Class requirementClass) {
- if(lawfullReq==null) {
- owner.getPackagedElements().add(requirementClass);
+ @Override
+ protected void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject) {
+ if( lawfulBy instanceof LawfulByContract) {
+ LawfulByContract lawfulByContract = (LawfulByContract) lawfulBy;
+ lawfulByContract.setContract((Contract)lawfulObject);
}
- else {
- lawfullReq.getNestedClassifiers().add(requirementClass);
- }
}
- /**
- * look for lawfull requirement that could be the owner
- * @param owner
- * @param lawfullReq
- * @return
- */
- private Class lookForLawFullRequirement(Package owner, Class lawfullReq) {
- TreeIterator<EObject> iterator= owner.eAllContents();
- while (iterator.hasNext()) {
- EObject eObject = (EObject) iterator.next();
- //test if is is a class
- if (eObject instanceof Class) {
- Class aclass=(Class)eObject;
- org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful lawful= (org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful)UMLUtil.getStereotypeApplication(aclass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful.class);
- // test if this is a lawfull req.
- if( lawful!=null) {
- //test attributes
- if(lawful.getProcess().equals(this.processRequirement) && lawful.getDataSubject().equals(this.dataSubject)) {
- lawfullReq=(Class)lawful.getBase_NamedElement();
- return lawfullReq;
- }
- }
- }
- }
- return lawfullReq;
+ @Override
+ protected Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass) {
+ stereotypeApplicationHelper.applyStereotype(requirementClass, pdp4engReqGDPRPackage.eINSTANCE.getLawfulByContract(),null);
+ return UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract.class);
}
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegalObligationCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegalObligationCreateCommand.java
new file mode 100644
index 0000000..b44c00c
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegalObligationCreateCommand.java
@@ -0,0 +1,73 @@
+/*****************************************************************************
+ * Copyright (c)2020 CEA LIST, Committer Name, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr
+ *****************************************************************************/
+package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.LegalObligation;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegalObligation;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+/**
+ * command for 6.1.c
+ *
+ */
+public class LawfulRequirementByLegalObligationCreateCommand extends AbstractLawfulRequirementByCreateCommand{
+
+ public LawfulRequirementByLegalObligationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
+ super(domain, owner, id, text,processRequirement, dataSubject);
+ }
+
+
+ @Override
+ protected Object getLawfulObject(ProcessRequirement process) {
+ return process.getNeededForLegalObligation();
+ }
+
+ @Override
+ protected void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype, EObject lawfulBy) {
+ if( lawfulBy instanceof LawfulByLegalObligation) {
+ LawfulByLegalObligation lawfulByLegalObligation = (LawfulByLegalObligation) lawfulBy;
+ reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByLegalObligation(lawfulByLegalObligation));
+ }
+ }
+
+ @Override
+ protected void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject) {
+ if( lawfulBy instanceof LawfulByLegalObligation) {
+ LawfulByLegalObligation lawfulByLegalObligation = (LawfulByLegalObligation) lawfulBy;
+ lawfulByLegalObligation.setLegalObligation((LegalObligation)lawfulObject);
+ }
+
+ }
+
+
+
+ @Override
+ protected Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass) {
+ stereotypeApplicationHelper.applyStereotype(requirementClass, pdp4engReqGDPRPackage.eINSTANCE.getLawfulByLegalObligation(),null);
+ return UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegalObligation.class);
+ }
+
+}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegitimateInterestCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegitimateInterestCreateCommand.java
new file mode 100644
index 0000000..11af9f9
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByLegitimateInterestCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c)2020 CEA LIST, Committer Name, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr
+ * Gabriel Pedroza (CEA LIST) gabriel.pedroza@cea.fr
+ *****************************************************************************/
+package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.LegitimateInterest;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegitimateInterest;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+/**
+ * Command for 6.1.f
+ *
+ */
+public class LawfulRequirementByLegitimateInterestCreateCommand extends AbstractLawfulRequirementByCreateCommand{
+
+ public LawfulRequirementByLegitimateInterestCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
+ super(domain, owner, id, text,processRequirement, dataSubject);
+ }
+
+ @Override
+ protected Object getLawfulObject(ProcessRequirement process) {
+ return process.getNeededForLegimateInterest();
+ }
+
+ @Override
+ protected void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype, EObject lawfulBy) {
+ if( lawfulBy instanceof LawfulByLegitimateInterest) {
+ LawfulByLegitimateInterest lawfulByLegalObligation = (LawfulByLegitimateInterest) lawfulBy;
+ reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByLegitimateInterest(lawfulByLegalObligation));
+ }
+ }
+
+ @Override
+ protected void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject) {
+ if( lawfulBy instanceof LawfulByLegitimateInterest) {
+ LawfulByLegitimateInterest lawfulByLegalObligation = (LawfulByLegitimateInterest) lawfulBy;
+ lawfulByLegalObligation.setLegitimateInterest((LegitimateInterest)lawfulObject);
+ }
+
+ }
+
+ @Override
+ protected Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass) {
+ stereotypeApplicationHelper.applyStereotype(requirementClass, pdp4engReqGDPRPackage.eINSTANCE.getLawfulByLegitimateInterest(),null);
+ return UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegitimateInterest.class);
+ }
+} \ No newline at end of file
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByPublicInterestCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByPublicInterestCreateCommand.java
new file mode 100644
index 0000000..df97dc5
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByPublicInterestCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c)2020 CEA LIST, Committer Name, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr
+ *****************************************************************************/
+package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PublicInterest;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByPublicInterest;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+/**
+ * command for 6.1.e
+ * @author PT202707
+ *
+ */
+public class LawfulRequirementByPublicInterestCreateCommand extends AbstractLawfulRequirementByCreateCommand{
+
+ public LawfulRequirementByPublicInterestCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
+ super(domain, owner, id, text,processRequirement, dataSubject);
+ }
+
+ @Override
+ protected Object getLawfulObject(ProcessRequirement process) {
+ return process.getNeededForPublicInterest();
+ }
+
+ @Override
+ protected void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype, EObject lawfulBy) {
+ if( lawfulBy instanceof LawfulByPublicInterest) {
+ LawfulByPublicInterest lawfulByPublicInterest = (LawfulByPublicInterest) lawfulBy;
+ reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByPublicInterest(lawfulByPublicInterest));
+ }
+ }
+
+ @Override
+ protected void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject) {
+ if( lawfulBy instanceof LawfulByPublicInterest) {
+ LawfulByPublicInterest lawfulByPublicInterest = (LawfulByPublicInterest) lawfulBy;
+ lawfulByPublicInterest.setPublicInterest((PublicInterest)lawfulObject);
+ }
+
+ }
+
+ @Override
+ protected Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass) {
+ stereotypeApplicationHelper.applyStereotype(requirementClass, pdp4engReqGDPRPackage.eINSTANCE.getLawfulByPublicInterest(),null);
+ return UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByPublicInterest.class);
+ }
+} \ No newline at end of file
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementBySafeGuardCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementBySafeGuardCreateCommand.java
new file mode 100644
index 0000000..3e6b065
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementBySafeGuardCreateCommand.java
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * Copyright (c)2020 CEA LIST, Committer Name, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr
+ *****************************************************************************/
+package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+/**
+ * Command for the article 6.4
+ *
+ */
+public class LawfulRequirementBySafeGuardCreateCommand extends BasicGDPRRequirementCreateCommand {
+
+ private DataSubject dataSubject;
+ public LawfulRequirementBySafeGuardCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
+ super(domain, owner, id, text,processRequirement);
+ this.dataSubject= dataSubject;
+ }
+
+ @Override
+ protected void createRequirement(Package owner, String id, String text) {
+ StereotypeApplicationHelper stereotypeApplicationHelper = StereotypeApplicationHelper.getInstance(null);
+ GDPRRequirements gdprRrequiement= new GDPRRequirements();
+
+ Class lawfullReq =null;
+ //1. look for LawfulRequirement
+ lawfullReq = lookForLawFullRequirement(owner, lawfullReq);
+ if(processRequirement.getContributedTo().getConsent()!=null) {
+ return;
+ }
+ if( processRequirement.getPerformAContract()!=null) {
+ return;
+ }
+ if( processRequirement.getNeededForLegalObligation()!=null) {
+ return;
+ }
+ if( processRequirement.getNeededForLegimateInterest()!=null) {
+ return;
+ }
+ if( processRequirement.getNeededForPublicInterest()!=null) {
+ return;
+ }
+ if( processRequirement.getNeededForVitalInterest()!=null) {
+ return;
+ }
+ //safeguard shall be created
+ //2. create the sub requirement
+ //1.1 create the class
+ Class requirementClass =UMLFactory.eINSTANCE.createClass();
+
+ //2.1 set the owner
+ setTheOwner(owner, lawfullReq, requirementClass);
+ //3. apply the stereotype
+ stereotypeApplicationHelper.applyStereotype(requirementClass,org.eclipse.papyrus.sysml14.requirements.RequirementsPackage.eINSTANCE.getRequirement(),null );
+ Requirement reqStereotype= (Requirement)UMLUtil.getStereotypeApplication(requirementClass, Requirement.class);
+ stereotypeApplicationHelper.applyStereotype(requirementClass,pdp4engReqGDPRPackage.eINSTANCE.getLawfullBySafeGuard(),null );
+ org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfullBySafeGuard lawfullBySafeGuard= (org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfullBySafeGuard)UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfullBySafeGuard.class);
+ //4. set attribute of the applied stereotype
+ setAttributeAppliedStereotype(gdprRrequiement, reqStereotype, lawfullBySafeGuard);
+ //5.set the ID
+ setTheID(id, lawfullReq, requirementClass, reqStereotype);
+ }
+
+ private void setAttributeAppliedStereotype(GDPRRequirements gdprRrequiement, Requirement reqStereotype, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfullBySafeGuard lawfullBySafeGuard) {
+ lawfullBySafeGuard.setDataSubject(dataSubject);
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ lawfullBySafeGuard.getPersonalData().add((PersonalDataRequirement) personalData);
+ }
+ lawfullBySafeGuard.setProcess(this.processRequirement);
+ reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulBySafeGuard(lawfullBySafeGuard));
+ }
+
+ /**
+ * set the id of the requirement
+ * @param id
+ * @param lawfullReq
+ * @param requirementClass
+ * @param reqStereotype
+ */
+ private void setTheID(String id, Class lawfullReq, Class requirementClass, Requirement reqStereotype) {
+ if(lawfullReq==null) {
+ reqStereotype.setId(id);
+ requirementClass.setName(id);
+ }
+ else {
+ reqStereotype.setId(lawfullReq.getName()+"."+lawfullReq.getNestedClassifiers().size());
+ requirementClass.setName(lawfullReq.getName()+"."+lawfullReq.getNestedClassifiers().size());
+ }
+ }
+
+ /** tSet the owner the of the requirement
+ *
+ * @param owner
+ * @param lawfullReq
+ * @param requirementClass
+ */
+ private void setTheOwner(Package owner, Class lawfullReq, Class requirementClass) {
+ if(lawfullReq==null) {
+ owner.getPackagedElements().add(requirementClass);
+ }
+ else {
+ lawfullReq.getNestedClassifiers().add(requirementClass);
+
+ }
+ }
+
+ /**
+ * look for lawfull requirement that could be the owner
+ * @param owner
+ * @param lawfullReq
+ * @return
+ */
+ private Class lookForLawFullRequirement(Package owner, Class lawfullReq) {
+ TreeIterator<EObject> iterator= owner.eAllContents();
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ //test if is is a class
+ if (eObject instanceof Class) {
+ Class aclass=(Class)eObject;
+ org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful lawful= (org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful)UMLUtil.getStereotypeApplication(aclass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful.class);
+ // test if this is a lawfull req.
+ if( lawful!=null) {
+ //test attributes
+ if(lawful.getProcess().equals(this.processRequirement) && lawful.getDataSubject().equals(this.dataSubject)) {
+ lawfullReq=(Class)lawful.getBase_NamedElement();
+ return lawfullReq;
+ }
+ }
+ }
+
+ }
+ return lawfullReq;
+ }
+
+}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByVitalInterestCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByVitalInterestCreateCommand.java
new file mode 100644
index 0000000..d61d91c
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementByVitalInterestCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c)2020 CEA LIST, Committer Name, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr
+ * Gabriel Pedroza (CEA LIST) gabriel.pedroza@cea.fr
+ *****************************************************************************/
+package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.VitalInterest;
+import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByVitalInterest;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+/**
+ * command for 6.1.d
+ *
+ */
+public class LawfulRequirementByVitalInterestCreateCommand extends AbstractLawfulRequirementByCreateCommand{
+
+ public LawfulRequirementByVitalInterestCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
+ super(domain, owner, id, text,processRequirement, dataSubject);
+ }
+
+ @Override
+ protected Object getLawfulObject(ProcessRequirement process) {
+ return process.getNeededForVitalInterest();
+ }
+
+ @Override
+ protected void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype, EObject lawfulBy) {
+ if( lawfulBy instanceof LawfulByVitalInterest) {
+ LawfulByVitalInterest lawfulByVitalInterest = (LawfulByVitalInterest) lawfulBy;
+ reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByVitalInterest(lawfulByVitalInterest));
+ }
+ }
+
+ @Override
+ protected void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject) {
+ if( lawfulBy instanceof LawfulByVitalInterest) {
+ LawfulByVitalInterest lawfulByVitalInterest = (LawfulByVitalInterest) lawfulBy;
+ lawfulByVitalInterest.setVitalInterest((VitalInterest)lawfulObject);
+ }
+
+ }
+
+ @Override
+ protected Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass) {
+ stereotypeApplicationHelper.applyStereotype(requirementClass, pdp4engReqGDPRPackage.eINSTANCE.getLawfulByLegitimateInterest(),null);
+ return UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByVitalInterest.class);
+ }
+} \ No newline at end of file
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/RequirementTestGeneratorImpl.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/RequirementTestGeneratorImpl.java
index 4b9cb8c..acb4a30 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/RequirementTestGeneratorImpl.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/RequirementTestGeneratorImpl.java
@@ -301,31 +301,151 @@ public class RequirementTestGeneratorImpl implements IRequirementGenerator {
@Override
public Command generateArticle61c(TransactionalEditingDomain domain, Package owner) {
- // TODO Auto-generated method stub
- return null;
+ CompoundCommand compoundCommand= new CompoundCommand();
+ Iterator<EObject> iterator=owner.eAllContents();
+
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if( eObject instanceof NamedElement) {
+ NamedElement namedElement= (NamedElement)eObject;
+ ProcessRequirement processRequirement= (ProcessRequirement)UMLUtil.getStereotypeApplication(namedElement, ProcessRequirement.class);
+ if (processRequirement!=null) {
+ HashSet<DataSubject> dataSubjectList=new HashSet<>();
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ dataSubjectList.addAll(personalData.getRelatedTo());
+ }
+ for (DataSubject dataSubject : dataSubjectList) {
+ index++;
+ String id = prefix+index;
+ Command cmd=new LawfulRequirementByLegalObligationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",processRequirement, dataSubject);
+ compoundCommand.append(cmd);
+ }
+
+
+ }
+ }
+
+ }
+ return compoundCommand;
}
@Override
public Command generateArticle61d(TransactionalEditingDomain domain, Package owner) {
- // TODO Auto-generated method stub
- return null;
+ CompoundCommand compoundCommand= new CompoundCommand();
+ Iterator<EObject> iterator=owner.eAllContents();
+
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if( eObject instanceof NamedElement) {
+ NamedElement namedElement= (NamedElement)eObject;
+ ProcessRequirement processRequirement= (ProcessRequirement)UMLUtil.getStereotypeApplication(namedElement, ProcessRequirement.class);
+ if (processRequirement!=null) {
+ HashSet<DataSubject> dataSubjectList=new HashSet<>();
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ dataSubjectList.addAll(personalData.getRelatedTo());
+ }
+ for (DataSubject dataSubject : dataSubjectList) {
+ index++;
+ String id = prefix+index;
+ Command cmd=new LawfulRequirementByVitalInterestCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",processRequirement, dataSubject);
+ compoundCommand.append(cmd);
+ }
+
+
+ }
+ }
+
+ }
+ return compoundCommand;
}
@Override
public Command generateArticle61e(TransactionalEditingDomain domain, Package owner) {
- // TODO Auto-generated method stub
- return null;
+ CompoundCommand compoundCommand= new CompoundCommand();
+ Iterator<EObject> iterator=owner.eAllContents();
+
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if( eObject instanceof NamedElement) {
+ NamedElement namedElement= (NamedElement)eObject;
+ ProcessRequirement processRequirement= (ProcessRequirement)UMLUtil.getStereotypeApplication(namedElement, ProcessRequirement.class);
+ if (processRequirement!=null) {
+ HashSet<DataSubject> dataSubjectList=new HashSet<>();
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ dataSubjectList.addAll(personalData.getRelatedTo());
+ }
+ for (DataSubject dataSubject : dataSubjectList) {
+ index++;
+ String id = prefix+index;
+ Command cmd=new LawfulRequirementByPublicInterestCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",processRequirement, dataSubject);
+ compoundCommand.append(cmd);
+ }
+
+
+ }
+ }
+
+ }
+ return compoundCommand;
}
@Override
public Command generateArticle61f(TransactionalEditingDomain domain, Package owner) {
- // TODO Auto-generated method stub
- return null;
+ CompoundCommand compoundCommand= new CompoundCommand();
+ Iterator<EObject> iterator=owner.eAllContents();
+
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if( eObject instanceof NamedElement) {
+ NamedElement namedElement= (NamedElement)eObject;
+ ProcessRequirement processRequirement= (ProcessRequirement)UMLUtil.getStereotypeApplication(namedElement, ProcessRequirement.class);
+ if (processRequirement!=null) {
+ HashSet<DataSubject> dataSubjectList=new HashSet<>();
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ dataSubjectList.addAll(personalData.getRelatedTo());
+ }
+ for (DataSubject dataSubject : dataSubjectList) {
+ index++;
+ String id = prefix+index;
+ Command cmd=new LawfulRequirementByLegitimateInterestCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",processRequirement, dataSubject);
+ compoundCommand.append(cmd);
+ }
+
+
+ }
+ }
+
+ }
+ return compoundCommand;
}
@Override
public Command generateArticle64(TransactionalEditingDomain domain, Package owner) {
- // TODO Auto-generated method stub
- return null;
+ CompoundCommand compoundCommand= new CompoundCommand();
+ Iterator<EObject> iterator=owner.eAllContents();
+
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if( eObject instanceof NamedElement) {
+ NamedElement namedElement= (NamedElement)eObject;
+ ProcessRequirement processRequirement= (ProcessRequirement)UMLUtil.getStereotypeApplication(namedElement, ProcessRequirement.class);
+ if (processRequirement!=null) {
+ HashSet<DataSubject> dataSubjectList=new HashSet<>();
+ for (PersonalData personalData : processRequirement.getPersonaldata()) {
+ dataSubjectList.addAll(personalData.getRelatedTo());
+ }
+ for (DataSubject dataSubject : dataSubjectList) {
+ index++;
+ String id = prefix+index;
+ Command cmd=new LawfulRequirementBySafeGuardCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",processRequirement, dataSubject);
+ compoundCommand.append(cmd);
+ }
+
+
+ }
+ }
+
+ }
+ return compoundCommand;
}
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/src/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.xtend b/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/src/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.xtend
index 31b6453..466e67a 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/src/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.xtend
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/src/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.xtend
@@ -26,13 +26,21 @@ import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.SecuritySafety
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.DataMinimisation
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByConsent
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegalObligation
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.VitalInterest
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PublicInterest
+import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.LegitimateInterest
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByVitalInterest
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByPublicInterest
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegitimateInterest
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfullBySafeGuard
class GDPRRequirements {
/**
* get Description for lawfull requirements from rticle5.1
*/
def getDescriptionForLawfulRequirement(Lawful lawful){
- '''IF process "«lawful.process.base_NamedElement.name»" processes "«getPersonalDataFromProcess(lawful)»" of "«lawful.dataSubject.base_NamedElement.name»" THEN the Process "«lawful.process.base_NamedElement.name»" shall be lawfull.'''
+ '''IF process :"«lawful.process.base_NamedElement.name»" processes :"«getPersonalDataFromProcess(lawful)»" of :"«lawful.dataSubject.base_NamedElement.name»" THEN the Process :"«lawful.process.base_NamedElement.name»" shall be lawfull.'''
}
@@ -41,21 +49,21 @@ class GDPRRequirements {
*/
def getDescriptionForFairlyRequirement(Fairly fairly){
- '''IF process "«fairly.process.base_NamedElement.name»" processes "«getPersonalDataFromProcess(fairly)»" of "«fairly.dataSubject.base_NamedElement.name»" THEN the Process "«fairly.process.base_NamedElement.name»" shall be fairly.'''
+ '''IF process :"«fairly.process.base_NamedElement.name»" processes :"«getPersonalDataFromProcess(fairly)»" of :"«fairly.dataSubject.base_NamedElement.name»" THEN the Process :"«fairly.process.base_NamedElement.name»" shall be fairly.'''
}
/**
* get Description for transparent requirements from article5.1
*/
def getDescriptionForTransparentRequirement(Transparency transparency){
- '''IF process "«transparency.process.base_NamedElement.name»" processes "«getPersonalDataFromProcess(transparency)»" of "«transparency.dataSubject.base_NamedElement.name»" THEN the Process "«transparency.process.base_NamedElement.name»" shall be transparent.'''
+ '''IF process :"«transparency.process.base_NamedElement.name»" processes :"«getPersonalDataFromProcess(transparency)»" of :"«transparency.dataSubject.base_NamedElement.name»" THEN the Process :"«transparency.process.base_NamedElement.name»" shall be transparent.'''
}
/**
* get Description for transparent requirements from article5.1.b
*/
def getDescriptionForPurposeLimitation(PurposeLimitation purposeLimitation){
- '''The purpose "«purposeLimitation.purpose.base_NamedElement.name»" of the PersonalData "«purposeLimitation.personalData.base_NamedElement.name»" shall be specified, explicit, legimate, and compatible.'''
+ '''The purpose :"«purposeLimitation.purpose.base_NamedElement.name»" of the PersonalData :"«purposeLimitation.personalData.base_NamedElement.name»" shall be specified, explicit, legimate, and compatible.'''
}
/**
@@ -63,19 +71,19 @@ class GDPRRequirements {
*/
def getDescriptionForDataMinimisation(DataMinimisation dataMinimisation){
- '''Personal Data "«dataMinimisation.personalData.base_NamedElement.name»" shall be adequate, relevant and limited to what is necessary in relation to the purpose "«dataMinimisation.purpose.base_NamedElement.name»" for which they are processed'''
+ '''Personal Data :"«dataMinimisation.personalData.base_NamedElement.name»" shall be adequate, relevant and limited to what is necessary in relation to the purpose :"«dataMinimisation.purpose.base_NamedElement.name»" for which they are processed'''
}
/**
* get Description for transparent requirements from article5.1.d
*/
def getDescriptionForAccurate(Accuracy accuracy){
- '''Personal Data "«accuracy.personalData.base_NamedElement.name»" shall be accurate and, where necessary, kept up to date. If personal data "«accuracy.personalData.base_NamedElement.name»" are inaccurate, having regard to the purposes "«accuracy.purpose.base_NamedElement.name»" for which they are processed, it shall erased or rectified without delay.'''
+ '''Personal Data :"«accuracy.personalData.base_NamedElement.name»" shall be accurate and, where necessary, kept up to date. If personal data :"«accuracy.personalData.base_NamedElement.name»" are inaccurate, having regard to the purposes :"«accuracy.purpose.base_NamedElement.name»" for which they are processed, it shall erased or rectified without delay.'''
}
/**
* get Description for transparent requirements from article5.1.e
*/
def getDescriptionForStorageLimitation(StorageLimitation storageLimitation){
- '''Personal Data "«storageLimitation.personalData.base_NamedElement.name»" shall be kept in a form which permits identification of data subject "«storageLimitation.personalData.relatedTo.get(0).base_NamedElement.name»" for no longer than is necessary for the purpose "«storageLimitation.purpose.base_NamedElement.name»" for which the personal data are processed'''
+ '''Personal Data :"«storageLimitation.personalData.base_NamedElement.name»" shall be kept in a form which permits identification of data subject :"«storageLimitation.personalData.relatedTo.get(0).base_NamedElement.name»" for no longer than is necessary for the purpose :"«storageLimitation.purpose.base_NamedElement.name»" for which the personal data are processed'''
}
@@ -83,23 +91,63 @@ class GDPRRequirements {
* get Description for transparent requirements from article5.1.e
*/
def getDescriptionForSecuritySafety(SecuritySafety securitySafety){
- '''Personal Data «getPersonalDataFromProcess(securitySafety)» shall be processed in a manner that ensures appropriate security. '''
+ '''Personal Data «getPersonalDataFromProcess(securitySafety)»" shall be processed in a manner that ensures appropriate security. '''
}
-
+
/**
* get Description for lawfullByConsent requirements from article6.1.a
*/
def getDescriptionForLawfulByConsent(LawfulByConsent lawfulByConsent){
- '''Processing "«lawfulByConsent.process.base_NamedElement.name»" shall be lawful if the data subject "«lawfulByConsent.dataSubject.base_NamedElement.name»" has given consent "«lawfulByConsent.consent.base_NamedElement.name»" to the processing of his or her personal data :"«getPersonalDataFromProcess(lawfulByConsent)»" for one or more specific purposes «lawfulByConsent.process.contributedTo.base_NamedElement.name»'''
+ '''Processing :"«lawfulByConsent.process.base_NamedElement.name»" shall be lawful if the data subject :"«lawfulByConsent.dataSubject.base_NamedElement.name»" has given consent :"«lawfulByConsent.consent.base_NamedElement.name»" to the processing of his or her personal data :"«getPersonalDataFromProcess(lawfulByConsent)»" for one or more specific purposes :"«lawfulByConsent.process.contributedTo.base_NamedElement.name»"'''
}
/**
* get Description for lawfullByContract requirements from article6.1.b
*/
- def getDescriptionForLawfulByConsent(LawfulByContract lawfulByContract){
- '''Processing "«lawfulByContract.process.base_NamedElement.name»" shall be lawful if processing "«lawfulByContract.process.base_NamedElement.name»" is necessary for the performance of the contract:"«lawfulByContract.contract.base_NamedElement»" to which the data subject:"«lawfulByContract.dataSubject.base_NamedElement.name»" is party or in order to take steps at the request of the data subject prior to entering into a contract'''
+ def getDescriptionForLawfulByContract(LawfulByContract lawfulByContract){
+ '''Processing :"«lawfulByContract.process.base_NamedElement.name»" shall be lawful if processing :"«lawfulByContract.process.base_NamedElement.name»" is necessary for the performance of the contract:"«lawfulByContract.contract.base_NamedElement.name»" to which the data subject:"«lawfulByContract.dataSubject.base_NamedElement.name»" is party or in order to take steps at the request of the data subject prior to entering into a contract'''
}
-
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.c
+ */
+ def getDescriptionForLawfulByLegalObligation(LawfulByLegalObligation lawfulByLegalObligation){
+ '''Processing :"«lawfulByLegalObligation.process.base_NamedElement.name»" shall be lawful if processing is necessary for compliance with a legal obligation :"«lawfulByLegalObligation.legalObligation.base_NamedElement.name»"to which the controller: "«getDataControlerFromProcess(lawfulByLegalObligation)»" is subject'''
+ }
+
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.d
+ */
+ def getDescriptionForLawfulByVitalInterest(LawfulByVitalInterest lawfulByVitalInterest){
+ '''Processing :"«lawfulByVitalInterest.process.base_NamedElement.name»" shall be lawful if processing is necessary in order to protect the vital interests of the data subject :"«lawfulByVitalInterest.dataSubject.base_NamedElement.name»" or of another natural person'''
+ }
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.e
+ */
+ def getDescriptionForLawfulByPublicInterest(LawfulByPublicInterest lawfulByPublicInterest){
+ '''Processing :"«lawfulByPublicInterest.process.base_NamedElement.name»" shall be lawful if processing is necessary for the performance of a task carried out in the public interest or in the exercise of official authority vested in the controller : "«getDataControlerFromProcess(lawfulByPublicInterest)»"'''
+ }
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.f
+ */
+ def getDescriptionForLawfulByLegitimateInterest(LawfulByLegitimateInterest lawfulByLegitimateInterest){
+ '''Processing :"«lawfulByLegitimateInterest.process.base_NamedElement.name»" shall be lawful if processing is necessary for the purposes of the legitimate interests :"«lawfulByLegitimateInterest.legitimateInterest.base_NamedElement.name»" pursued by the controller :"«getDataControlerFromProcess(lawfulByLegitimateInterest)»"or by a third party, except where such interests are overridden by the interests or fundamental rights and freedoms of the data subject which require protection of personal data, in particular where the data subject is a child.
+'''
+ }
+
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.f
+ */
+ def getDescriptionForLawfulBySafeGuard(LawfullBySafeGuard lawfullBySafeGuard){
+'''Where the processing :"«lawfullBySafeGuard.process.base_NamedElement.name»" for a purpose :"«lawfullBySafeGuard.process.contributedTo.base_NamedElement.name»" other than that for which the personal data :"«getPersonalDataFromProcess(lawfullBySafeGuard)»" have been collected is not based on the data subject’s consent or
+on a Union or Member State law which constitutes a necessary and proportionate measure in a democratic society to safeguard the objectives referred to in Article 23(1), the controller :"«getDataControlerFromProcess(lawfullBySafeGuard)»" shall,
+in order to ascertain whether processing for another purpose is compatible with the purpose for which the personal data are initially collected, take into account, inter alia:
+any link between the purposes «lawfullBySafeGuard.process.contributedTo.base_NamedElement.name»"for which the personal data :"«getPersonalDataFromProcess(lawfullBySafeGuard)»"have been collected and the purposes of the intended further processing;
+ - the context in which the personal data: "«getPersonalDataFromProcess(lawfullBySafeGuard)»" have been collected, in particular regarding the relationship between data subjects :"«lawfullBySafeGuard.dataSubject.base_NamedElement.name»" and the controller:«getDataControlerFromProcess(lawfullBySafeGuard)»
+ - the nature of the personal data: "«getPersonalDataFromProcess(lawfullBySafeGuard)»"" , in particular whether special categories of personal data are processed, pursuant to Article 9, or whether personal data related to criminal convictions and offences are processed, pursuant to Article 10;
+ - the possible consequences of the intended further processing for data subjects:"«lawfullBySafeGuard.dataSubject.base_NamedElement.name»
+ - the existence of appropriate safeguards, which may include encryption or pseudonymisation.'''
+ }
+
def getPersonalDataFromProcess(ProcessPrinciple ProcessPrinciple){
var result = ""
@@ -109,5 +157,17 @@ class GDPRRequirements {
return result
}
+ def getDataControlerFromProcess(ProcessPrinciple ProcessPrinciple){
+ var result = ""
+
+ for (data : ProcessPrinciple.personalData) {
+ if(result.indexOf(""+data.responsible.base_NamedElement.name)==-1){
+ result=result+ data.responsible.base_NamedElement.name+" ";
+ }
+
+ }
+ return result
+ }
+
} \ No newline at end of file
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/xtend-gen/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/xtend-gen/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.java
index f1857f5..20a4c7c 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/xtend-gen/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.metareq/xtend-gen/org/eclipse/papyrus/pdp4eng/req/metareq/GDPRRequirements.java
@@ -22,13 +22,17 @@ import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Fairly;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByConsent;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByContract;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegalObligation;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegitimateInterest;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByPublicInterest;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByVitalInterest;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfullBySafeGuard;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessPrinciple;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PurposeLimitation;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.SecuritySafety;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.StorageLimitation;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Transparency;
-import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.xtend2.lib.StringConcatenation;
@SuppressWarnings("all")
@@ -38,16 +42,16 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForLawfulRequirement(final Lawful lawful) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("IF process \"");
+ _builder.append("IF process :\"");
String _name = lawful.getProcess().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" processes \"");
+ _builder.append("\" processes :\"");
String _personalDataFromProcess = this.getPersonalDataFromProcess(lawful);
_builder.append(_personalDataFromProcess);
- _builder.append("\" of \"");
+ _builder.append("\" of :\"");
String _name_1 = lawful.getDataSubject().getBase_NamedElement().getName();
_builder.append(_name_1);
- _builder.append("\" THEN the Process \"");
+ _builder.append("\" THEN the Process :\"");
String _name_2 = lawful.getProcess().getBase_NamedElement().getName();
_builder.append(_name_2);
_builder.append("\" shall be lawfull.");
@@ -59,16 +63,16 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForFairlyRequirement(final Fairly fairly) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("IF process \"");
+ _builder.append("IF process :\"");
String _name = fairly.getProcess().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" processes \"");
+ _builder.append("\" processes :\"");
String _personalDataFromProcess = this.getPersonalDataFromProcess(fairly);
_builder.append(_personalDataFromProcess);
- _builder.append("\" of \"");
+ _builder.append("\" of :\"");
String _name_1 = fairly.getDataSubject().getBase_NamedElement().getName();
_builder.append(_name_1);
- _builder.append("\" THEN the Process \"");
+ _builder.append("\" THEN the Process :\"");
String _name_2 = fairly.getProcess().getBase_NamedElement().getName();
_builder.append(_name_2);
_builder.append("\" shall be fairly.");
@@ -80,16 +84,16 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForTransparentRequirement(final Transparency transparency) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("IF process \"");
+ _builder.append("IF process :\"");
String _name = transparency.getProcess().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" processes \"");
+ _builder.append("\" processes :\"");
String _personalDataFromProcess = this.getPersonalDataFromProcess(transparency);
_builder.append(_personalDataFromProcess);
- _builder.append("\" of \"");
+ _builder.append("\" of :\"");
String _name_1 = transparency.getDataSubject().getBase_NamedElement().getName();
_builder.append(_name_1);
- _builder.append("\" THEN the Process \"");
+ _builder.append("\" THEN the Process :\"");
String _name_2 = transparency.getProcess().getBase_NamedElement().getName();
_builder.append(_name_2);
_builder.append("\" shall be transparent.");
@@ -101,10 +105,10 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForPurposeLimitation(final PurposeLimitation purposeLimitation) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("The purpose \"");
+ _builder.append("The purpose :\"");
String _name = purposeLimitation.getPurpose().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" of the PersonalData \"");
+ _builder.append("\" of the PersonalData :\"");
String _name_1 = purposeLimitation.getPersonalData().getBase_NamedElement().getName();
_builder.append(_name_1);
_builder.append("\" shall be specified, explicit, legimate, and compatible.");
@@ -116,10 +120,10 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForDataMinimisation(final DataMinimisation dataMinimisation) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("Personal Data \"");
+ _builder.append("Personal Data :\"");
String _name = dataMinimisation.getPersonalData().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" shall be adequate, relevant and limited to what is necessary in relation to the purpose \"");
+ _builder.append("\" shall be adequate, relevant and limited to what is necessary in relation to the purpose :\"");
String _name_1 = dataMinimisation.getPurpose().getBase_NamedElement().getName();
_builder.append(_name_1);
_builder.append("\" for which they are processed");
@@ -131,13 +135,13 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForAccurate(final Accuracy accuracy) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("Personal Data \"");
+ _builder.append("Personal Data :\"");
String _name = accuracy.getPersonalData().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" shall be accurate and, where necessary, kept up to date. If personal data \"");
+ _builder.append("\" shall be accurate and, where necessary, kept up to date. If personal data :\"");
String _name_1 = accuracy.getPersonalData().getBase_NamedElement().getName();
_builder.append(_name_1);
- _builder.append("\" are inaccurate, having regard to the purposes \"");
+ _builder.append("\" are inaccurate, having regard to the purposes :\"");
String _name_2 = accuracy.getPurpose().getBase_NamedElement().getName();
_builder.append(_name_2);
_builder.append("\" for which they are processed, it shall erased or rectified without delay.");
@@ -149,13 +153,13 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForStorageLimitation(final StorageLimitation storageLimitation) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("Personal Data \"");
+ _builder.append("Personal Data :\"");
String _name = storageLimitation.getPersonalData().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" shall be kept in a form which permits identification of data subject \"");
+ _builder.append("\" shall be kept in a form which permits identification of data subject :\"");
String _name_1 = storageLimitation.getPersonalData().getRelatedTo().get(0).getBase_NamedElement().getName();
_builder.append(_name_1);
- _builder.append("\" for no longer than is necessary for the purpose \"");
+ _builder.append("\" for no longer than is necessary for the purpose :\"");
String _name_2 = storageLimitation.getPurpose().getBase_NamedElement().getName();
_builder.append(_name_2);
_builder.append("\" for which the personal data are processed");
@@ -170,7 +174,7 @@ public class GDPRRequirements {
_builder.append("Personal Data ");
String _personalDataFromProcess = this.getPersonalDataFromProcess(securitySafety);
_builder.append(_personalDataFromProcess);
- _builder.append(" shall be processed in a manner that ensures appropriate security. ");
+ _builder.append("\" shall be processed in a manner that ensures appropriate security. ");
return _builder;
}
@@ -179,45 +183,171 @@ public class GDPRRequirements {
*/
public CharSequence getDescriptionForLawfulByConsent(final LawfulByConsent lawfulByConsent) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("Processing \"");
+ _builder.append("Processing :\"");
String _name = lawfulByConsent.getProcess().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" shall be lawful if the data subject \"");
+ _builder.append("\" shall be lawful if the data subject :\"");
String _name_1 = lawfulByConsent.getDataSubject().getBase_NamedElement().getName();
_builder.append(_name_1);
- _builder.append("\" has given consent \"");
+ _builder.append("\" has given consent :\"");
String _name_2 = lawfulByConsent.getConsent().getBase_NamedElement().getName();
_builder.append(_name_2);
_builder.append("\" to the processing of his or her personal data :\"");
String _personalDataFromProcess = this.getPersonalDataFromProcess(lawfulByConsent);
_builder.append(_personalDataFromProcess);
- _builder.append("\" for one or more specific purposes ");
+ _builder.append("\" for one or more specific purposes :\"");
String _name_3 = lawfulByConsent.getProcess().getContributedTo().getBase_NamedElement().getName();
_builder.append(_name_3);
+ _builder.append("\"");
return _builder;
}
/**
* get Description for lawfullByContract requirements from article6.1.b
*/
- public CharSequence getDescriptionForLawfulByConsent(final LawfulByContract lawfulByContract) {
+ public CharSequence getDescriptionForLawfulByContract(final LawfulByContract lawfulByContract) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("Processing \"");
+ _builder.append("Processing :\"");
String _name = lawfulByContract.getProcess().getBase_NamedElement().getName();
_builder.append(_name);
- _builder.append("\" shall be lawful if processing \"");
+ _builder.append("\" shall be lawful if processing :\"");
String _name_1 = lawfulByContract.getProcess().getBase_NamedElement().getName();
_builder.append(_name_1);
_builder.append("\" is necessary for the performance of the contract:\"");
- NamedElement _base_NamedElement = lawfulByContract.getContract().getBase_NamedElement();
- _builder.append(_base_NamedElement);
- _builder.append("\" to which the data subject:\"");
- String _name_2 = lawfulByContract.getDataSubject().getBase_NamedElement().getName();
+ String _name_2 = lawfulByContract.getContract().getBase_NamedElement().getName();
_builder.append(_name_2);
+ _builder.append("\" to which the data subject:\"");
+ String _name_3 = lawfulByContract.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_3);
_builder.append("\" is party or in order to take steps at the request of the data subject prior to entering into a contract");
return _builder;
}
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.c
+ */
+ public CharSequence getDescriptionForLawfulByLegalObligation(final LawfulByLegalObligation lawfulByLegalObligation) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("Processing :\"");
+ String _name = lawfulByLegalObligation.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" shall be lawful if processing is necessary for compliance with a legal obligation :\"");
+ String _name_1 = lawfulByLegalObligation.getLegalObligation().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\"to which the controller: \"");
+ String _dataControlerFromProcess = this.getDataControlerFromProcess(lawfulByLegalObligation);
+ _builder.append(_dataControlerFromProcess);
+ _builder.append("\" is subject");
+ return _builder;
+ }
+
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.d
+ */
+ public CharSequence getDescriptionForLawfulByVitalInterest(final LawfulByVitalInterest lawfulByVitalInterest) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("Processing :\"");
+ String _name = lawfulByVitalInterest.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" shall be lawful if processing is necessary in order to protect the vital interests of the data subject :\"");
+ String _name_1 = lawfulByVitalInterest.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" or of another natural person");
+ return _builder;
+ }
+
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.e
+ */
+ public CharSequence getDescriptionForLawfulByPublicInterest(final LawfulByPublicInterest lawfulByPublicInterest) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("Processing :\"");
+ String _name = lawfulByPublicInterest.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" shall be lawful if processing is necessary for the performance of a task carried out in the public interest or in the exercise of official authority vested in the controller : \"");
+ String _dataControlerFromProcess = this.getDataControlerFromProcess(lawfulByPublicInterest);
+ _builder.append(_dataControlerFromProcess);
+ _builder.append("\"");
+ return _builder;
+ }
+
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.f
+ */
+ public CharSequence getDescriptionForLawfulByLegitimateInterest(final LawfulByLegitimateInterest lawfulByLegitimateInterest) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("Processing :\"");
+ String _name = lawfulByLegitimateInterest.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" shall be lawful if processing is necessary for the purposes of the legitimate interests :\"");
+ String _name_1 = lawfulByLegitimateInterest.getLegitimateInterest().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" pursued by the controller :\"");
+ String _dataControlerFromProcess = this.getDataControlerFromProcess(lawfulByLegitimateInterest);
+ _builder.append(_dataControlerFromProcess);
+ _builder.append("\"or by a third party, except where such interests are overridden by the interests or fundamental rights and freedoms of the data subject which require protection of personal data, in particular where the data subject is a child.");
+ _builder.newLineIfNotEmpty();
+ return _builder;
+ }
+
+ /**
+ * get Description for lawfullByConsent requirements from article6.1.f
+ */
+ public CharSequence getDescriptionForLawfulBySafeGuard(final LawfullBySafeGuard lawfullBySafeGuard) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("Where the processing :\"");
+ String _name = lawfullBySafeGuard.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" for a purpose :\"");
+ String _name_1 = lawfullBySafeGuard.getProcess().getContributedTo().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" other than that for which the personal data :\"");
+ String _personalDataFromProcess = this.getPersonalDataFromProcess(lawfullBySafeGuard);
+ _builder.append(_personalDataFromProcess);
+ _builder.append("\" have been collected is not based on the data subject’s consent or");
+ _builder.newLineIfNotEmpty();
+ _builder.append("on a Union or Member State law which constitutes a necessary and proportionate measure in a democratic society to safeguard the objectives referred to in Article 23(1), the controller :\"");
+ String _dataControlerFromProcess = this.getDataControlerFromProcess(lawfullBySafeGuard);
+ _builder.append(_dataControlerFromProcess);
+ _builder.append("\" shall,");
+ _builder.newLineIfNotEmpty();
+ _builder.append("in order to ascertain whether processing for another purpose is compatible with the purpose for which the personal data are initially collected, take into account, inter alia:");
+ _builder.newLine();
+ _builder.append("any link between the purposes ");
+ String _name_2 = lawfullBySafeGuard.getProcess().getContributedTo().getBase_NamedElement().getName();
+ _builder.append(_name_2);
+ _builder.append("\"for which the personal data :\"");
+ String _personalDataFromProcess_1 = this.getPersonalDataFromProcess(lawfullBySafeGuard);
+ _builder.append(_personalDataFromProcess_1);
+ _builder.append("\"have been collected and the purposes of the intended further processing;");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t \t");
+ _builder.append("- the context in which the personal data: \"");
+ String _personalDataFromProcess_2 = this.getPersonalDataFromProcess(lawfullBySafeGuard);
+ _builder.append(_personalDataFromProcess_2, "\t \t");
+ _builder.append("\" have been collected, in particular regarding the relationship between data subjects :\"");
+ String _name_3 = lawfullBySafeGuard.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_3, "\t \t");
+ _builder.append("\" and the controller:");
+ String _dataControlerFromProcess_1 = this.getDataControlerFromProcess(lawfullBySafeGuard);
+ _builder.append(_dataControlerFromProcess_1, "\t \t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t \t");
+ _builder.append("- the nature of the personal data: \"");
+ String _personalDataFromProcess_3 = this.getPersonalDataFromProcess(lawfullBySafeGuard);
+ _builder.append(_personalDataFromProcess_3, "\t \t");
+ _builder.append("\"\" , in particular whether special categories of personal data are processed, pursuant to Article 9, or whether personal data related to criminal convictions and offences are processed, pursuant to Article 10;");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t \t");
+ _builder.append("- the possible consequences of the intended further processing for data subjects:\"");
+ String _name_4 = lawfullBySafeGuard.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_4, "\t \t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t \t");
+ _builder.append("- the existence of appropriate safeguards, which may include encryption or pseudonymisation.");
+ return _builder;
+ }
+
public String getPersonalDataFromProcess(final ProcessPrinciple ProcessPrinciple) {
String result = "";
EList<PersonalDataRequirement> _personalData = ProcessPrinciple.getPersonalData();
@@ -229,4 +359,22 @@ public class GDPRRequirements {
}
return result;
}
+
+ public String getDataControlerFromProcess(final ProcessPrinciple ProcessPrinciple) {
+ String result = "";
+ EList<PersonalDataRequirement> _personalData = ProcessPrinciple.getPersonalData();
+ for (final PersonalDataRequirement data : _personalData) {
+ String _name = data.getResponsible().getBase_NamedElement().getName();
+ String _plus = ("" + _name);
+ int _indexOf = result.indexOf(_plus);
+ boolean _equals = (_indexOf == (-1));
+ if (_equals) {
+ String _name_1 = data.getResponsible().getBase_NamedElement().getName();
+ String _plus_1 = (result + _name_1);
+ String _plus_2 = (_plus_1 + " ");
+ result = _plus_2;
+ }
+ }
+ return result;
+ }
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/src/org/eclipse/papyrus/pdp4eng/req/ui/GenerateGDPRRequirementHandler.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/src/org/eclipse/papyrus/pdp4eng/req/ui/GenerateGDPRRequirementHandler.java
index 1d1bcca..3798d9a 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/src/org/eclipse/papyrus/pdp4eng/req/ui/GenerateGDPRRequirementHandler.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/src/org/eclipse/papyrus/pdp4eng/req/ui/GenerateGDPRRequirementHandler.java
@@ -44,6 +44,11 @@ public class GenerateGDPRRequirementHandler extends PapyrusAbstractHandler {
transactionalEditingDomain.getCommandStack().execute(generator.generateArticle51f(transactionalEditingDomain, (Package)selectedElement));
transactionalEditingDomain.getCommandStack().execute(generator.generateArticle61a(transactionalEditingDomain, (Package)selectedElement));
transactionalEditingDomain.getCommandStack().execute(generator.generateArticle61b(transactionalEditingDomain, (Package)selectedElement));
+ transactionalEditingDomain.getCommandStack().execute(generator.generateArticle61c(transactionalEditingDomain, (Package)selectedElement));
+ transactionalEditingDomain.getCommandStack().execute(generator.generateArticle61d(transactionalEditingDomain, (Package)selectedElement));
+ transactionalEditingDomain.getCommandStack().execute(generator.generateArticle61e(transactionalEditingDomain, (Package)selectedElement));
+ transactionalEditingDomain.getCommandStack().execute(generator.generateArticle61f(transactionalEditingDomain, (Package)selectedElement));
+ transactionalEditingDomain.getCommandStack().execute(generator.generateArticle64(transactionalEditingDomain, (Package)selectedElement));
}
return null;

Back to the top