Search in sources :

Example 1 with ProcessUpdateItem

use of org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem in project ddf by codice.

the class ProcessingPostIngestPlugin method createUpdateRequest.

private ProcessRequest<ProcessUpdateItem> createUpdateRequest(UpdateResponse updateResponse) {
    List<Update> updates = updateResponse.getUpdatedMetacards();
    List<ProcessUpdateItem> processUpdateItems = new ArrayList<>();
    for (Update update : updates) {
        Metacard oldCard = update.getOldMetacard();
        Metacard newCard = update.getNewMetacard();
        ProcessUpdateItem processItem = new ProcessUpdateItemImpl(getProcessResource(newCard, getSubject(updateResponse)), newCard, oldCard, false);
        processUpdateItems.add(processItem);
    }
    return new ProcessRequestImpl(processUpdateItems, putPostProcessCompleteFlagAndGet(updateResponse.getProperties()));
}
Also used : ProcessRequestImpl(org.codice.ddf.catalog.async.data.impl.ProcessRequestImpl) Metacard(ddf.catalog.data.Metacard) ArrayList(java.util.ArrayList) Update(ddf.catalog.operation.Update) ProcessUpdateItem(org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem) ProcessUpdateItemImpl(org.codice.ddf.catalog.async.data.impl.ProcessUpdateItemImpl)

Example 2 with ProcessUpdateItem

use of org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem in project ddf by codice.

the class InMemoryProcessingFramework method submitUpdate.

@Override
public void submitUpdate(ProcessRequest<ProcessUpdateItem> input) {
    if (postProcessPlugins == null || postProcessPlugins.isEmpty()) {
        LOGGER.debug("postProcessPlugins is empty. Not starting post process thread");
    } else {
        threadPool.submit(() -> {
            ProcessRequest<ProcessUpdateItem> request = input;
            for (PostProcessPlugin plugin : postProcessPlugins) {
                try {
                    request = plugin.processUpdate(request);
                } catch (PluginExecutionException e) {
                    LOGGER.debug("Unable to process update request through plugin: {}", plugin.getClass().getCanonicalName(), e);
                }
            }
            storeProcessRequest(request);
            closeInputStream(request);
        });
    }
}
Also used : PostProcessPlugin(org.codice.ddf.catalog.async.plugin.api.internal.PostProcessPlugin) ProcessUpdateItem(org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem) PluginExecutionException(ddf.catalog.plugin.PluginExecutionException)

Aggregations

ProcessUpdateItem (org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem)2 Metacard (ddf.catalog.data.Metacard)1 Update (ddf.catalog.operation.Update)1 PluginExecutionException (ddf.catalog.plugin.PluginExecutionException)1 ArrayList (java.util.ArrayList)1 ProcessRequestImpl (org.codice.ddf.catalog.async.data.impl.ProcessRequestImpl)1 ProcessUpdateItemImpl (org.codice.ddf.catalog.async.data.impl.ProcessUpdateItemImpl)1 PostProcessPlugin (org.codice.ddf.catalog.async.plugin.api.internal.PostProcessPlugin)1