Search in sources :

Example 1 with ContentProcessor

use of com.enonic.xp.content.processor.ContentProcessor in project xp by enonic.

the class UpdateContentCommand method runContentProcessors.

private Content runContentProcessors(final Content originalContent, Content editedContent, final ContentType contentType) {
    for (final ContentProcessor contentProcessor : this.contentProcessors) {
        if (contentProcessor.supports(contentType)) {
            final ProcessUpdateResult result = contentProcessor.processUpdate(ProcessUpdateParams.create().contentType(contentType).mediaInfo(mediaInfo).createAttachments(params.getCreateAttachments()).originalContent(originalContent).editedContent(editedContent).modifier(getCurrentUser()).build());
            editedContent = updateContentWithProcessedData(editedContent, result);
        }
    }
    return editedContent;
}
Also used : ContentProcessor(com.enonic.xp.content.processor.ContentProcessor) ProcessUpdateResult(com.enonic.xp.content.processor.ProcessUpdateResult)

Example 2 with ContentProcessor

use of com.enonic.xp.content.processor.ContentProcessor in project xp by enonic.

the class CreateContentCommand method runContentProcessors.

private CreateContentParams runContentProcessors(final CreateContentParams createContentParams, final ContentType contentType) {
    CreateContentParams processedParams = createContentParams;
    for (final ContentProcessor contentProcessor : this.contentProcessors) {
        if (contentProcessor.supports(contentType)) {
            final ProcessCreateResult result = contentProcessor.processCreate(new ProcessCreateParams(processedParams, mediaInfo));
            processedParams = CreateContentParams.create(result.getCreateContentParams()).build();
        }
    }
    return processedParams;
}
Also used : CreateContentParams(com.enonic.xp.content.CreateContentParams) ContentProcessor(com.enonic.xp.content.processor.ContentProcessor) ProcessCreateResult(com.enonic.xp.content.processor.ProcessCreateResult) ProcessCreateParams(com.enonic.xp.content.processor.ProcessCreateParams)

Aggregations

ContentProcessor (com.enonic.xp.content.processor.ContentProcessor)2 CreateContentParams (com.enonic.xp.content.CreateContentParams)1 ProcessCreateParams (com.enonic.xp.content.processor.ProcessCreateParams)1 ProcessCreateResult (com.enonic.xp.content.processor.ProcessCreateResult)1 ProcessUpdateResult (com.enonic.xp.content.processor.ProcessUpdateResult)1