blob: 11af9f91c7433ce5da05097d686373448aa3261f [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.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);
}
}