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

com.adobe.forms.foundation.service.util.AssetUtils Maven / Gradle / Ivy

/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2016 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 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.forms.foundation.service.util;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.adobe.forms.foundation.service.FormsFoundationException;

/**
 * 
 * @author hug82342
 *
 */
@Service(value=AssetUtils.class)
@Component
@org.apache.felix.scr.annotations.Properties({
    @org.apache.felix.scr.annotations.Property(name = "connectors.jsoninvoker", boolValue = true),
    @org.apache.felix.scr.annotations.Property(name = "connectors.jsoninvoker.alias", value = "ff.AssetUtils")
})
public class AssetUtils {

	/** Default log. */
	private static final Logger log = LoggerFactory.getLogger(AssetUtils.class);

	@Reference
	FormsFoundationUtils formsFoundationUtils;

	private static final String CM_ROOT_PATH = "/content/apps/cm";
	private static final String FM_ROOT_PATH = "/content/dam/formsanddocuments";
	private static final String TEMPLATE_ROOT_PATH = "/conf";

	public String getDataSource(String path) throws FormsFoundationException{
		String dataSource = "";
		if(path != null && path.startsWith(CM_ROOT_PATH)) {
			log.info("Asset Type belongs to CM");
			dataSource = "fd/cm/ma/gui/components/admin/pagedatasource";
		}
		return dataSource;
	}

	public String getMillerColumnRenderer(String path) throws FormsFoundationException{
		String columnViewRenderer = "granite/ui/components/coral/foundation/form/pathfield/columnitem";
		if(path != null && path.startsWith(CM_ROOT_PATH)) {
			log.info("Asset Type belongs to CM");
			columnViewRenderer = "fd/cm/ma/gui/components/admin/childpagerenderer/childcolumnpage";      
		} else if(path != null && path.startsWith(FM_ROOT_PATH)) {
			log.info("Asset Type belongs to FM");
			columnViewRenderer = "fd/fm/gui/components/admin/childasset/childcolumnpage";
		} else if(path != null && path.startsWith(TEMPLATE_ROOT_PATH)) {
			log.info("Asset Type belongs to Template");
			columnViewRenderer = "cq/gui/components/coral/common/form/templatefield/columnitem";
		}
		return columnViewRenderer;
	}

	public String getThumbnailRenderer(String path) throws FormsFoundationException{
		String thumbnailRenderer = "";
		if(path != null && path.startsWith(CM_ROOT_PATH)) {
			log.info("Asset Type belongs to CM");
			thumbnailRenderer = "fd/cm/ma/gui/components/admin/thumbnail";
		}
		return thumbnailRenderer;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy