All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.platform.operation.internal.cpf.builder.HTMLToPDFContentAnalyzerRequestsDtoBuilder Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2019 Adobe
 * All Rights Reserved.
 *
 * NOTICE: Adobe permits you to use, modify, and distribute this file in
 * accordance with the terms of the Adobe license agreement accompanying
 * it. If you have received this file from a source other than Adobe,
 * then your use, modification, or distribution of it requires the prior
 * written permission of Adobe.
 */

package com.adobe.platform.operation.internal.cpf.builder;

import com.adobe.platform.operation.internal.GlobalConfig;
import com.adobe.platform.operation.internal.cpf.context.ContentAnalyzerRequestBuilderContext;
import com.adobe.platform.operation.internal.cpf.dto.request.ContentAnalyzerRequestsDto;

public class HTMLToPDFContentAnalyzerRequestsDtoBuilder {

    private ContentAnalyzerRequestBuilderContext contentAnalyzerRequestBuilderContext;

    public HTMLToPDFContentAnalyzerRequestsDtoBuilder(ContentAnalyzerRequestBuilderContext contentAnalyzerRequestBuilderContext) {
        this.contentAnalyzerRequestBuilderContext = contentAnalyzerRequestBuilderContext;
    }

    public ContentAnalyzerRequestsDto build() {
        ContentAnalyzerRequestsDto contentAnalyzerRequestsDto = new ContentAnalyzerRequestsDto();

        contentAnalyzerRequestBuilderContext.setExecutionInfo(GlobalConfig
                .getV2Property(PropertyKeys.EXECUTION_INFO_CONFIG_KEY));

        contentAnalyzerRequestsDto.setName(GlobalConfig
                .getV2Property(PropertyKeys.NAME_CONFIG_KEY));
        contentAnalyzerRequestsDto.setInvocationMode(GlobalConfig
                .getV2Property(PropertyKeys.INVOCATION_MODE_CONFIG_KEY));
        contentAnalyzerRequestsDto.setGetInvocationbatch(Boolean.parseBoolean(GlobalConfig
                .getV2Property(PropertyKeys.INVOCATION_BATCH_CONFIG_KEY)));
        contentAnalyzerRequestsDto.setInResponse(Boolean.parseBoolean(GlobalConfig
                .getV2Property(PropertyKeys.IN_RESPONSE_CONFIG_KEY)));

        EnginesDtoBuilder enginesDtoBuilder = new EnginesDtoBuilder(contentAnalyzerRequestBuilderContext);
        contentAnalyzerRequestsDto.setEngines(enginesDtoBuilder.build());

        return contentAnalyzerRequestsDto;
    }

    private static class PropertyKeys {
        private static final String NAME_CONFIG_KEY = "v2.htmlToPdf.name";
        private static final String INVOCATION_MODE_CONFIG_KEY = "v2.htmlToPdf.invocation_mode";
        private static final String INVOCATION_BATCH_CONFIG_KEY = "v2.htmlToPdf.invocation_batch";
        private static final String IN_RESPONSE_CONFIG_KEY = "v2.htmlToPdf.in_response";
        private static final String EXECUTION_INFO_CONFIG_KEY = "v2.htmlToPdf.engines.execution_info.engine";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy