blob: fd89a5ab1b3d493aae0b758871d13ac61aa1eca1 [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;
/**
* Copyright (c) 2019 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are the property of the CEA.
* Any use is subject to specific agreement with the CEA.
* Contributors:
*
* Patrick Tessier (CEA LIST) - Initial API and implementation
*
*/
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.sysml14.requirements.Requirement;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData;
import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.PersonalDataRequirement;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.ProcessRequirement;
public class SecuritySafetyRequirementCreateCommand extends BasicRequirementCreateCommand {
private ProcessRequirement processRequirement;
private DataSubject dataSubject;
public SecuritySafetyRequirementCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,ProcessRequirement processRequirement, DataSubject dataSubject) {
super(domain, owner, id, text);
this.processRequirement= processRequirement;
this.dataSubject= dataSubject;
}
@Override
protected void createRequirement(Package owner, String id, String text) {
super.createRequirement(owner, id, text);
if( requirement!=null) {
StereotypeApplicationHelper stereotypeApplicationHelper = StereotypeApplicationHelper.getInstance(null);
stereotypeApplicationHelper.applyStereotype(requirement,pdp4engReqGDPRPackage.eINSTANCE.getSecuritySafety(),null );
org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.SecuritySafety securitySafety= (org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.SecuritySafety)UMLUtil.getStereotypeApplication(requirement, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.SecuritySafety.class);
securitySafety.setProcess(processRequirement);
for (PersonalData personalData : processRequirement.getPersonaldata()) {
securitySafety.getPersonalData().add((PersonalDataRequirement) personalData);
}
securitySafety.setDataSubject(this.dataSubject);
GDPRRequirements gdprRrequiement= new GDPRRequirements();
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForSecuritySafety(securitySafety));
}
}
}