blob: 8187877c1691c2fd46aaaff828c5512d65c23fc6 [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.PersonalData;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Purpose;
import org.eclipse.papyrus.pdp4eng.req.metareq.GDPRRequirements;
import org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.pdp4engReqGDPRPackage;
public class AccuracyCreateCommand extends BasicRequirementCreateCommand {
private PersonalData personalData;
private Purpose purpose;
public AccuracyCreateCommand(TransactionalEditingDomain domain, Element owner, String id, String text,PersonalData personalData,Purpose purpose) {
super(domain, owner, id, text);
this.personalData= personalData;
this.purpose= purpose;
}
@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.getAccuracy(),null );
org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Accuracy accuracy=(org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Accuracy)UMLUtil.getStereotypeApplication(requirement, org.eclipse.papyrus.pdp4eng.req.profile.pdp4engReqGDPR.Accuracy.class);
accuracy.setPersonalData(personalData);
accuracy.setPurpose(purpose);
GDPRRequirements gdprRrequiement= new GDPRRequirements();
Requirement reqStereotypeAppli= (Requirement)UMLUtil.getStereotypeApplication(requirement, Requirement.class);
reqStereotypeAppli.setText(""+gdprRrequiement.getDescriptionForAccurate(accuracy));
}
}
}