Search in sources :

Example 1 with ProcessCreateItem

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

the class InMemoryProcessingFramework method submitCreate.

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

Example 2 with ProcessCreateItem

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

the class MetacardBackupPluginTest method generateProcessRequest.

private ProcessRequest generateProcessRequest(Class<? extends ProcessResourceItem> clazz, boolean validCard) {
    List<ProcessResourceItem> processCreateItems = new ArrayList<>();
    for (String id : METACARD_IDS) {
        Metacard metacard = new MetacardImpl();
        metacard.setAttribute(new AttributeImpl(Core.ID, id));
        metacard.setAttribute(new AttributeImpl(Core.METADATA, XML_METADATA));
        if (!validCard) {
            metacard.setAttribute(new AttributeImpl(Core.METACARD_TAGS, "INVALID"));
        }
        ProcessResourceItem processResourceItem;
        if (clazz.getName().contains("ProcessCreateItem")) {
            processResourceItem = mock(ProcessCreateItem.class);
        } else {
            processResourceItem = mock(ProcessUpdateItem.class);
        }
        when(processResourceItem.getMetacard()).thenReturn(metacard);
        processCreateItems.add(processResourceItem);
    }
    ProcessRequest localCreateRequest = mock(ProcessRequest.class);
    when(localCreateRequest.getProcessItems()).thenReturn(processCreateItems);
    return localCreateRequest;
}
Also used : ProcessResourceItem(org.codice.ddf.catalog.async.data.api.internal.ProcessResourceItem) Metacard(ddf.catalog.data.Metacard) ProcessRequest(org.codice.ddf.catalog.async.data.api.internal.ProcessRequest) AttributeImpl(ddf.catalog.data.impl.AttributeImpl) ArrayList(java.util.ArrayList) ProcessCreateItem(org.codice.ddf.catalog.async.data.api.internal.ProcessCreateItem) ProcessUpdateItem(org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 3 with ProcessCreateItem

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

the class ProcessingPostIngestPlugin method createCreateRequest.

private ProcessRequest<ProcessCreateItem> createCreateRequest(CreateResponse createResponse) {
    List<ProcessCreateItem> processCreateItems;
    processCreateItems = createResponse.getCreatedMetacards().stream().map(metacard -> new ProcessCreateItemImpl(getProcessResource(metacard, getSubject(createResponse)), metacard, false)).collect(Collectors.toList());
    return new ProcessRequestImpl(processCreateItems, putPostProcessCompleteFlagAndGet(createResponse.getProperties()));
}
Also used : ProcessRequestImpl(org.codice.ddf.catalog.async.data.impl.ProcessRequestImpl) ProcessCreateItem(org.codice.ddf.catalog.async.data.api.internal.ProcessCreateItem) ProcessCreateItemImpl(org.codice.ddf.catalog.async.data.impl.ProcessCreateItemImpl)

Aggregations

ProcessCreateItem (org.codice.ddf.catalog.async.data.api.internal.ProcessCreateItem)3 Metacard (ddf.catalog.data.Metacard)1 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 PluginExecutionException (ddf.catalog.plugin.PluginExecutionException)1 ArrayList (java.util.ArrayList)1 ProcessRequest (org.codice.ddf.catalog.async.data.api.internal.ProcessRequest)1 ProcessResourceItem (org.codice.ddf.catalog.async.data.api.internal.ProcessResourceItem)1 ProcessUpdateItem (org.codice.ddf.catalog.async.data.api.internal.ProcessUpdateItem)1 ProcessCreateItemImpl (org.codice.ddf.catalog.async.data.impl.ProcessCreateItemImpl)1 ProcessRequestImpl (org.codice.ddf.catalog.async.data.impl.ProcessRequestImpl)1 PostProcessPlugin (org.codice.ddf.catalog.async.plugin.api.internal.PostProcessPlugin)1