Bug 569250 - [privacyDesigner] add traceability when GDPR requirements
are generated
Change-Id: I0c16bec1a15956aa5d2ab77c55f373dee6731a3d
Signed-off-by: ptessier <Patrick.Tessier@cea.fr>
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/META-INF/MANIFEST.MF b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/META-INF/MANIFEST.MF
index a14cd0e..e66ba32 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/META-INF/MANIFEST.MF
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/META-INF/MANIFEST.MF
@@ -12,7 +12,8 @@
org.eclipse.uml2.uml;bundle-version="[5.4.0,6.0.0)",
org.eclipse.papyrus.pdp4eng.req.profile;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.sysml14;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.papyrus.pdp4eng.req.metareq;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.papyrus.pdp4eng.req.metareq;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.requirements.sysml14.traceability.commands
Export-Package: org.eclipse.papyrus.pdp4eng.req.gdprananalysis.api
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AccuracyCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AccuracyCreateCommand.java
index 8187877..be3f568 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AccuracyCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/AccuracyCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -36,14 +37,15 @@
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.ProcessRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
-public class AccuracyCreateCommand extends BasicRequirementCreateCommand {
+public class AccuracyCreateCommand extends BasicGDPRRequirementCreateCommand {
private PersonalData personalData;
private Purpose purpose;
- public AccuracyCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,PersonalData personalData,Purpose purpose) {
- super(domain, owner, id, text);
+ public AccuracyCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text, ProcessRequirement processRequirement, PersonalData personalData,Purpose purpose) {
+ super(domain, owner, id, text,processRequirement);
this.personalData= personalData;
this.purpose= purpose;
}
@@ -60,6 +62,9 @@
GDPRRequirements gdprRrequiement= new GDPRRequirements();
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForAccurate(accuracy));
+
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/BasicRequirementCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/BasicGDPRRequirementCreateCommand.java
similarity index 83%
rename from plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/BasicRequirementCreateCommand.java
rename to plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/BasicGDPRRequirementCreateCommand.java
index ce68bee..6c1d707 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/BasicRequirementCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/BasicGDPRRequirementCreateCommand.java
@@ -17,6 +17,7 @@
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
import org.eclipse.papyrus.requirements.sysml14.common.I_SysMLStereotype;
import org.eclipse.papyrus.requirements.sysml14.common.Utils;
import org.eclipse.uml2.uml.Element;
@@ -27,11 +28,13 @@
* Creates a new based on the options chosen in the Papyrus Req preferences page.
*
*/
-public class BasicRequirementCreateCommand extends RecordingCommand {
+public class BasicGDPRRequirementCreateCommand extends RecordingCommand {
protected Element owner;
private String id;
private String text;
protected org.eclipse.uml2.uml.Class requirement;
+ protected ProcessRequirement processRequirement;
+ protected TransactionalEditingDomain domain;
/**
*
@@ -42,11 +45,13 @@
* @param id can be null, in this case it is generated
* @param text can be null
*/
- public BasicRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id,String text) {
+ public BasicGDPRRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id,String text, ProcessRequirement processRequirement) {
super(domain, "PapyrusReqSysMLRequirementCreateCommand");
this.owner = owner;
this.id = id;
this.text = text;
+ this.processRequirement= processRequirement;
+ this.domain= domain;
}
protected void createRequirement(org.eclipse.uml2.uml.Package owner, String id,String text) {
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/DataMinimizationCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/DataMinimizationCreateCommand.java
index 60baf98..d16d84a 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/DataMinimizationCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/DataMinimizationCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -36,14 +37,15 @@
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.ProcessRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
-public class DataMinimizationCreateCommand extends BasicRequirementCreateCommand {
+public class DataMinimizationCreateCommand extends BasicGDPRRequirementCreateCommand {
private PersonalData personalData;
private Purpose purpose;
- public DataMinimizationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,PersonalData personalData,Purpose purpose) {
- super(domain, owner, id, text);
+ public DataMinimizationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement,PersonalData personalData,Purpose purpose) {
+ super(domain, owner, id, text,processRequirement);
this.personalData= personalData;
this.purpose= purpose;
}
@@ -60,6 +62,9 @@
GDPRRequirements gdprRrequiement= new GDPRRequirements();
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForDataMinimisation(dataMinimization));
+
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/FairlyRequirementCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/FairlyRequirementCreateCommand.java
index 6e268a0..0f6ffee 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/FairlyRequirementCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/FairlyRequirementCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -40,13 +41,11 @@
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
-public class FairlyRequirementCreateCommand extends BasicRequirementCreateCommand {
+public class FairlyRequirementCreateCommand extends BasicGDPRRequirementCreateCommand {
- private ProcessRequirement processRequirement;
private DataSubject dataSubject;
public FairlyRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
- super(domain, owner, id, text);
- this.processRequirement= processRequirement;
+ super(domain, owner, id, text,processRequirement);
this.dataSubject= dataSubject;
}
@@ -66,7 +65,8 @@
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForFairlyRequirement(fairlyReq));
-
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementCreateCommand.java
index c0f7e7b..46b0aec 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/LawfulRequirementCreateCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
-* Copyright (c)2020 CEA LIST, Committer Name, and others.
+* 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
@@ -17,6 +17,7 @@
import java.util.Iterator;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -46,13 +47,11 @@
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
-public class LawfulRequirementCreateCommand extends BasicRequirementCreateCommand {
+public class LawfulRequirementCreateCommand extends BasicGDPRRequirementCreateCommand {
- private ProcessRequirement processRequirement;
private DataSubject dataSubject;
public LawfulRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
- super(domain, owner, id, text);
- this.processRequirement= processRequirement;
+ super(domain, owner, id, text,processRequirement);
this.dataSubject= dataSubject;
}
@@ -72,6 +71,9 @@
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForLawfulRequirement(lawfulReq));
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
+
for (Iterator<Consent> iterator = dataSubject.getGivenConsent().iterator(); iterator.hasNext();) {
Consent aConsent = (Consent) iterator.next();
for (Iterator<Purpose> purposeIterator = aConsent.getPurpose().iterator(); purposeIterator.hasNext();) {
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PDP4EngTraceabilityFactory.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PDP4EngTraceabilityFactory.java
new file mode 100644
index 0000000..970ab6c
--- /dev/null
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PDP4EngTraceabilityFactory.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+* 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 java.util.ArrayList;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.IdentityCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.pdp4eng.req.profile.constraints.TraceabilityIndexer;
+import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
+import org.eclipse.papyrus.requirements.sysml14.traceability.commands.DerivationReqCreateCommand;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.DirectedRelationship;
+import org.eclipse.uml2.uml.NamedElement;
+
+public class PDP4EngTraceabilityFactory {
+ public static Command addTraceabilityToLFR(TransactionalEditingDomain domain, ProcessRequirement processRequirement, Requirement createdRequirement ) {
+ ArrayList<DirectedRelationship> upwardLinks=TraceabilityIndexer.getInstance().getUpwardTraceabiltiy(processRequirement.getBase_NamedElement());
+ if( upwardLinks==null||upwardLinks.size()==0) {
+ return IdentityCommand.INSTANCE;
+ }
+
+ return new DerivationReqCreateCommand(domain,createdRequirement.getBase_Class() ,(NamedElement)upwardLinks.get(0).getTargets().get(0));
+ }
+
+}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PurposeLimitationCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PurposeLimitationCreateCommand.java
index 5d18511..17f4766 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PurposeLimitationCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/PurposeLimitationCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -36,14 +37,15 @@
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.ProcessRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
-public class PurposeLimitationCreateCommand extends BasicRequirementCreateCommand {
+public class PurposeLimitationCreateCommand extends BasicGDPRRequirementCreateCommand {
private PersonalData personalData;
private Purpose purpose;
- public PurposeLimitationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,PersonalData personalData,Purpose purpose) {
- super(domain, owner, id, text);
+ public PurposeLimitationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement,PersonalData personalData,Purpose purpose) {
+ super(domain, owner, id, text, processRequirement);
this.personalData= personalData;
this.purpose= purpose;
}
@@ -60,6 +62,9 @@
GDPRRequirements gdprRrequiement= new GDPRRequirements();
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForPurposeLimitation(purposeLimitation));
+
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
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 01f7cff..0d805ad 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
@@ -118,7 +118,7 @@
Purpose purpose=processElement.getContributedTo();
index++;
String id = prefix+index;
- Command cmd=new PurposeLimitationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",personalData, purpose);
+ Command cmd=new PurposeLimitationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",(ProcessRequirement)processElement,personalData, purpose);
compoundCommand.append(cmd);
}
}
@@ -144,7 +144,7 @@
Purpose purpose=processElement.getContributedTo();
index++;
String id = prefix+index;
- Command cmd=new AccuracyCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",personalData, purpose);
+ Command cmd=new AccuracyCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",(ProcessRequirement)processElement,personalData, purpose);
compoundCommand.append(cmd);
}
}
@@ -170,7 +170,7 @@
Purpose purpose=processElement.getContributedTo();
index++;
String id = prefix+index;
- Command cmd=new StorageLimitationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",personalData, purpose);
+ Command cmd=new StorageLimitationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",(ProcessRequirement)processElement,personalData, purpose);
compoundCommand.append(cmd);
}
}
@@ -230,7 +230,7 @@
Purpose purpose=processElement.getContributedTo();
index++;
String id = prefix+index;
- Command cmd=new DataMinimizationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",personalData, purpose);
+ Command cmd=new DataMinimizationCreateCommand(domain, lookForGeneratedrequirementPackage(owner), id, "",(ProcessRequirement)processElement,personalData, purpose);
compoundCommand.append(cmd);
}
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/SecuritySafetyRequirementCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/SecuritySafetyRequirementCreateCommand.java
index fd89a5a..d41e634 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/SecuritySafetyRequirementCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/SecuritySafetyRequirementCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -40,13 +41,11 @@
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
-public class SecuritySafetyRequirementCreateCommand extends BasicRequirementCreateCommand {
+public class SecuritySafetyRequirementCreateCommand extends BasicGDPRRequirementCreateCommand {
- private ProcessRequirement processRequirement;
private DataSubject dataSubject;
public SecuritySafetyRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
- super(domain, owner, id, text);
- this.processRequirement= processRequirement;
+ super(domain, owner, id, text,processRequirement);
this.dataSubject= dataSubject;
}
@@ -66,6 +65,8 @@
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForSecuritySafety(securitySafety));
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/StorageLimitationCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/StorageLimitationCreateCommand.java
index ae21f51..8dd3634 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/StorageLimitationCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/StorageLimitationCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -36,14 +37,15 @@
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.ProcessRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
-public class StorageLimitationCreateCommand extends BasicRequirementCreateCommand {
+public class StorageLimitationCreateCommand extends BasicGDPRRequirementCreateCommand {
private PersonalData personalData;
private Purpose purpose;
- public StorageLimitationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,PersonalData personalData,Purpose purpose) {
- super(domain, owner, id, text);
+ public StorageLimitationCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, PersonalData personalData,Purpose purpose) {
+ super(domain, owner, id, text, processRequirement);
this.personalData= personalData;
this.purpose= purpose;
}
@@ -60,6 +62,9 @@
GDPRRequirements gdprRrequiement= new GDPRRequirements();
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForStorageLimitation(storageLimitation));
+
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/TransparentRequirementCreateCommand.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/TransparentRequirementCreateCommand.java
index 630835a..842b3dc 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/TransparentRequirementCreateCommand.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.gdprananalysis/src/org/eclipse/pdp4eng/req/gdprananalysis/internal/TransparentRequirementCreateCommand.java
@@ -15,6 +15,7 @@
*****************************************************************************/
package org.eclipse.pdp4eng.req.gdprananalysis.internal;
+import org.eclipse.emf.common.command.Command;
/**
* Copyright (c) 2019 CEA LIST.
*
@@ -40,13 +41,11 @@
import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
-public class TransparentRequirementCreateCommand extends BasicRequirementCreateCommand {
+public class TransparentRequirementCreateCommand extends BasicGDPRRequirementCreateCommand {
- private ProcessRequirement processRequirement;
private DataSubject dataSubject;
public TransparentRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
- super(domain, owner, id, text);
- this.processRequirement= processRequirement;
+ super(domain, owner, id, text, processRequirement);
this.dataSubject= dataSubject;
}
@@ -66,7 +65,8 @@
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForTransparentRequirement(transparency));
-
+ Command traceCommand=PDP4EngTraceabilityFactory.addTraceabilityToLFR(domain, processRequirement, reqStereotypeAppli);
+ traceCommand.execute();
}
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 f4ec838..407d548 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
@@ -36,13 +36,39 @@
*/
public CharSequence getDescriptionForLawfulRequirement(final Lawful lawful) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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.");
+ _builder.append("IF process \"");
+ String _name = lawful.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" processes \"");
+ String _personalDataFromProcess = this.getPersonalDataFromProcess(lawful);
+ _builder.append(_personalDataFromProcess);
+ _builder.append("\" of \"");
+ String _name_1 = lawful.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" THEN the Process \"");
+ String _name_2 = lawful.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name_2);
+ _builder.append("\" shall be lawfull.");
return _builder;
}
public CharSequence getDescriptionForLawfulByConsent(final LawfulByConsent lawfulByConsent) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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�");
+ _builder.append("Processing \"");
+ String _name = lawfulByConsent.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _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 \"");
+ 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 ");
+ String _name_3 = lawfulByConsent.getProcess().getContributedTo().getBase_NamedElement().getName();
+ _builder.append(_name_3);
return _builder;
}
@@ -51,7 +77,19 @@
*/
public CharSequence getDescriptionForFairlyRequirement(final Fairly fairly) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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.");
+ _builder.append("IF process \"");
+ String _name = fairly.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" processes \"");
+ String _personalDataFromProcess = this.getPersonalDataFromProcess(fairly);
+ _builder.append(_personalDataFromProcess);
+ _builder.append("\" of \"");
+ String _name_1 = fairly.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" THEN the Process \"");
+ String _name_2 = fairly.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name_2);
+ _builder.append("\" shall be fairly.");
return _builder;
}
@@ -60,7 +98,19 @@
*/
public CharSequence getDescriptionForTransparentRequirement(final Transparency transparency) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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.");
+ _builder.append("IF process \"");
+ String _name = transparency.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _builder.append("\" processes \"");
+ String _personalDataFromProcess = this.getPersonalDataFromProcess(transparency);
+ _builder.append(_personalDataFromProcess);
+ _builder.append("\" of \"");
+ String _name_1 = transparency.getDataSubject().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" THEN the Process \"");
+ String _name_2 = transparency.getProcess().getBase_NamedElement().getName();
+ _builder.append(_name_2);
+ _builder.append("\" shall be transparent.");
return _builder;
}
@@ -69,7 +119,13 @@
*/
public CharSequence getDescriptionForPurposeLimitation(final PurposeLimitation purposeLimitation) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("The purpose \"�purposeLimitation.purpose.base_NamedElement.name�\" of the PersonalData \"�purposeLimitation.personalData.base_NamedElement.name�\" shall be specified, explicit, legimate, and compatible.");
+ _builder.append("The purpose \"");
+ String _name = purposeLimitation.getPurpose().getBase_NamedElement().getName();
+ _builder.append(_name);
+ _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.");
return _builder;
}
@@ -78,7 +134,13 @@
*/
public CharSequence getDescriptionForDataMinimisation(final DataMinimisation dataMinimisation) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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");
+ _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 \"");
+ String _name_1 = dataMinimisation.getPurpose().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _builder.append("\" for which they are processed");
return _builder;
}
@@ -87,7 +149,16 @@
*/
public CharSequence getDescriptionForAccurate(final Accuracy accuracy) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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.");
+ _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 \"");
+ String _name_1 = accuracy.getPersonalData().getBase_NamedElement().getName();
+ _builder.append(_name_1);
+ _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.");
return _builder;
}
@@ -96,7 +167,16 @@
*/
public CharSequence getDescriptionForStorageLimitation(final StorageLimitation storageLimitation) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("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");
+ _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 \"");
+ 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 \"");
+ String _name_2 = storageLimitation.getPurpose().getBase_NamedElement().getName();
+ _builder.append(_name_2);
+ _builder.append("\" for which the personal data are processed");
return _builder;
}
@@ -105,7 +185,10 @@
*/
public CharSequence getDescriptionForSecuritySafety(final SecuritySafety securitySafety) {
StringConcatenation _builder = new StringConcatenation();
- _builder.append("Personal Data �getPersonalDataFromProcess(securitySafety)� shall be processed in a manner that ensures appropriate security. ");
+ _builder.append("Personal Data ");
+ String _personalDataFromProcess = this.getPersonalDataFromProcess(securitySafety);
+ _builder.append(_personalDataFromProcess);
+ _builder.append(" shall be processed in a manner that ensures appropriate security. ");
return _builder;
}
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/META-INF/MANIFEST.MF b/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/META-INF/MANIFEST.MF
index 7edb0e5..18e6e79 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/META-INF/MANIFEST.MF
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/META-INF/MANIFEST.MF
@@ -16,6 +16,7 @@
org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)",
org.eclipse.papyrus.sysml14;bundle-version="[1.3.0,2.0.0)"
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR,
+Export-Package: org.eclipse.papyrus.pdp4eng.req.profile.constraints,
+ org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR,
org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.impl,
org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.util
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/src/org/eclipse/papyrus/pdp4eng/req/profile/constraints/TraceabilityIndexer.java b/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/src/org/eclipse/papyrus/pdp4eng/req/profile/constraints/TraceabilityIndexer.java
index b4a713b..c1dede8 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/src/org/eclipse/papyrus/pdp4eng/req/profile/constraints/TraceabilityIndexer.java
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.profile/src/org/eclipse/papyrus/pdp4eng/req/profile/constraints/TraceabilityIndexer.java
@@ -41,6 +41,8 @@
public void loadTraceability(Element context) {
+ upwardTraceability.clear();
+ downwardTraceability.clear();
ResourceSet resourceSet=context.eResource().getResourceSet();
for(int i=0; i< resourceSet.getResources().size();i++) {
Resource resource = (Resource) resourceSet.getResources().get(i);
diff --git a/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/META-INF/MANIFEST.MF b/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/META-INF/MANIFEST.MF
index cced042..8e8f087 100644
--- a/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/META-INF/MANIFEST.MF
+++ b/plugins/req/org.eclipse.papyrus.pdp4eng.req.ui/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@
org.eclipse.emf.transaction;bundle-version="[1.9.1,2.0.0)",
org.eclipse.papyrus.pdp4eng.req.gdprananalysis;bundle-version="[1.0.0,2.0.0)",
org.eclipse.ui.workbench;bundle-version="[3.119.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.4.0,3.0.0)"
+ org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.4.0,3.0.0)",
+ org.eclipse.papyrus.pdp4eng.req.profile
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.pdp4eng.req.ui
Bundle-Activator: org.eclipse.papyrus.pdp4eng.req.ui.Activator
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 ac350fb..68d6d2f 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
@@ -20,6 +20,7 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.papyrus.pdp4eng.req.gdprananalysis.api.IRequirementGenerator;
import org.eclipse.papyrus.pdp4eng.req.gdprananalysis.api.RequirementGenerator;
+import org.eclipse.papyrus.pdp4eng.req.profile.constraints.TraceabilityIndexer;
import org.eclipse.papyrus.requirements.sysml14.common.PapyrusAbstractHandler;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
@@ -34,6 +35,7 @@
Element selectedElement = getSelection();
if (selectedElement != null) {
IRequirementGenerator generator= new RequirementGenerator();
+ TraceabilityIndexer.getInstance().loadTraceability((Package)selectedElement);
transactionalEditingDomain.getCommandStack().execute(generator.generateArticle51a(transactionalEditingDomain, (Package)selectedElement));
transactionalEditingDomain.getCommandStack().execute(generator.generateArticle51b(transactionalEditingDomain, (Package)selectedElement));
transactionalEditingDomain.getCommandStack().execute(generator.generateArticle51c(transactionalEditingDomain, (Package)selectedElement));