Skip to content

filter required parameters for query execution #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 24, 2017
Merged

Conversation

gdalecka
Copy link
Contributor

No description provided.

@gdalecka gdalecka force-pushed the filter-query-params branch from df9f9b5 to 72bb53b Compare January 23, 2017 11:23
@gdalecka gdalecka force-pushed the filter-query-params branch from 72bb53b to d7a1dd7 Compare January 23, 2017 13:48
throw new IllegalStateException("Old parameter should have symbolic name or unsigned decimal integer value");
}

throw new IllegalStateException("Parameter should have either new parameter or old parameter representation");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return "graphbdb-plugin-invalid-parameter-name-should-never-happen";

Map<String, Object> result = parametersService
.getParameters(getPsiFile("match (p:Person) where p.name = $name return *"));

assertThat(result.keySet()).contains("name");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertThat(result).containsChtoTo("name", "Anna")


Map<String, Object> jsonVal = (Map<String, Object>) result.get("p3");
assertThat(jsonVal).containsKey("name");
assertThat(jsonVal).containsValue("Alex");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertThat(jsonVal).hasSize()

throw new IllegalStateException("Parameters provider already registered");
}
this.parametersProvider = parametersProvider;
}

public Map<String, Object> getParameters() throws Exception {
public Map<String, Object> getParameters(PsiElement query) throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

element

private Set<String> extractParameterNames(PsiElement query) {
List<PsiElement> parameterElements = TraverseUtil.collectPsiElementsByType(query, CypherTypes.PARAMETER);
return parameterElements.stream()
.map(elem -> CypherPsiImplUtil.getParameterName(((CypherParameter) elem)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

((CypherParameter) elem).getParameterName()

@FylmTM FylmTM merged commit 6306a04 into master Jan 24, 2017
@FylmTM FylmTM deleted the filter-query-params branch January 24, 2017 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants