blob: 466e67a4f85744b979bb78a1a3f67d289abb61dc [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.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Fairly
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Lawful
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessPrinciple
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Transparency
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PurposeLimitation
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Accuracy
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.StorageLimitation
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.'''
}
/**
* get Description for fairly requirements from article5.1
*/
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.'''
}
/**
* 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.'''
}
/**
* 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.'''
}
/**
* get Description for transparent requirements from article5.1.c
*/
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'''
}
/**
* 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.'''
}
/**
* 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'''
}
/**
* 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. '''
}
/**
* 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»"'''
}
/**
* get Description for lawfullByContract requirements from article6.1.b
*/
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 = ""
for (element : ProcessPrinciple.personalData) {
result=result+ element.base_NamedElement.name+" ";
}
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
}
}