/** * Reads a project from Catalog given a project id or alias. * * @param projectStr Project id or alias. * @param options Read options * @param sessionId sessionId * @return The specified object * @throws CatalogException CatalogException */ @Deprecated public QueryResult<Project> get(String projectStr, QueryOptions options, String sessionId) throws CatalogException { String userId = catalogManager.getUserManager().getUserId(sessionId); Project project = resolveId(projectStr, userId); return projectDBAdaptor.get(project.getUid(), options); }
@Test public void getProjectTest() throws CatalogDBException { long projectId = catalogProjectDBAdaptor.getId(user3.getId(), user3.getProjects().get(0).getId()); System.out.println("projectId = " + projectId); QueryResult<Project> project = catalogProjectDBAdaptor.get(projectId, null); System.out.println(project); assertNotNull(project.first()); thrown.expect(CatalogDBException.class); //"Expected \"bad id\" exception" catalogProjectDBAdaptor.get(-100, null); }
private int getProjectCurrentRelease(long projectId) throws CatalogException { QueryOptions options = new QueryOptions(QueryOptions.INCLUDE, ProjectDBAdaptor.QueryParams.CURRENT_RELEASE.key()); QueryResult<Project> projectQueryResult = projectDBAdaptor.get(projectId, options); if (projectQueryResult.getNumResults() == 0) { throw new CatalogException("Internal error. Cannot retrieve current release from project"); } return projectQueryResult.first().getCurrentRelease(); }
@Test public void incrementCurrentRelease() throws CatalogDBException { long projectId = catalogProjectDBAdaptor.getId(user3.getId(), user3.getProjects().get(0).getId()); QueryResult<Project> projectQueryResult = catalogProjectDBAdaptor.get(projectId, new QueryOptions(QueryOptions.INCLUDE, ProjectDBAdaptor.QueryParams.CURRENT_RELEASE.key())); assertEquals(1, projectQueryResult.first().getCurrentRelease()); assertEquals(2, catalogProjectDBAdaptor.incrementCurrentRelease(projectId).first().intValue()); assertEquals(3, catalogProjectDBAdaptor.incrementCurrentRelease(projectId).first().intValue()); }
@Test public void getAllProjects() throws CatalogDBException { QueryResult<Project> allProjects = catalogProjectDBAdaptor.get(user3.getId(), null); System.out.println(allProjects); assertTrue(!allProjects.getResult().isEmpty()); }
return projectDBAdaptor.get(query, options, userId);
QueryResult<Project> projectQueryResult = projectDBAdaptor.get(query, projectOptions); if (projectQueryResult.getNumResults() > 1) { throw new CatalogException("Please be more concrete with the project. More than one project found for " + userId + " user"); return projectDBAdaptor.get(query, projectOptions).first(); } else { throw new CatalogException("More than one project shared with user " + userId + ". Please, be more specific. "
|| parameters.containsKey(ProjectDBAdaptor.QueryParams.ORGANISM_ASSEMBLY.key())) { QueryResult<Project> projectQR = projectDBAdaptor .get(projectId, new QueryOptions(QueryOptions.INCLUDE, ProjectDBAdaptor.QueryParams.ORGANISM.key())); if (projectQR.getNumResults() == 0) { throw new CatalogException("Project " + projectId + " not found");