/**
 * Copyright (c) 2000-2017 Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * pSubscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */

package com.liferay.portlet.directory.asset;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.Organization;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portlet.asset.model.AssetRenderer;
import com.liferay.portlet.asset.model.BaseAssetRendererFactory;

/**
 * @author Ricardo Couso
 */
public class OrganizationAssetRendererFactory extends BaseAssetRendererFactory {

	public static final String TYPE = "organization";

	@Override
	public AssetRenderer getAssetRenderer(long classPK, int type)
		throws PortalException, SystemException {

		Organization organization =
			OrganizationLocalServiceUtil.getOrganization(classPK);

		OrganizationAssetRenderer organizationAssetRenderer =
			new OrganizationAssetRenderer(organization);

		organizationAssetRenderer.setAssetRendererType(type);

		return organizationAssetRenderer;
	}

	@Override
	public String getClassName() { return Organization.class.getName(); }

	@Override
	public boolean isSelectable() {
		return _SELECTABLE;
	}

	@Override
	public String getType() { return TYPE; }

	private static final boolean _SELECTABLE = false;

}