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;
}
}
}
}
Aggregations