use of ddf.catalog.operation.SourceProcessingDetails in project ddf by codice.
the class MigrateCommand method query.
@Override
protected SourceResponse query(CatalogFacade framework, Filter filter, int startIndex, long querySize) {
QueryImpl query = new QueryImpl(filter);
query.setRequestsTotalResultsCount(true);
query.setPageSize((int) querySize);
query.setSortBy(new SortByImpl(Metacard.MODIFIED, SortOrder.DESCENDING));
QueryRequest queryRequest = new QueryRequestImpl(query);
query.setStartIndex(startIndex);
SourceResponse response;
try {
LOGGER.debug("Querying with startIndex: {}", startIndex);
response = framework.query(queryRequest);
} catch (UnsupportedQueryException | SourceUnavailableException | FederationException e) {
printErrorMessage(String.format("Received error from Frameworks: %s%n", e.getMessage()));
return null;
}
if (response.getProcessingDetails() != null && !response.getProcessingDetails().isEmpty()) {
for (SourceProcessingDetails details : response.getProcessingDetails()) {
LOGGER.debug("Got Issues: {}", details.getWarnings());
}
return null;
}
return response;
}
use of ddf.catalog.operation.SourceProcessingDetails in project ddf by codice.
the class ReplicateCommand method query.
@Override
protected SourceResponse query(CatalogFacade framework, Filter filter, int startIndex, long querySize) {
QueryImpl query = new QueryImpl(filter);
query.setRequestsTotalResultsCount(true);
query.setPageSize((int) querySize);
query.setSortBy(new SortByImpl(Metacard.EFFECTIVE, SortOrder.DESCENDING));
QueryRequest queryRequest = new QueryRequestImpl(query, Arrays.asList(sourceId));
query.setStartIndex(startIndex);
SourceResponse response;
try {
LOGGER.debug("Querying with startIndex: {}", startIndex);
response = framework.query(queryRequest);
} catch (UnsupportedQueryException | SourceUnavailableException | FederationException e) {
printErrorMessage(String.format("Received error from %s: %s%n", sourceId, e.getMessage()));
return null;
}
if (response.getProcessingDetails() != null && !response.getProcessingDetails().isEmpty()) {
for (SourceProcessingDetails details : response.getProcessingDetails()) {
LOGGER.debug("Got Issues: {}", details.getWarnings());
}
return null;
}
final long totalHits = response.getHits();
if (totalHits == 0) {
console.println("No records were found to replicate.");
return null;
}
return response;
}
use of ddf.catalog.operation.SourceProcessingDetails in project ddf by codice.
the class SortedQueryMonitor method executePostFederationQueryPlugins.
private SourceResponse executePostFederationQueryPlugins(SourceResponse sourceResponse, QueryRequest queryRequest, String sourceId, Set<ProcessingDetails> processingDetails) {
final HashSet<ProcessingDetails> newProcessingDetails = new HashSet<>(processingDetails);
newProcessingDetails.addAll(sourceProcessingDetailsToProcessingDetails(sourceId, sourceResponse));
QueryResponse queryResponse = new QueryResponseImpl(queryRequest, sourceResponse.getResults(), true, sourceResponse.getHits(), sourceResponse.getProperties(), newProcessingDetails);
try {
for (PostFederatedQueryPlugin service : postQuery) {
try {
queryResponse = service.process(queryResponse);
} catch (PluginExecutionException e) {
LOGGER.info("Error executing PostFederatedQueryPlugin", e);
}
}
} catch (StopProcessingException e) {
LOGGER.info("Plugin stopped processing", e);
}
Set<SourceProcessingDetails> detailsOfResponseAfterPlugins = new HashSet<>(queryResponse.getProcessingDetails());
return new SourceResponseImpl(queryRequest, sourceResponse.getProperties(), queryResponse.getResults(), queryResponse.getHits(), detailsOfResponseAfterPlugins);
}
Aggregations