Search in sources :

Example 1 with SoftwareInducedFailureType

use of org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetFailureType method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    InternalFailureOccurrenceDescription element = (InternalFailureOccurrenceDescription) parameters.get("instance");
    EObjectQuery query = new EObjectQuery(element);
    Collection<Resource> resources = query.getSession().getSemanticResources();
    boolean found = false;
    Resource resource = null;
    for (Resource r : resources) {
        if (r.getURI().equals(URI.createURI("pathmap://PCM_MODELS/FailureTypes.repository"))) {
            found = true;
            resource = r;
            break;
        }
    }
    if (found) {
        Repository rep = (Repository) resource.getContents().iterator().next();
        for (EObject o : rep.eContents()) {
            FailureType failureType = (FailureType) o;
            if (failureType.getEntityName().equals("SoftwareInducedFailure")) {
                element.setSoftwareInducedFailureType__InternalFailureOccurrenceDescription(((SoftwareInducedFailureType) failureType));
                break;
            }
        }
    }
}
Also used : EObjectQuery(org.eclipse.sirius.business.api.query.EObjectQuery) Repository(org.palladiosimulator.pcm.repository.Repository) SoftwareInducedFailureType(org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType) FailureType(org.palladiosimulator.pcm.reliability.FailureType) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) InternalFailureOccurrenceDescription(org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription) SoftwareInducedFailureType(org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 EObjectQuery (org.eclipse.sirius.business.api.query.EObjectQuery)1 FailureType (org.palladiosimulator.pcm.reliability.FailureType)1 InternalFailureOccurrenceDescription (org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription)1 SoftwareInducedFailureType (org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType)1 Repository (org.palladiosimulator.pcm.repository.Repository)1