@Test public void testAddTypeCriteria() { EntityDefinition def = entityDefs.lookupByResourceName(ResourceNames.TEACHERS); ApiQuery query = new ApiQuery(); query = resourceServiceHelper.addTypeCriteria(def, query); List<NeutralCriteria> criteriaList = query.getCriteria(); assertEquals("Should match", 1, criteriaList.size()); NeutralCriteria criteria = criteriaList.get(0); assertEquals("Should match", "type", criteria.getKey()); assertEquals("Should match", NeutralCriteria.CRITERIA_IN, criteria.getOperator()); assertEquals("Should match", Arrays.asList(def.getType()), criteria.getValue()); }
protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList(entityDefinition.getDbType()), false)); } NeutralCriteria criteria = entityDefinition.getTypeCriteria(); if(criteria != null) { apiQuery.addCriteria(criteria); } } return apiQuery; }
ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList(entityDefinition.getDbType()), false)); } NeutralCriteria criteria = entityDefinition.getTypeCriteria(); if(criteria != null) { apiQuery.addCriteria(criteria); } } return apiQuery; } }
ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList(entityDefinition.getDbType()), false)); } NeutralCriteria criteria = entityDefinition.getTypeCriteria(); if(criteria != null) { apiQuery.addCriteria(criteria); } } return apiQuery; }  }
ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList(entityDefinition.getDbType()), false)); } NeutralCriteria criteria = entityDefinition.getTypeCriteria(); if(criteria != null) { apiQuery.addCriteria(criteria); } } return apiQuery; }  ApiQuery getApiQuery(EntityDefinition definition, final URI requestURI); ApiQuery getApiQuery(EntityDefinition definition); }
ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList(entityDefinition.getDbType()), false)); } NeutralCriteria criteria = entityDefinition.getTypeCriteria(); if(criteria != null) { apiQuery.addCriteria(criteria); } } return apiQuery; }  ApiQuery getApiQuery(EntityDefinition definition, final URI requestURI); ApiQuery getApiQuery(EntityDefinition definition);  }