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; }
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(); }
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; }
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; }
public String getDescription() { return "The " + Manager.getStorageInstance().getGlobalConfiguration().getProductName() + " scm browse application"; }