Search in sources :

Example 1 with CyberReqImpl

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;
}
Also used : ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) DefaultAnnexSubclauseImpl(org.osate.aadl2.impl.DefaultAnnexSubclauseImpl) Statement(com.ge.research.osate.verdict.dsl.verdict.Statement) CyberRelImpl(com.ge.research.osate.verdict.dsl.verdict.impl.CyberRelImpl) Resource(org.eclipse.emf.ecore.resource.Resource) CyberReqImpl(com.ge.research.osate.verdict.dsl.verdict.impl.CyberReqImpl) SystemTypeImpl(org.osate.aadl2.impl.SystemTypeImpl) VerdictContractSubclause(com.ge.research.osate.verdict.dsl.verdict.VerdictContractSubclause) EObject(org.eclipse.emf.ecore.EObject) CyberMissionImpl(com.ge.research.osate.verdict.dsl.verdict.impl.CyberMissionImpl) Verdict(com.ge.research.osate.verdict.dsl.verdict.Verdict)

Aggregations

Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)1 Verdict (com.ge.research.osate.verdict.dsl.verdict.Verdict)1 VerdictContractSubclause (com.ge.research.osate.verdict.dsl.verdict.VerdictContractSubclause)1 CyberMissionImpl (com.ge.research.osate.verdict.dsl.verdict.impl.CyberMissionImpl)1 CyberRelImpl (com.ge.research.osate.verdict.dsl.verdict.impl.CyberRelImpl)1 CyberReqImpl (com.ge.research.osate.verdict.dsl.verdict.impl.CyberReqImpl)1 EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)1 DefaultAnnexSubclauseImpl (org.osate.aadl2.impl.DefaultAnnexSubclauseImpl)1 SystemTypeImpl (org.osate.aadl2.impl.SystemTypeImpl)1