use of ddf.catalog.filter.impl.PropertyNameImpl in project ddf by codice.
the class FederationAdminServiceImpl method getRegistryMetacardsByFilter.
private List<Metacard> getRegistryMetacardsByFilter(Filter filter, Set<String> sourceIds) throws FederationAdminException {
if (filter == null) {
throw new FederationAdminException("Error getting registry metacards. Null filter provided.");
}
PropertyName propertyName = new PropertyNameImpl(Metacard.MODIFIED);
SortBy sortBy = new SortByImpl(propertyName, SortOrder.ASCENDING);
QueryImpl query = new QueryImpl(filter);
query.setSortBy(sortBy);
query.setPageSize(PAGE_SIZE);
QueryRequest queryRequest = new QueryRequestImpl(query, sourceIds);
try {
QueryResponse queryResponse = security.runWithSubjectOrElevate(() -> catalogFramework.query(queryRequest));
return queryResponse.getResults().stream().map(Result::getMetacard).filter(Objects::nonNull).collect(Collectors.toList());
} catch (SecurityServiceException | InvocationTargetException e) {
String message = "Error querying for registry metacards.";
LOGGER.debug("{} For Filter: {}", message, filter);
throw new FederationAdminException(message, e);
}
}
use of ddf.catalog.filter.impl.PropertyNameImpl in project ddf by codice.
the class RefreshRegistryEntries method getBasicRegistryQuery.
private Query getBasicRegistryQuery() {
List<Filter> filters = new ArrayList<>();
filters.add(filterBuilder.attribute(Metacard.TAGS).is().equalTo().text(RegistryConstants.REGISTRY_TAG));
PropertyName propertyName = new PropertyNameImpl(Metacard.MODIFIED);
SortBy sortBy = new SortByImpl(propertyName, SortOrder.ASCENDING);
QueryImpl query = new QueryImpl(filterBuilder.allOf(filters));
query.setSortBy(sortBy);
query.setPageSize(PAGE_SIZE);
return query;
}
Aggregations