Package org.evolizer.core.hibernate.session.api

Examples of org.evolizer.core.hibernate.session.api.IEvolizerSession


        Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
       
        //Before I even open the wizard, I check that some history was already imported, otherwise I won't proceed.
        EvolizerSessionHandler handler = EvolizerSessionHandler.getHandler();
        try {
            IEvolizerSession persistenceProvider = handler.getCurrentSession(project);
            Long res = persistenceProvider.uniqueResult("select count (*) from Release", Long.class);
            if (res == null || res <= 0) {
                MessageDialog.openError(activeShell, "Missing File Content Importer Error", "No history was imported yet.\nFile content cannot be imported if no history was imported beforehand.");
                return null;
            }
        } catch (EvolizerException e) {
View Full Code Here


    @Override
    protected IStatus run(IProgressMonitor monitor) {
        try {
            EvolizerSessionHandler handler = EvolizerSessionHandler.getHandler();
            handler.updateSchema(fProject);
            IEvolizerSession persistenceProvider = handler.getCurrentSession(fProject);
            TransactionReconstructor.calculateCouplings(persistenceProvider, 1000 * fTMax, 1000 * fDistMax, monitor);
            persistenceProvider.close();
            sLogger.debug("Transaction reconstruction finished");
        } catch (EvolizerException e) {
            sLogger.error("Transaction reconstruction failed:", e);
        }
        return Status.OK_STATUS;
View Full Code Here

    @Override
    protected IStatus run(IProgressMonitor monitor) {
        try {
            EvolizerSessionHandler handler = EvolizerSessionHandler.getHandler();
            handler.updateSchema(fProject);
            IEvolizerSession persistenceProvider = handler.getCurrentSession(fProject);

            EvolizerCVSImporter.importMissingFileContent(
                    fProject,
                    persistenceProvider,
                    fFileExtensionRegEx,
                    monitor,
                    fReImport);
            persistenceProvider.close();
            sLogger.debug("Import of missing file content completed");
        } catch (EvolizerException e) {
            sLogger.error("Import of missing file content failed:", e);
        }
        return Status.OK_STATUS;
View Full Code Here

    @Override
    protected IStatus run(IProgressMonitor monitor) {
        try {
            EvolizerSessionHandler handler = EvolizerSessionHandler.getHandler();
            handler.updateSchema(fProject);
            IEvolizerSession persistenceProvider = handler.getCurrentSession(fProject);

            EvolizerCVSImporter.importProject(
                    fProject,
                    persistenceProvider,
                    fFileExtensionRegEx,
                    monitor,
                    fFileContentImportEnabled);

            EvolizerNatureManager.applyEvolizerNature(fProject, monitor);

            persistenceProvider.close();

            LOGGER.info("Versioning Information has been imported for project '" + fProject.getName() + "'");
        } catch (EvolizerException e) {
            LOGGER.error("Error while performing import from versioning system", e);
        }
View Full Code Here

                    if (!this.releaseNamesFetched) {
                        this.releaseNamesFetched = true;
                        try {
                            EvolizerSessionHandler handler = EvolizerSessionHandler.getHandler();
                            handler.updateSchema(this.project);
                            IEvolizerSession persistenceProvider = handler.getCurrentSession(this.project);
                            for (String r : persistenceProvider.query("select name from Release", String.class)) {
                                this.releasesScrollList.add(r + " ");
                            }

                        } catch (EvolizerException e) {
                            this.releasesScrollList.removeAll();
View Full Code Here

     */
    public List<FamixModel> queryStoredModels(String modelName) {
        List<FamixModel> storedModels = new ArrayList<FamixModel>();
       
        try {
            IEvolizerSession lSession = EvolizerSessionHandler.getHandler().getCurrentSession(fDBUrl);
            storedModels = lSession.query("from FamixModel as fm " +
                    "where fm.name = '" + modelName + "'" +
                    "order by fm.created desc", FamixModel.class);
        } catch (EvolizerRuntimeException ere) {
            sLogger.error("Error while querying Famix-FamixModels" + ere.getMessage(), ere);
        } catch (EvolizerException ee) {
View Full Code Here

    public boolean deleteModel() {
        sLogger.debug("Deleting Famix-FamixModel " + fModel.getName() + " from database");
       
        boolean wasSuccessful = false;
       
        IEvolizerSession lSession = null;
        try {
            lSession = EvolizerSessionHandler.getHandler().getCurrentSession(fDBUrl);
            lSession.startTransaction();
           
            lSession.delete(fModel);
            wasSuccessful = true;
        } catch (EvolizerRuntimeException e) {
            e.printStackTrace();
            if (lSession != null) {
                lSession.rollbackTransaction();
            }
        } catch (EvolizerException e) {
      throw new EvolizerRuntimeException("Error fetching current session", e);
    } finally {
            if (lSession != null) {
                lSession.endTransaction();
            }
        }
        sLogger.debug("Deleting Famix-FamixModel " + fModel.getName() + " from database completed");
       
        return wasSuccessful;
View Full Code Here

        }
        progress.worked(10);

        Set<AbstractFamixEntity> keys = entityAssocaitionMap.keySet();

        IEvolizerSession lSession = null;
        try {
            sLogger.debug("Storing all Famix-Entities");
            progress.setTaskName("Storing FAMIX entities");

            lSession = EvolizerSessionHandler.getHandler().getCurrentSession(fDBUrl);
            lSession.startTransaction();
            for (AbstractFamixEntity element : keys) {
                sLogger.debug("Adding to database " + element.getClass().getName() + ":\n" + element.getUniqueName());
                lSession.saveObject(element);
            }
            lSession.flush();
            lSession.clear();

            sLogger.debug("Famix-Entities storage complete");
            progress.worked(45);

            sLogger.debug("Storing all Associstions");
            progress.setTaskName("Storing FAMIX associations");
            for (AbstractFamixEntity element : keys) {
                for (FamixAssociation association : entityAssocaitionMap.get(element)) {
                    if ((association.getFrom().getId() != null) && (association.getTo().getId() != null)) {
                        sLogger.debug("Adding to database " + association.getClass().getName() + ":\n" + "FROM "
                                + association.getFrom().getUniqueName() + " TO " + association.getTo().getUniqueName());
                        // fSession.saveObject(association);
                        lSession.saveObject(association);
                    } else {
                        sLogger.warn("Missing ID in " + association.getType() + " association of entitye "
                                + element.getUniqueName() + "(" + element.getId() + ")");
                    }
                }
                lSession.flush();
                lSession.clear();
            }
            sLogger.debug("Associations storage complete");
           
            lSession.saveObject(fModel);
            lSession.flush();
            lSession.clear();
            sLogger.debug("Model entry stored");
           
            progress.worked(45);
        } catch (EvolizerException e) {
            throw new EvolizerException(e);
        } finally {
            if (lSession != null) {
                lSession.endTransaction();
            }
        }
    }
View Full Code Here

  }

  @Test
  public void testEvolizerSession() {
    try {
      IEvolizerSession s = fSessionHandler.getCurrentSession(fDBUrl);
      assertNotNull(s);
      assertTrue(s.isOpen());
      s.close();
    } catch (EvolizerException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }

  public void testClose() {
    try {
      IEvolizerSession s = fSessionHandler.getCurrentSession(fDBUrl);
      s.close();
      assertFalse(s.isOpen());
    } catch (EvolizerException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.evolizer.core.hibernate.session.api.IEvolizerSession

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.