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

com.adobe.aem.formsndocuments.config.AEMFormsManagerConfiguration Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2015 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.aem.formsndocuments.config;

import java.util.Dictionary;

import javax.jcr.RepositoryException;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.commons.osgi.OsgiUtil;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component(metatype = true, immediate = true, label = "FormsManager Configuration", description = "Configuration for Forms Manager")
@Service(value = AEMFormsManagerConfiguration.class)
public class AEMFormsManagerConfiguration {

    /** Default log. */
    protected final Logger log = LoggerFactory.getLogger(this.getClass());

    private static final boolean DEFAULT_INCLUDE_OOTB_TEMPLATES = true;
    private static final boolean DEFAULT_INCLUDE_DEPRECATED_TEMPLATES = false;

    private boolean includeOOTBTemplates = DEFAULT_INCLUDE_OOTB_TEMPLATES;

    private boolean includeDeprecatedTemplates = DEFAULT_INCLUDE_DEPRECATED_TEMPLATES;

    @org.apache.felix.scr.annotations.Property(boolValue = DEFAULT_INCLUDE_OOTB_TEMPLATES, label = "Include Out of the box AF And AD Templates", description = " Select this option to include Out of the box Adaptive Form and Adaptive Document Templates. Defaults to "
            + DEFAULT_INCLUDE_OOTB_TEMPLATES)
    private static final String PROPERTY_INCLUDE_OOTB_TEMPLATES = "formsManagerConfig.includeOOTBTemplates";

    @org.apache.felix.scr.annotations.Property(boolValue = DEFAULT_INCLUDE_DEPRECATED_TEMPLATES, label = "Include AEM 6.0 AF Templates", description = " Select this option to include Adaptive Form Templates that were present in AEM 6.0 and are now deprecated in AEM ver 6.2. Defaults to "
            + DEFAULT_INCLUDE_DEPRECATED_TEMPLATES)
    private static final String PROPERTY_INCLUDE_DEPRECATED_TEMPLATES = "formsManagerConfig.includeDeprecatedTemplates";


    /**
     * Activate this component.
     *
     * @param context The component context.
     * @throws RepositoryException
     */
    protected void activate(ComponentContext context) throws RepositoryException {

        @SuppressWarnings("unchecked")
        Dictionary props = context.getProperties();
        try {
            setIncludeOOTBTemplates(OsgiUtil.toBoolean(props.get(PROPERTY_INCLUDE_OOTB_TEMPLATES), DEFAULT_INCLUDE_OOTB_TEMPLATES));
            setIncludeDeprecatedTemplates(OsgiUtil.toBoolean(props.get(PROPERTY_INCLUDE_DEPRECATED_TEMPLATES), DEFAULT_INCLUDE_DEPRECATED_TEMPLATES));
        } catch (Exception e) {
            throw new RepositoryException(e);
        }
    }

    public boolean isIncludeOOTBTemplates() {
        return includeOOTBTemplates;
    }

    public boolean isIncludeDeprecatedTemplates() {
        return includeDeprecatedTemplates;
    }

    public void setIncludeOOTBTemplates(boolean includeOOTBTemplates) {
        this.includeOOTBTemplates = includeOOTBTemplates;
    }

    public void setIncludeDeprecatedTemplates(boolean includeDeprecatedTemplates) {
        this.includeDeprecatedTemplates = includeDeprecatedTemplates;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy