blob: f1857f53779900f01da908f46e7f0c830285f792 [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.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")
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);
return _builder;
}
/**
* get Description for lawfullByContract requirements from article6.1.b
*/
public CharSequence getDescriptionForLawfulByConsent(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:\"");
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();
_builder.append(_name_2);
_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;
}
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;
}
}