blob: 20a4c7c974042a5e03ce3433c69d14c392cfc2cd [file] [log] [blame]
/**
* 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.papyrus.pdp4eng.req.metareq;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Accuracy;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.DataMinimisation;
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.xtend2.lib.StringConcatenation;
@SuppressWarnings("all")
public class GDPRRequirements {
/**
* get Description for lawfull requirements from rticle5.1
*/
public CharSequence getDescriptionForLawfulRequirement(final Lawful lawful) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for fairly requirements from article5.1
*/
public CharSequence getDescriptionForFairlyRequirement(final Fairly fairly) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for transparent requirements from article5.1
*/
public CharSequence getDescriptionForTransparentRequirement(final Transparency transparency) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for transparent requirements from article5.1.b
*/
public CharSequence getDescriptionForPurposeLimitation(final PurposeLimitation purposeLimitation) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for transparent requirements from article5.1.c
*/
public CharSequence getDescriptionForDataMinimisation(final DataMinimisation dataMinimisation) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for transparent requirements from article5.1.d
*/
public CharSequence getDescriptionForAccurate(final Accuracy accuracy) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for transparent requirements from article5.1.e
*/
public CharSequence getDescriptionForStorageLimitation(final StorageLimitation storageLimitation) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for transparent requirements from article5.1.e
*/
public CharSequence getDescriptionForSecuritySafety(final SecuritySafety securitySafety) {
StringConcatenation _builder = new StringConcatenation();
_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;
}
/**
* get Description for lawfullByConsent requirements from article6.1.a
*/
public CharSequence getDescriptionForLawfulByConsent(final LawfulByConsent lawfulByConsent) {
StringConcatenation _builder = new StringConcatenation();
_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);
_builder.append("\"");
return _builder;
}
/**
* get Description for lawfullByContract requirements from article6.1.b
*/
public CharSequence getDescriptionForLawfulByContract(final LawfulByContract lawfulByContract) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Processing :\"");
String _name = lawfulByContract.getProcess().getBase_NamedElement().getName();
_builder.append(_name);
_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:\"");
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();
for (final PersonalDataRequirement element : _personalData) {
String _name = element.getBase_NamedElement().getName();
String _plus = (result + _name);
String _plus_1 = (_plus + " ");
result = _plus_1;
}
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;
}
}