| /***************************************************************************** |
| * 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 |
| *****************************************************************************/ |
| 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.LegalObligation; |
| 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.LawfulByLegalObligation; |
| 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.c |
| * |
| */ |
| public class LawfulRequirementByLegalObligationCreateCommand extends AbstractLawfulRequirementByCreateCommand{ |
| |
| public LawfulRequirementByLegalObligationCreateCommand(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.getNeededForLegalObligation(); |
| } |
| |
| @Override |
| protected void setTextOnRequirement(GDPRRequirements gdprRrequiement,Requirement reqStereotype, EObject lawfulBy) { |
| if( lawfulBy instanceof LawfulByLegalObligation) { |
| LawfulByLegalObligation lawfulByLegalObligation = (LawfulByLegalObligation) lawfulBy; |
| reqStereotype.setText(""+gdprRrequiement.getDescriptionForLawfulByLegalObligation(lawfulByLegalObligation)); |
| } |
| } |
| |
| @Override |
| protected void associateLawfulObjectToAppliedStereotype(EObject lawfulBy, Object lawfulObject) { |
| if( lawfulBy instanceof LawfulByLegalObligation) { |
| LawfulByLegalObligation lawfulByLegalObligation = (LawfulByLegalObligation) lawfulBy; |
| lawfulByLegalObligation.setLegalObligation((LegalObligation)lawfulObject); |
| } |
| |
| } |
| |
| |
| |
| @Override |
| protected Lawful applyStereotype(StereotypeApplicationHelper stereotypeApplicationHelper, Class requirementClass) { |
| stereotypeApplicationHelper.applyStereotype(requirementClass, pdp4engReqGDPRPackage.eINSTANCE.getLawfulByLegalObligation(),null); |
| return UMLUtil.getStereotypeApplication(requirementClass, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.LawfulByLegalObligation.class); |
| } |
| |
| } |