@Test public void testUnresolveQuery() { RestInvocations.loadMetadata(handler, "defect"); RestInvocations.loadMetadata(handler, "release-backlog-item"); EntityQuery query = new EntityQuery("defect"); query.setValue("status", "a OR b OR c"); query.setValue("owner", "me or you"); favoritesService.unresolveQuery(query); Assert.assertEquals("a;b;c", query.getValue("status")); Assert.assertEquals("me;you", query.getValue("release-backlog-item.owner")); Assert.assertNull(query.getValue("owner")); }
public void unresolveQuery(EntityQuery query) { for(String property: query.getPropertyMap().keySet()) { String realProperty = restService.getServerStrategy().getFieldAlias(query.getEntityType(), property); if(!property.equals(realProperty)) { query.setValue(realProperty, query.getValue(property)); query.setValue(property, null); } Field field = metadataService.getEntityMetadata(query.getEntityType()).getField(realProperty); FilterFactory factory = filterManager.getFilterFactory(new Context<EntityQuery>(query), query.getEntityType(), field, true); if(factory != null) { Node node = ExpressionParser.parse(query.getValue(realProperty)); List<String> values = new LinkedList<String>(); if(collectOrValues(node, values)) { query.setValue(realProperty, factory.multipleValues(values)); } } } }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public void unresolveQuery(EntityQuery query) { for(String property: query.getPropertyMap().keySet()) { String realProperty = restService.getServerStrategy().getFieldAlias(query.getEntityType(), property); if(!property.equals(realProperty)) { query.setValue(realProperty, query.getValue(property)); query.setValue(property, null); } Field field = metadataService.getEntityMetadata(query.getEntityType()).getField(realProperty); FilterFactory factory = filterManager.getFilterFactory(new Context<EntityQuery>(query), query.getEntityType(), field, true); if(factory != null) { Node node = ExpressionParser.parse(query.getValue(realProperty)); List<String> values = new LinkedList<String>(); if(collectOrValues(node, values)) { query.setValue(realProperty, factory.multipleValues(values)); } } } } }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public void unresolveQuery(EntityQuery query) { for(String property: query.getPropertyMap().keySet()) { String realProperty = restService.getServerStrategy().getFieldAlias(query.getEntityType(), property); if(!property.equals(realProperty)) { query.setValue(realProperty, query.getValue(property)); query.setValue(property, null); } Field field = metadataService.getEntityMetadata(query.getEntityType()).getField(realProperty); FilterFactory factory = filterManager.getFilterFactory(new Context<EntityQuery>(query), query.getEntityType(), field, true); if(factory != null) { Node node = ExpressionParser.parse(query.getValue(realProperty)); List<String> values = new LinkedList<String>(); if(collectOrValues(node, values)) { query.setValue(realProperty, factory.multipleValues(values)); } } } } FavoritesService(Project project, EntityService entityService, AliProjectConfiguration projConf, MetadataService metadataService, FilterManager filterManager, RestService restService); }
FavoritesService extends AbstractCachingService<FavoritesService.Favorite, EntityQuery, AbstractCachingService.Callback<EntityQuery>> { public void unresolveQuery(EntityQuery query) { for(String property: query.getPropertyMap().keySet()) { String realProperty = restService.getServerStrategy().getFieldAlias(query.getEntityType(), property); if(!property.equals(realProperty)) { query.setValue(realProperty, query.getValue(property)); query.setValue(property, null); } Field field = metadataService.getEntityMetadata(query.getEntityType()).getField(realProperty); FilterFactory factory = filterManager.getFilterFactory(new Context<EntityQuery>(query), query.getEntityType(), field, true); if(factory != null) { Node node = ExpressionParser.parse(query.getValue(realProperty)); List<String> values = new LinkedList<String>(); if(collectOrValues(node, values)) { query.setValue(realProperty, factory.multipleValues(values)); } } } } 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 void unresolveQuery(EntityQuery query) { for(String property: query.getPropertyMap().keySet()) { String realProperty = restService.getServerStrategy().getFieldAlias(query.getEntityType(), property); if(!property.equals(realProperty)) { query.setValue(realProperty, query.getValue(property)); query.setValue(property, null); } Field field = metadataService.getEntityMetadata(query.getEntityType()).getField(realProperty); FilterFactory factory = filterManager.getFilterFactory(new Context<EntityQuery>(query), query.getEntityType(), field, true); if(factory != null) { Node node = ExpressionParser.parse(query.getValue(realProperty)); List<String> values = new LinkedList<String>(); if(collectOrValues(node, values)) { query.setValue(realProperty, factory.multipleValues(values)); } } } } 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);  }