use of com.ge.research.osate.verdict.dsl.verdict.impl.CyberReqImpl in project VERDICT by ge-high-assurance.
the class StatementEditor method reloadSystem.
private SystemTypeImpl reloadSystem(SystemTypeImpl sys) {
Resource oldResource = sys.eResource();
ResourceSetImpl resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry();
Resource resource = resourceSet.createResource(oldResource.getURI());
try {
resource.load(null);
} catch (Exception e) {
System.out.println("Error in reloading resource while saving content by Wizard.");
e.printStackTrace();
}
TreeIterator<EObject> tree = resource.getAllContents();
while (tree.hasNext()) {
EObject anObject = tree.next();
if (anObject instanceof SystemTypeImpl) {
if (((SystemTypeImpl) anObject).getFullName().equals(sys.getFullName())) {
sys = (SystemTypeImpl) anObject;
}
}
// extract the existing set of IDs that are already used------------------------------------------------------
if (anObject instanceof DefaultAnnexSubclauseImpl) {
if (!((DefaultAnnexSubclauseImpl) anObject).getName().equals("verdict")) {
continue;
}
Verdict vd = ((VerdictContractSubclause) ((DefaultAnnexSubclauseImpl) anObject).getParsedAnnexSubclause()).getContract();
List<Statement> stmts = vd.getElements();
for (int i = 0; i < stmts.size(); i++) {
if (stmts.get(i) instanceof CyberMissionImpl) {
idSet.add(((CyberMissionImpl) stmts.get(i)).getId());
} else if (stmts.get(i) instanceof CyberRelImpl) {
idSet.add(((CyberRelImpl) stmts.get(i)).getId());
} else if (stmts.get(i) instanceof CyberReqImpl) {
idSet.add(((CyberReqImpl) stmts.get(i)).getId());
}
}
}
// ------------------------------------------------------------------------------------------------------------
}
return sys;
}
Aggregations