Ejemplo n.º 1
0
  public List<File> getProjectFiles(Project project) {
    Session session = ((HibernateStorage) Manager.getStorageInstance()).getHibernateSession();
    Query q = session.createQuery("from File f where name.project = :project");
    q.setEntity("project", project);
    List<File> files = q.list();

    return files;
  }
Ejemplo n.º 2
0
  public static List<ScmChange> getChanges(Project project, String path) {
    Session session = ((HibernateStorage) Manager.getStorageInstance()).getHibernateSession();

    String prefix = "";
    java.io.File searchDir = Manager.getStorageInstance().getWorkingDirectory(project);
    while (project.getParent() != null) {
      prefix = searchDir.getName() + java.io.File.separatorChar + prefix;
      project = project.getParent();
      searchDir = searchDir.getParentFile();
    }

    Query q =
        session.createQuery(
            "from ScmChange c where c.set.id.project = :project and name = :path order by c.set.date desc");
    q.setEntity("project", project);
    q.setString("path", prefix + path);

    return q.list();
  }
Ejemplo n.º 3
0
  public static boolean getChangeSetExists(Project project, String changeId) {
    Session session = ((HibernateStorage) Manager.getStorageInstance()).getHibernateSession();

    Query q =
        session.createQuery(
            "select count(*) from ScmChangeSet s where s.id.project = :project and s.revision = :rev");
    q.setEntity("project", project);
    q.setString("rev", changeId);

    return ((Long) q.uniqueResult()) > 0;
  }
Ejemplo n.º 4
0
  public static boolean getFileExists(Project project, String fileName) {
    Session session = ((HibernateStorage) Manager.getStorageInstance()).getHibernateSession();

    Query q =
        session.createQuery(
            "select count(*) from File f where f.name.project = :project and f.name.name = :name");
    q.setEntity("project", project);
    q.setString("name", fileName);

    return ((Long) q.uniqueResult()) > 0;
  }
Ejemplo n.º 5
0
 public String getDescription() {
   return "The "
       + Manager.getStorageInstance().getGlobalConfiguration().getProductName()
       + " scm browse application";
 }