@Test public void filterResultsWithTwoColumnsAndEntityReference() { List<Object> results = Arrays.asList(new Object[]{ this.unauthorized, 23 }, new Object[]{ this.authorized, 17 }); List<Object> filteredResults = this.filter.filterResults(results); assertEquals(1, filteredResults.size()); assertArrayEquals(new Object[]{ this.authorized, 17 }, (Object[]) filteredResults.get(0)); }
@Override public List filterResults(List results) { List<Object> filteredResults = new LinkedList<>(); for (Object result : results) { EntityReference entityReference = null; if (result instanceof EntityReference) { entityReference = (EntityReference) result; } else if (result instanceof Object[] && ((Object[]) result)[0] instanceof EntityReference) { entityReference = (EntityReference) ((Object[]) result)[0]; } if (entityReference != null && this.authorization.hasAccess(Right.VIEW, entityReference)) { filteredResults.add(result); } } return filteredResults; }
ViewableQueryFilter implements QueryFilter { @Override public List filterResults(List results) { List<Object> filteredResults = new LinkedList<>(); for (Object result : results) { EntityReference entityReference = null; if (result instanceof EntityReference) { entityReference = (EntityReference) result; } else if (result instanceof Object[] && ((Object[]) result)[0] instanceof EntityReference) { entityReference = (EntityReference) ((Object[]) result)[0]; } if (entityReference != null && this.authorization.hasAccess(Right.VIEW, entityReference)) { filteredResults.add(result); } } return filteredResults; } }
ViewableQueryFilter implements QueryFilter { @Override public List filterResults(List results) { List<Object> filteredResults = new LinkedList<>(); for (Object result : results) { EntityReference entityReference = null; if (result instanceof EntityReference) { entityReference = (EntityReference) result; } else if (result instanceof Object[] && ((Object[]) result)[0] instanceof EntityReference) { entityReference = (EntityReference) ((Object[]) result)[0]; } if (entityReference != null && this.authorization.hasAccess(Right.VIEW, entityReference)) { filteredResults.add(result); } } return filteredResults; }  }
ViewableQueryFilter implements QueryFilter { @Override public List filterResults(List results) { List<Object> filteredResults = new LinkedList<>(); for (Object result : results) { EntityReference entityReference = null; if (result instanceof EntityReference) { entityReference = (EntityReference) result; } else if (result instanceof Object[] && ((Object[]) result)[0] instanceof EntityReference) { entityReference = (EntityReference) ((Object[]) result)[0]; } if (entityReference != null && this.authorization.hasAccess(Right.VIEW, entityReference)) { filteredResults.add(result); } } return filteredResults; }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results); }
ViewableQueryFilter implements QueryFilter { @Override public List filterResults(List results) { List<Object> filteredResults = new LinkedList<>(); for (Object result : results) { EntityReference entityReference = null; if (result instanceof EntityReference) { entityReference = (EntityReference) result; } else if (result instanceof Object[] && ((Object[]) result)[0] instanceof EntityReference) { entityReference = (EntityReference) ((Object[]) result)[0]; } if (entityReference != null && this.authorization.hasAccess(Right.VIEW, entityReference)) { filteredResults.add(result); } } return filteredResults; }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results);  }