@Test(expected = InvalidParseOperationException.class) public void testInvalidParseOperationExceptionWithEmptyKey() throws InvalidParseOperationException, InvalidCreateOperationException { final Map<String, String> queryMap = new HashMap(); queryMap.put("", "value"); dslQueryHelper.createSelectDSLQuery(queryMap); }
public JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException { final SelectMultiQuery select = new SelectMultiQuery(); final BooleanQuery booleanQueries = and(); for (final Entry<String, String> entry : searchCriteriaMap.entrySet()) { final String searchKeys = entry.getKey(); final String searchValue = entry.getValue(); if (searchKeys.isEmpty() || searchValue.isEmpty()) { throw new InvalidParseOperationException("Parameters should not be empty or null"); } if (searchKeys.startsWith(PROJECTION_PREFIX)) { select.addUsedProjection(searchValue); continue; } if (searchKeys.equals(ORDER_BY)) { select.addOrderByAscFilter(searchValue); continue; } if (searchKeys.equals(UiConstants.SELECT_BY_ID.toString())) { select.addRoots(searchValue); continue; } booleanQueries.add(eq(searchKeys, searchValue)); } if (booleanQueries.isReady()) { boolean noRoots = select.getRoots() == null || select.getRoots().isEmpty(); if (!(noRoots && select.getNbQueries() == 0)) { booleanQueries.setDepthLimit(DEPTH_LIMIT); } select.addQueries(booleanQueries); } return select.getFinalSelect(); }
DslQueryHelper { public JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException { final SelectMultiQuery select = new SelectMultiQuery(); final BooleanQuery booleanQueries = and(); for (final Entry<String, String> entry : searchCriteriaMap.entrySet()) { final String searchKeys = entry.getKey(); final String searchValue = entry.getValue(); if (searchKeys.isEmpty() || searchValue.isEmpty()) { throw new InvalidParseOperationException("Parameters should not be empty or null"); } if (searchKeys.startsWith(PROJECTION_PREFIX)) { select.addUsedProjection(searchValue); continue; } if (searchKeys.equals(ORDER_BY)) { select.addOrderByAscFilter(searchValue); continue; } if (searchKeys.equals(UiConstants.SELECT_BY_ID.toString())) { select.addRoots(searchValue); continue; } booleanQueries.add(eq(searchKeys, searchValue)); } if (booleanQueries.isReady()) { boolean noRoots = select.getRoots() == null || select.getRoots().isEmpty(); if (!(noRoots && select.getNbQueries() == 0)) { booleanQueries.setDepthLimit(DEPTH_LIMIT); } select.addQueries(booleanQueries); } return select.getFinalSelect(); } }
DslQueryHelper { public JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException { final SelectMultiQuery select = new SelectMultiQuery(); final BooleanQuery booleanQueries = and(); for (final Entry<String, String> entry : searchCriteriaMap.entrySet()) { final String searchKeys = entry.getKey(); final String searchValue = entry.getValue(); if (searchKeys.isEmpty() || searchValue.isEmpty()) { throw new InvalidParseOperationException("Parameters should not be empty or null"); } if (searchKeys.startsWith(PROJECTION_PREFIX)) { select.addUsedProjection(searchValue); continue; } if (searchKeys.equals(ORDER_BY)) { select.addOrderByAscFilter(searchValue); continue; } if (searchKeys.equals(UiConstants.SELECT_BY_ID.toString())) { select.addRoots(searchValue); continue; } booleanQueries.add(eq(searchKeys, searchValue)); } if (booleanQueries.isReady()) { boolean noRoots = select.getRoots() == null || select.getRoots().isEmpty(); if (!(noRoots && select.getNbQueries() == 0)) { booleanQueries.setDepthLimit(DEPTH_LIMIT); } select.addQueries(booleanQueries); } return select.getFinalSelect(); } DslQueryHelper(); }
DslQueryHelper { public JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException { final SelectMultiQuery select = new SelectMultiQuery(); final BooleanQuery booleanQueries = and(); for (final Entry<String, String> entry : searchCriteriaMap.entrySet()) { final String searchKeys = entry.getKey(); final String searchValue = entry.getValue(); if (searchKeys.isEmpty() || searchValue.isEmpty()) { throw new InvalidParseOperationException("Parameters should not be empty or null"); } if (searchKeys.startsWith(PROJECTION_PREFIX)) { select.addUsedProjection(searchValue); continue; } if (searchKeys.equals(ORDER_BY)) { select.addOrderByAscFilter(searchValue); continue; } if (searchKeys.equals(UiConstants.SELECT_BY_ID.toString())) { select.addRoots(searchValue); continue; } booleanQueries.add(eq(searchKeys, searchValue)); } if (booleanQueries.isReady()) { boolean noRoots = select.getRoots() == null || select.getRoots().isEmpty(); if (!(noRoots && select.getNbQueries() == 0)) { booleanQueries.setDepthLimit(DEPTH_LIMIT); } select.addQueries(booleanQueries); } return select.getFinalSelect(); } DslQueryHelper(); static DslQueryHelper getInstance(); JsonNode createSingleQueryDSL(Map<String, Object> searchCriteriaMap); JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap); JsonNode createGetByIdDSLSelectMultipleQuery(Map<String, String> projectionCriteriaMap); JsonNode createSelectElasticsearchDSLQuery(Map<String, Object> searchCriteriaMap); JsonNode createUpdateByIdDSLQuery(Map<String, JsonNode> searchCriteriaMap,
        Map<String, JsonNode> updateRules); ObjectNode createMassiveUpdateDSLBaseQuery(JsonNode modifiedFields); UpdateMultiQuery getFullMetadataActionQuery(JsonNode metadataModifications); JsonNode createSearchQueryAccessionRegister(Map<String, Object> options); JsonNode createSelectAndUpdateDSLQuery(Map<String, Object> optionsMap); }
DslQueryHelper { public JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException { final SelectMultiQuery select = new SelectMultiQuery(); final BooleanQuery booleanQueries = and(); for (final Entry<String, String> entry : searchCriteriaMap.entrySet()) { final String searchKeys = entry.getKey(); final String searchValue = entry.getValue(); if (searchKeys.isEmpty() || searchValue.isEmpty()) { throw new InvalidParseOperationException("Parameters should not be empty or null"); } if (searchKeys.startsWith(PROJECTION_PREFIX)) { select.addUsedProjection(searchValue); continue; } if (searchKeys.equals(ORDER_BY)) { select.addOrderByAscFilter(searchValue); continue; } if (searchKeys.equals(UiConstants.SELECT_BY_ID.toString())) { select.addRoots(searchValue); continue; } booleanQueries.add(eq(searchKeys, searchValue)); } if (booleanQueries.isReady()) { boolean noRoots = select.getRoots() == null || select.getRoots().isEmpty(); if (!(noRoots && select.getNbQueries() == 0)) { booleanQueries.setDepthLimit(DEPTH_LIMIT); } select.addQueries(booleanQueries); } return select.getFinalSelect(); } DslQueryHelper(); static DslQueryHelper getInstance(); JsonNode createSingleQueryDSL(Map<String, Object> searchCriteriaMap); JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap); JsonNode createGetByIdDSLSelectMultipleQuery(Map<String, String> projectionCriteriaMap); JsonNode createSelectElasticsearchDSLQuery(Map<String, Object> searchCriteriaMap); JsonNode createUpdateByIdDSLQuery(Map<String, JsonNode> searchCriteriaMap,
        Map<String, JsonNode> updateRules); ObjectNode createMassiveUpdateDSLBaseQuery(JsonNode modifiedFields); UpdateMultiQuery getFullMetadataActionQuery(JsonNode metadataModifications); JsonNode createSearchQueryAccessionRegister(Map<String, Object> options); JsonNode createSelectAndUpdateDSLQuery(Map<String, Object> optionsMap); static final String PROJECTION_DSL; }