-
Notifications
You must be signed in to change notification settings - Fork 3k
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
refactor(gms): Refactoring util + entity client class locations #5902
refactor(gms): Refactoring util + entity client class locations #5902
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one question but not blocking an approval!
// Creates new Filter from a map of Criteria by removing null-valued Criteria and using EQUAL condition (default). | ||
@Nonnull | ||
public static Filter newFilter(@Nullable Map<String, String> params) { | ||
if (params == null) { | ||
return new Filter().setOr(new ConjunctiveCriterionArray()); | ||
} | ||
CriterionArray criteria = params.entrySet() | ||
.stream() | ||
.filter(e -> Objects.nonNull(e.getValue())) | ||
.map(e -> newCriterion(e.getKey(), e.getValue(), Condition.EQUAL)) | ||
.collect(Collectors.toCollection(CriterionArray::new)); | ||
return new Filter().setOr( | ||
new ConjunctiveCriterionArray(ImmutableList.of(new ConjunctiveCriterion().setAnd(criteria)))); | ||
} | ||
|
||
@Nonnull | ||
public static Criterion newCriterion(@Nonnull String field, @Nonnull String value, @Nonnull Condition condition) { | ||
return new Criterion().setField(field).setValue(value).setCondition(condition); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curios - why duplicate these from QueryUtils to here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query Utils are unfortunately inside of metadata-io which should be a library that is NOT exposed to folks who just want to use a RestliEntityClient... It's too heavy. So we've removed this dependency completely and as part of that we had to duplicate this shared logic. That being said, I think it'd be better moving forward to establish a module where truly "shared" libraries can reside. I'm going to add a TODO here
Summary
Minor refactoring PR to move location of JavaEntityClient and various util methods / classes into more suitable locations.
Checklist