@Test public void testGetGlobalQuery_stored() { addGlobalQuery(); EntityQuery query = favoritesService.getStoredQuery("defect", "global_test_query (global)"); Assert.assertEquals("1", query.getValue("id")); }
public EntityQuery getStoredQuery(String entityType, String queryNameAndKind) { Matcher matcher = Pattern.compile("^(\\d+): .* \\(ALM\\)$").matcher(queryNameAndKind); if(matcher.matches()) { int id = Integer.valueOf(matcher.group(1)); return getFavorite(id, entityType); } else { for(EntityQuery filter: getAvailableQueries(entityType)) { if(queryNameAndKind.equals(filter.getName())) { return filter; } } return null; } }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public EntityQuery getStoredQuery(String entityType, String queryNameAndKind) { Matcher matcher = Pattern.compile("^(\\d+): .* \\(ALM\\)$").matcher(queryNameAndKind); if(matcher.matches()) { int id = Integer.valueOf(matcher.group(1)); return getFavorite(id, entityType); } else { for(EntityQuery filter: getAvailableQueries(entityType)) { if(queryNameAndKind.equals(filter.getName())) { return filter; } } return null; } } }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public EntityQuery getStoredQuery(String entityType, String queryNameAndKind) { Matcher matcher = Pattern.compile("^(\\d+): .* \\(ALM\\)$").matcher(queryNameAndKind); if(matcher.matches()) { int id = Integer.valueOf(matcher.group(1)); return getFavorite(id, entityType); } else { for(EntityQuery filter: getAvailableQueries(entityType)) { if(queryNameAndKind.equals(filter.getName())) { return filter; } } return null; } } FavoritesService(Project project, EntityService entityService, AliProjectConfiguration projConf, MetadataService metadataService, FilterManager filterManager, RestService restService); }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public EntityQuery getStoredQuery(String entityType, String queryNameAndKind) { Matcher matcher = Pattern.compile("^(\\d+): .* \\(ALM\\)$").matcher(queryNameAndKind); if(matcher.matches()) { int id = Integer.valueOf(matcher.group(1)); return getFavorite(id, entityType); } else { for(EntityQuery filter: getAvailableQueries(entityType)) { if(queryNameAndKind.equals(filter.getName())) { return filter; } } return null; } } FavoritesService(Project project, EntityService entityService, AliProjectConfiguration projConf, MetadataService metadataService, FilterManager filterManager, RestService restService); EntityQuery getFavorite(int id, String entityType); EntityQuery getStoredQuery(String entityType, String queryNameAndKind); List<EntityQuery> getAvailableQueries(String entityType); void unresolveQuery(EntityQuery query); }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public EntityQuery getStoredQuery(String entityType, String queryNameAndKind) { Matcher matcher = Pattern.compile("^(\\d+): .* \\(ALM\\)$").matcher(queryNameAndKind); if(matcher.matches()) { int id = Integer.valueOf(matcher.group(1)); return getFavorite(id, entityType); } else { for(EntityQuery filter: getAvailableQueries(entityType)) { if(queryNameAndKind.equals(filter.getName())) { return filter; } } return null; } } FavoritesService(Project project, EntityService entityService, AliProjectConfiguration projConf, MetadataService metadataService, FilterManager filterManager, RestService restService); EntityQuery getFavorite(int id, String entityType); EntityQuery getStoredQuery(String entityType, String queryNameAndKind); List<EntityQuery> getAvailableQueries(String entityType); void unresolveQuery(EntityQuery query);  }