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            /**
100             * @deprecated As of 7.0.0, with no direct replacement
101             */
102            @Deprecated
103            public String getIconPath(PortletRequest portletRequest);
104    
105            public String getPortletId();
106    
107            public String getSubtypeTitle(Locale locale);
108    
109            public String getType();
110    
111            public String getTypeName(Locale locale);
112    
113            /**
114             * @deprecated As of 7.0.0, replaced by {@link #getTypeName(Locale)}
115             */
116            @Deprecated
117            public String getTypeName(Locale locale, boolean hasSubtypes);
118    
119            public String getTypeName(Locale locale, long subtypeId);
120    
121            /**
122             * @deprecated As of 7.0.0, replaced by {@link
123             *             #getURLAdd(LiferayPortletRequest, LiferayPortletResponse,
124             *             long)}
125             */
126            @Deprecated
127            public PortletURL getURLAdd(
128                            LiferayPortletRequest liferayPortletRequest,
129                            LiferayPortletResponse liferayPortletResponse)
130                    throws PortalException;
131    
132            public PortletURL getURLAdd(
133                            LiferayPortletRequest liferayPortletRequest,
134                            LiferayPortletResponse liferayPortletResponse, long classTypeId)
135                    throws PortalException;
136    
137            public PortletURL getURLView(
138                            LiferayPortletResponse liferayPortletResponse,
139                            WindowState windowState)
140                    throws PortalException;
141    
142            public boolean hasAddPermission(
143                            PermissionChecker permissionChecker, long groupId, long classTypeId)
144                    throws Exception;
145    
146            /**
147             * @deprecated As of 7.0.0, see {@link
148             *             com.liferay.portlet.asset.model.ClassTypeReader}
149             */
150            @Deprecated
151            public boolean hasClassTypeFieldNames(long classTypeId, Locale locale)
152                    throws Exception;
153    
154            public boolean hasPermission(
155                            PermissionChecker permissionChecker, long entryClassPK,
156                            String actionId)
157                    throws Exception;
158    
159            public boolean isActive(long companyId);
160    
161            public boolean isCategorizable();
162    
163            public boolean isLinkable();
164    
165            public boolean isListable(long classPK);
166    
167            public boolean isSearchable();
168    
169            public boolean isSelectable();
170    
171            public boolean isSupportsClassTypes();
172    
173            public void setClassName(String className);
174    
175            public void setPortletId(String portletId);
176    
177    }