Package org.emftrace.metamodel.ReportModel

Examples of org.emftrace.metamodel.ReportModel.ReportContainer


   
    public void updateReportContainer(Project project)
    {
        if( project == null ) return;
       
        ReportContainer container = null;       
        List<EObject>   helper    = accessLayer.getElements(project, "ReportContainer");
        if( helper.isEmpty() )         
        {
            container = ReportModelFactory.eINSTANCE.createReportContainer();
            accessLayer.addElement(project, container);
        }
        else
        {
            // merge containers:
            container = (ReportContainer)helper.get(0);
            for(int i = 0; i < helper.size(); i++)
            {        
                if( i == 0 ) continue;

                container.getReports().addAll(((ReportContainer)helper.get(i)).getReports());
                ((ReportContainer)helper.get(i)).getReports().clear();
               
                accessLayer.removeElement(project, helper.get(i));
                helper.remove(i);
                i--;
            }
        }
       
        // move all reports into the container:
        List<EObject> reports = accessLayer.getElements(project, "ImpactReport");
        reports.addAll(accessLayer.getElements(project, "ConsistenceReport"));
       
        int violations = 0;
        int badSmells  = 0;
        int impacts    = 0;
       
        if( container.getReports().size() != reports.size() )
            for(int i = 0; i < reports.size(); i++)
                if( !container.getReports().contains(reports.get(i)))
                    container.getReports().add((Report)reports.get(i));   
       
        for(int i = 0; i < container.getReports().size(); i++)
        {
            if( container.getReports().get(i).getType() == org.emftrace.metamodel.ReportModel.ReportType.VIOLATION ) violations++;
            if( container.getReports().get(i).getType() == org.emftrace.metamodel.ReportModel.ReportType.BAD_SMELL ) badSmells++;
            if( container.getReports().get(i).getType() == org.emftrace.metamodel.ReportModel.ReportType.IMPACT ) impacts++;
        }
       
        String impactText = " impact";
        if( impacts > 1 ) impactText += "s";
       
        String violationText = " violation";
        if( violations > 1 ) violationText += "s";
       
        String badsmellText = " bad smell";
        if( badSmells > 1 ) badsmellText += "s";
       
        container.setName("[" + impacts + impactText + ", " + violations + violationText + ", " + badSmells + badsmellText + "]");
       
        if( isLoggingEnabled ) printToLog("updateReportContainer", "10. report container has been updated");
    }
View Full Code Here


    {
        assertEquals(0, accessLayer.getElements(project, "ReportContainer").size());
        projectCleaner.updateReportContainer(project);
        assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
       
        ReportContainer c1 = ReportModelFactory.eINSTANCE.createReportContainer();
        ReportContainer c2 = ReportModelFactory.eINSTANCE.createReportContainer();
       
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
       
        ConsistenceReport r1 = ReportModelFactory.eINSTANCE.createConsistenceReport();
View Full Code Here

          addToClosedListAndPrepareNewSIS(project, startingImpactSet, openList, closedList);
        }
    }
   
    // finally store all impact reports in EMFStore:   
    ReportContainer container = null;   
        List<EObject>   helper    = accessLayer.getElements(project, "ReportContainer");
        if( helper.isEmpty() )         
        {
          container = ReportModelFactory.eINSTANCE.createReportContainer();
            accessLayer.addElement(project, container);
        }
        else container = (ReportContainer)helper.get(0);   
       
        int numberOfImpacts = 0;
       
        // create the individual reports:
        if( createIndividualReports )
        {
      for(int i = 0; i < closedList.size(); i++)
      {
        if( !reportManager.checkIfImpactReportAlreadyExists(project, closedList.get(i).getImpactSources(), closedList.get(i).getAffectedElements(), closedList.get(i).getChangeType()) )
        {
          accessLayer.addElement(project, closedList.get(i));
          container.getReports().add(closedList.get(i));
          numberOfImpacts++;
        }
      }
    }
       
View Full Code Here

    if( sources.isEmpty()        ) return null;
    if( affectedModels.isEmpty() ) return null;
   
    ImpactReport report = ReportModelFactory.eINSTANCE.createImpactReport();
   
    ReportContainer container = null;   
              
        if( saveToEMFStore )
        {
            List<EObject> helper    = accessLayer.getElements(project, "ReportContainer");
            if( helper.isEmpty() )         
            {
                container = ReportModelFactory.eINSTANCE.createReportContainer();
                accessLayer.addElement(project, container);
            }
            else container = (ReportContainer)helper.get(0);
           
          accessLayer.addElement(project, report);
          container.getReports().add(report);
        }
               
        report.getImpactSources().addAll(sources);
        report.getAffectedElements().addAll(affectedModels);
        report.setType(ReportType.IMPACT);
View Full Code Here

 
    if( project       == null ) return null;
    if( model         == null ) return null;
    if( violationType == null ) return null;
   
    ReportContainer container = null;       
        List<EObject> helper    = accessLayer.getElements(project, "ReportContainer");
        if( helper.isEmpty() )         
        {
            container = ReportModelFactory.eINSTANCE.createReportContainer();
            accessLayer.addElement(project, container);
        }
        else container = (ReportContainer)helper.get(0);
       
        ConsistenceReport report = ReportModelFactory.eINSTANCE.createConsistenceReport();    
              
        accessLayer.addElement(project, report);
       
        container.getReports().add(report);
       
        report.setElement(model);
        report.setTypeOfViolation(violationType);
        report.setType(ReportType.VIOLATION);
       
View Full Code Here

  public boolean checkIfImpactReportAlreadyExists(Project project, List<EObject> sources, List<EObject> affectedModels, AbstractChangeType changeType)
  {
        List<EObject> helper = accessLayer.getElements(project, "ReportContainer");
        if( helper.isEmpty() ) return false;
       
        ReportContainer container = (ReportContainer)helper.get(0);
       
        for(int i = 0; i < container.getReports().size(); i++)
        {
          Report report = container.getReports().get(i);
         
          if( !(report instanceof ImpactReport)     ) continue;
          if( report.getType() == null              ) continue;
          if( report.getType() != ReportType.IMPACT ) continue;
         
View Full Code Here

  public boolean checkIfConsistenceReportAlreadyExists(Project project, EObject model, ViolationType violationType)
  {
        List<EObject> helper = accessLayer.getElements(project, "ReportContainer");
        if( helper.isEmpty() ) return false;
       
        ReportContainer container = (ReportContainer)helper.get(0);
       
        for(int i = 0; i < container.getReports().size(); i++)
        {
          Report report = container.getReports().get(i);
         
          if( !(report instanceof ConsistenceReport) ) continue;
          if( report.getType() == null               ) continue;
          if( report.getType() == ReportType.IMPACT  ) continue;
         
View Full Code Here

    }
   
    @Test
    public void testCheckIfImpactReportAlreadyExists()
    {
      ReportContainer container = ReportModelFactory.eINSTANCE.createReportContainer();
      ImpactReport r = ReportModelFactory.eINSTANCE.createImpactReport();
      Actor a1 = URNModelFactory.eINSTANCE.createActor();
      Actor a2 = URNModelFactory.eINSTANCE.createActor();
      AtomicChangeType c = ChangeModelFactory.eINSTANCE.createAtomicChangeType();
      LinkType t = LinkModelFactory.eINSTANCE.createLinkType();
     
      List<EObject> l1 = new ArrayList<EObject>();
      List<EObject> l2 = new ArrayList<EObject>();
      l1.add(a1);
      l2.add(a2);
     
      t.setName("TestRelation");
      c.setType(AtomicType.ADD);
      r.getImpactSources().add(a1);
      r.getAffectedElements().add(a2);
      r.setChangeType(c);
      r.setType(ReportType.IMPACT);
      container.getReports().add(r);
     
      accessLayer.addElement(project, container);
     
      assertFalse(reportManager.checkIfImpactReportAlreadyExists(null, null, null, null));
      assertFalse(reportManager.checkIfImpactReportAlreadyExists(project, null, null, null));
View Full Code Here

    }
   
    @Test
    public void testCheckIfConsistenceReportAlreadyExists()
    {
      ReportContainer container = ReportModelFactory.eINSTANCE.createReportContainer();
      ConsistenceReport r = ReportModelFactory.eINSTANCE.createConsistenceReport();
      Actor a = URNModelFactory.eINSTANCE.createActor();
      ViolationType t = ReportModelFactory.eINSTANCE.createViolationType();
     
      t.setName("TestViolationType");
      r.setTypeOfViolation(t);
      r.setType(ReportType.VIOLATION);
      r.setElement(a);
     
      container.getReports().add(r);
      accessLayer.addElement(project, container);
          
      assertFalse(reportManager.checkIfConsistenceReportAlreadyExists(null, null, null));
      assertFalse(reportManager.checkIfConsistenceReportAlreadyExists(project, null, null));
      assertFalse(reportManager.checkIfConsistenceReportAlreadyExists(project, a, null));
View Full Code Here

    if( sources.isEmpty()        ) return null;
    if( affectedModels.isEmpty() ) return null;
   
    ImpactReport report = ReportModelFactory.eINSTANCE.createImpactReport();
   
    ReportContainer container = null;   
              
        if( saveToEMFStore )
        {
            List<EObject> helper    = accessLayer.getElements(project, "ReportContainer");
            if( helper.isEmpty() )         
            {
                container = ReportModelFactory.eINSTANCE.createReportContainer();
                accessLayer.addElement(project, container);
            }
            else container = (ReportContainer)helper.get(0);
           
          accessLayer.addElement(project, report);
          container.getReports().add(report);
        }
               
        report.getImpactSources().addAll(sources);
        report.getAffectedElements().addAll(affectedModels);
        report.setType(ReportType.IMPACT);
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.ReportModel.ReportContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.