001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.asset.model;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
019    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
020    import com.liferay.portal.kernel.util.Tuple;
021    import com.liferay.portal.security.permission.PermissionChecker;
022    
023    import java.util.List;
024    import java.util.Locale;
025    import java.util.Map;
026    
027    import javax.portlet.PortletRequest;
028    import javax.portlet.PortletURL;
029    import javax.portlet.WindowState;
030    
031    /**
032     * @author Jorge Ferrer
033     * @author Juan Fern??ndez
034     * @author Raymond Aug??
035     * @author Sergio Gonz??lez
036     */
037    public interface AssetRendererFactory<T> {
038    
039            public static final int TYPE_LATEST = 0;
040    
041            public static final int TYPE_LATEST_APPROVED = 1;
042    
043            public AssetEntry getAssetEntry(long assetEntryId) throws PortalException;
044    
045            public AssetEntry getAssetEntry(String classNameId, long classPK)
046                    throws PortalException;
047    
048            public AssetRenderer<T> getAssetRenderer(long classPK)
049                    throws PortalException;
050    
051            public AssetRenderer<T> getAssetRenderer(long classPK, int type)
052                    throws PortalException;
053    
054            public AssetRenderer<T> getAssetRenderer(long groupId, String urlTitle)
055                    throws PortalException;
056    
057            public String getClassName();
058    
059            public long getClassNameId();
060    
061            /**
062             * @deprecated As of 7.0.0, see {@link
063             *             com.liferay.portlet.asset.model.ClassTypeReader}
064             */
065            @Deprecated
066            public Tuple getClassTypeFieldName(
067                            long classTypeId, String fieldName, Locale locale)
068                    throws Exception;
069    
070            /**
071             * @deprecated As of 7.0.0, see {@link
072             *             com.liferay.portlet.asset.model.ClassTypeReader}
073             */
074            @Deprecated
075            public List<Tuple> getClassTypeFieldNames(
076                            long classTypeId, Locale locale, int start, int end)
077                    throws Exception;
078    
079            /**
080             * @deprecated As of 7.0.0, see {@link
081             *             com.liferay.portlet.asset.model.ClassTypeReader}
082             */
083            @Deprecated
084            public int getClassTypeFieldNamesCount(long classTypeId, Locale locale)
085                    throws Exception;
086    
087            public ClassTypeReader getClassTypeReader();
088    
089            /**
090             * @deprecated As of 7.0.0, see {@link
091             *             com.liferay.portlet.asset.model.ClassTypeReader}
092             */
093            @Deprecated
094            public Map<Long, String> getClassTypes(long[] groupIds, Locale locale)
095                    throws Exception;
096    
097            public String getIconCssClass();
098    
099            public String getIconPath(PortletRequest portletRequest);
100    
101            public String getPortletId();
102    
103            public String getSubtypeTitle(Locale locale);
104    
105            public String getType();
106    
107            public String getTypeName(Locale locale);
108    
109            /**
110             * @deprecated As of 7.0.0, replaced by {@link #getTypeName(Locale)}
111             */
112            @Deprecated
113            public String getTypeName(Locale locale, boolean hasSubtypes);
114    
115            public String getTypeName(Locale locale, long subtypeId);
116    
117            /**
118             * @deprecated As of 7.0.0, replaced by {@link
119             *             #getURLAdd(LiferayPortletRequest, LiferayPortletResponse,
120             *             long)}
121             */
122            @Deprecated
123            public PortletURL getURLAdd(
124                            LiferayPortletRequest liferayPortletRequest,
125                            LiferayPortletResponse liferayPortletResponse)
126                    throws PortalException;
127    
128            public PortletURL getURLAdd(
129                            LiferayPortletRequest liferayPortletRequest,
130                            LiferayPortletResponse liferayPortletResponse, long classTypeId)
131                    throws PortalException;
132    
133            public PortletURL getURLView(
134                            LiferayPortletResponse liferayPortletResponse,
135                            WindowState windowState)
136                    throws PortalException;
137    
138            public boolean hasAddPermission(
139                            PermissionChecker permissionChecker, long groupId, long classTypeId)
140                    throws Exception;
141    
142            /**
143             * @deprecated As of 7.0.0, see {@link
144             *             com.liferay.portlet.asset.model.ClassTypeReader}
145             */
146            @Deprecated
147            public boolean hasClassTypeFieldNames(long classTypeId, Locale locale)
148                    throws Exception;
149    
150            public boolean hasPermission(
151                            PermissionChecker permissionChecker, long entryClassPK,
152                            String actionId)
153                    throws Exception;
154    
155            public boolean isActive(long companyId);
156    
157            public boolean isCategorizable();
158    
159            public boolean isLinkable();
160    
161            public boolean isListable(long classPK);
162    
163            public boolean isSearchable();
164    
165            public boolean isSelectable();
166    
167            public boolean isSupportsClassTypes();
168    
169            public void setClassName(String className);
170    
171            public void setPortletId(String portletId);
172    
173    }