Conversation
e86e7ba to
0e0b4d2
Compare
07765cd to
65db1ad
Compare
8bc250c to
98f8567
Compare
98f8567 to
b07ead2
Compare
| if (expr.length == 0) { | ||
| return EMPTY_EXPRESSION; | ||
| } | ||
| return ACCESS.newExpression(new String(expr, UTF_8)); |
There was a problem hiding this comment.
Could we delegate to toAccessExpression(byte[] visibilityBytes)?
| if (expr.length == 0) { | |
| return EMPTY_EXPRESSION; | |
| } | |
| return ACCESS.newExpression(new String(expr, UTF_8)); | |
| return toAccessExpression(expr); |
cceab28 to
e72fd54
Compare
| @SuppressWarnings({"unchecked", "rawtypes"}) | ||
| public static Markings<?> combine(MarkingFunctions<?> markingFunctions, Collection<? extends Markings<?>> markings) throws MarkingFunctions.Exception { | ||
| return ((MarkingFunctions) markingFunctions).combine(markings); | ||
| } |
There was a problem hiding this comment.
I think we can be a little more specific with generics here:
| @SuppressWarnings({"unchecked", "rawtypes"}) | |
| public static Markings<?> combine(MarkingFunctions<?> markingFunctions, Collection<? extends Markings<?>> markings) throws MarkingFunctions.Exception { | |
| return ((MarkingFunctions) markingFunctions).combine(markings); | |
| } | |
| public static <T extends Markings<?>, U extends MarkingFunctions<T>> T combine(U markingFunctions, Collection<T> markings) throws MarkingFunctions.Exception { | |
| return markingFunctions.combine(markings); | |
| } |
| if (markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) { | ||
| AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1; | ||
| AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2; | ||
| return combine(markingFunctions, List.of(aem1, aem2)); |
There was a problem hiding this comment.
If the above generic suggestion works, i think you'll need to modify this slightly:
| if (markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) { | |
| AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1; | |
| AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2; | |
| return combine(markingFunctions, List.of(aem1, aem2)); | |
| if (markingFunctions instanceof MarkingFunctions.Default && markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) { | |
| MarkingFunctions<AccessExpressionMarkings> defaultMarkingFunctions = (MarkingFunctions.Default) markingFunctions; | |
| AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1; | |
| AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2; | |
| return combine(defaultMarkingFunctions, List.of(aem1, aem2)); |
| * Many modules still require {@link ColumnVisibility} for the native Accumulo Key/Mutation API, while the marking functions layer has migrated to | ||
| * {@link AccessExpression}. This utility provides zero-copy-where-possible conversions between the two. | ||
| */ | ||
| public final class AccessExpressionUtil { |
There was a problem hiding this comment.
This class could use some unit tests. Let me know if you'd like some help making them.
| import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
|
||
| @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) | ||
| public interface Markings<T> { |
There was a problem hiding this comment.
Can we restrict T here at all?
| public interface HasMarkings { | ||
|
|
||
| void setMarkings(Map<String,String> markings); | ||
| void setMarkings(Markings<?> markings); | ||
|
|
||
| Map<String,String> getMarkings(); | ||
| Markings<?> getMarkings(); | ||
| } |
There was a problem hiding this comment.
I'm guessing there's some issue you'll eventually run into, but here's a naive suggestion (which will require a lot of associated changes, some of which may be impossible):
public interface HasMarkings <T> {
void setMarkings(Markings<T> markings);
Markings<T> getMarkings();
}| return new ColumnVisibility(new ColumnVisibility(expressions.stream().map(ColumnVisibility::flatten).filter(b -> b.length > 0) | ||
| .map(b -> "(" + new String(b, UTF_8) + ")").collect(Collectors.joining("&")).getBytes(UTF_8)).flatten()); | ||
| @Override | ||
| public ColumnVisibility combineVisibilities(Collection<ColumnVisibility> visibilities) { |
There was a problem hiding this comment.
Just curious, why maintain this method vs deleting?
There was a problem hiding this comment.
There is extensive usage in the HS code
db7ddfe to
7e909ed
Compare
b95c774 to
5e3c97e
Compare
Conflicts:
microservices/services/config/pom.xml
warehouse/query-core/src/main/java/datawave/query/tables/shard/CountAggregatingIterator.java
6033cf1 to
3211c05
Compare
No description provided.