AEMFormsManagerConfiguration.java 3.13 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.jcr.RepositoryException
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.commons.osgi.OsgiUtil
 *  org.osgi.service.component.ComponentContext
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
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.Property;
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=1, immediate=1, label="FormsManager Configuration", description="Configuration for Forms Manager")
@Service(value={AEMFormsManagerConfiguration.class})
public class AEMFormsManagerConfiguration {
    protected final Logger log;
    private static final boolean DEFAULT_INCLUDE_OOTB_TEMPLATES = true;
    private static final boolean DEFAULT_INCLUDE_DEPRECATED_TEMPLATES = false;
    private boolean includeOOTBTemplates;
    private boolean includeDeprecatedTemplates;
    @Property(boolValue={1}, 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 true")
    private static final String PROPERTY_INCLUDE_OOTB_TEMPLATES = "formsManagerConfig.includeOOTBTemplates";
    @Property(boolValue={0}, 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 false")
    private static final String PROPERTY_INCLUDE_DEPRECATED_TEMPLATES = "formsManagerConfig.includeDeprecatedTemplates";

    public AEMFormsManagerConfiguration() {
        this.log = LoggerFactory.getLogger(this.getClass());
        this.includeOOTBTemplates = true;
        this.includeDeprecatedTemplates = false;
    }

    protected void activate(ComponentContext context) throws RepositoryException {
        Dictionary props = context.getProperties();
        try {
            this.setIncludeOOTBTemplates(OsgiUtil.toBoolean(props.get("formsManagerConfig.includeOOTBTemplates"), (boolean)true));
            this.setIncludeDeprecatedTemplates(OsgiUtil.toBoolean(props.get("formsManagerConfig.includeDeprecatedTemplates"), (boolean)false));
        }
        catch (Exception e) {
            throw new RepositoryException((Throwable)e);
        }
    }

    public boolean isIncludeOOTBTemplates() {
        return this.includeOOTBTemplates;
    }

    public boolean isIncludeDeprecatedTemplates() {
        return this.includeDeprecatedTemplates;
    }

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

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