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.assetpublisher.util;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.model.Group;
021    import com.liferay.portal.model.Layout;
022    import com.liferay.portal.model.User;
023    import com.liferay.portal.security.permission.PermissionChecker;
024    import com.liferay.portal.theme.ThemeDisplay;
025    import com.liferay.portlet.asset.model.AssetEntry;
026    import com.liferay.portlet.asset.model.AssetRendererFactory;
027    import com.liferay.portlet.asset.model.ClassType;
028    import com.liferay.portlet.asset.service.persistence.AssetEntryQuery;
029    
030    import java.util.List;
031    import java.util.Locale;
032    import java.util.Map;
033    
034    import javax.portlet.PortletPreferences;
035    import javax.portlet.PortletRequest;
036    
037    /**
038     * @author Eudaldo Alonso
039     */
040    @ProviderType
041    public interface AssetPublisher {
042    
043            public static final String SCOPE_ID_CHILD_GROUP_PREFIX = "ChildGroup_";
044    
045            public static final String SCOPE_ID_GROUP_PREFIX = "Group_";
046    
047            public static final String SCOPE_ID_LAYOUT_PREFIX = "Layout_";
048    
049            public static final String SCOPE_ID_LAYOUT_UUID_PREFIX = "LayoutUuid_";
050    
051            public static final String SCOPE_ID_PARENT_GROUP_PREFIX = "ParentGroup_";
052    
053            public void addAndStoreSelection(
054                            PortletRequest portletRequest, String className, long classPK,
055                            int assetEntryOrder)
056                    throws Exception;
057    
058            public void addRecentFolderId(
059                    PortletRequest portletRequest, String className, long classPK);
060    
061            public void addSelection(
062                            PortletRequest portletRequest,
063                            PortletPreferences portletPreferences, String portletId)
064                    throws Exception;
065    
066            public void addSelection(
067                            ThemeDisplay themeDisplay, PortletPreferences portletPreferences,
068                            String portletId, long assetEntryId, int assetEntryOrder,
069                            String assetEntryType)
070                    throws Exception;
071    
072            public void addUserAttributes(
073                            User user, String[] customUserAttributeNames,
074                            AssetEntryQuery assetEntryQuery)
075                    throws Exception;
076    
077            public void checkAssetEntries() throws Exception;
078    
079            public long[] getAssetCategoryIds(PortletPreferences portletPreferences)
080                    throws Exception;
081    
082            public List<AssetEntry> getAssetEntries(
083                            PortletPreferences portletPreferences, Layout layout,
084                            long scopeGroupId, int max, boolean checkPermission)
085                    throws PortalException;
086    
087            public List<AssetEntry> getAssetEntries(
088                            PortletRequest portletRequest,
089                            PortletPreferences portletPreferences,
090                            PermissionChecker permissionChecker, long[] groupIds,
091                            boolean deleteMissingAssetEntries, boolean checkPermission)
092                    throws Exception;
093    
094            public List<AssetEntry> getAssetEntries(
095                            PortletRequest portletRequest,
096                            PortletPreferences portletPreferences,
097                            PermissionChecker permissionChecker, long[] groupIds,
098                            long[] allCategoryIds, String[] allTagNames,
099                            boolean deleteMissingAssetEntries, boolean checkPermission)
100                    throws Exception;
101    
102            /**
103             * @deprecated As of 7.0.0, replaced by {@link
104             *             AssetPublisher#getAssetEntries( PortletRequest,
105             *             PortletPreferences, PermissionChecker, long[], long[],
106             *             String[], boolean , boolean)}
107             */
108            @Deprecated
109            public List<AssetEntry> getAssetEntries(
110                            PortletRequest portletRequest,
111                            PortletPreferences portletPreferences,
112                            PermissionChecker permissionChecker, long[] groupIds,
113                            long[] assetCategoryIds, String[] assetEntryXmls,
114                            String[] assetTagNames, boolean deleteMissingAssetEntries,
115                            boolean checkPermission)
116                    throws Exception;
117    
118            /**
119             * @deprecated As of 7.0.0, replaced by {@link
120             *             AssetPublisher#getAssetEntries( PortletRequest,
121             *             PortletPreferences, PermissionChecker, long[], boolean,
122             *             boolean)}
123             */
124            @Deprecated
125            public List<AssetEntry> getAssetEntries(
126                            PortletRequest portletRequest,
127                            PortletPreferences portletPreferences,
128                            PermissionChecker permissionChecker, long[] groupIds,
129                            String[] assetEntryXmls, boolean deleteMissingAssetEntries,
130                            boolean checkPermission)
131                    throws Exception;
132    
133            /**
134             * @deprecated As of 7.0.0, replaced by {@link
135             *             AssetPublisher#getAssetEntryQuery(PortletPreferences, long[],
136             *             long[], String[])}
137             */
138            @Deprecated
139            public AssetEntryQuery getAssetEntryQuery(
140                            PortletPreferences portletPreferences, long[] siteGroupIds)
141                    throws PortalException;
142    
143            public AssetEntryQuery getAssetEntryQuery(
144                            PortletPreferences portletPreferences, long[] scopeGroupIds,
145                            long[] overrideAllAssetCategoryIds,
146                            String[] overrideAllAssetTagNames)
147                    throws PortalException;
148    
149            public String[] getAssetTagNames(
150                    PortletPreferences portletPreferences) throws Exception;
151    
152            /**
153             * @deprecated As of 7.0.0, replaced by {@link
154             *             AssetPublisher#getAssetTagNames(PortletPreferences)}
155             */
156            @Deprecated
157            public String[] getAssetTagNames(
158                            PortletPreferences portletPreferences, long scopeGroupId)
159                    throws Exception;
160    
161            public String getClassName(AssetRendererFactory assetRendererFactory);
162    
163            public long[] getClassNameIds(
164                    PortletPreferences portletPreferences, long[] availableClassNameIds);
165    
166            public Long[] getClassTypeIds(
167                    PortletPreferences portletPreferences, String className,
168                    List<ClassType> availableClassTypes);
169    
170            public Long[] getClassTypeIds(
171                    PortletPreferences portletPreferences, String className,
172                    Long[] availableClassTypeIds);
173    
174            public Map<Locale, String> getEmailAssetEntryAddedBodyMap(
175                    PortletPreferences portletPreferences);
176    
177            public boolean getEmailAssetEntryAddedEnabled(
178                    PortletPreferences portletPreferences);
179    
180            public Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
181                    PortletPreferences portletPreferences);
182    
183            public Map<String, String> getEmailDefinitionTerms(
184                    PortletRequest portletRequest, String emailFromAddress,
185                    String emailFromName);
186    
187            public String getEmailFromAddress(
188                    PortletPreferences portletPreferences, long companyId);
189    
190            public String getEmailFromName(
191                    PortletPreferences portletPreferences, long companyId);
192    
193            public long getGroupIdFromScopeId(
194                            String scopeId, long siteGroupId, boolean privateLayout)
195                    throws PortalException;
196    
197            public long[] getGroupIds(
198                    PortletPreferences portletPreferences, long scopeGroupId,
199                    Layout layout);
200    
201            public long getRecentFolderId(
202                    PortletRequest portletRequest, String className);
203    
204            public String getScopeId(Group group, long scopeGroupId)
205                    throws PortalException;
206    
207            public long getSubscriptionClassPK(long plid, String portletId)
208                    throws PortalException;
209    
210            public boolean isScopeIdSelectable(
211                            PermissionChecker permissionChecker, String scopeId,
212                            long companyGroupId, Layout layout)
213                    throws PortalException;
214    
215            public boolean isSubscribed(
216                            long companyId, long userId, long plid, String portletId)
217                    throws PortalException;
218    
219            public void notifySubscribers(
220                            PortletPreferences portletPreferences, long plid, String portletId,
221                            List<AssetEntry> assetEntries)
222                    throws PortalException;
223    
224            public void processAssetEntryQuery(
225                            User user, PortletPreferences portletPreferences,
226                            AssetEntryQuery assetEntryQuery)
227                    throws Exception;
228    
229            public void registerAssetQueryProcessor(
230                    String name, AssetEntryQueryProcessor assetQueryProcessor);
231    
232            public void removeAndStoreSelection(
233                            List<String> assetEntryUuids, PortletPreferences portletPreferences)
234                    throws Exception;
235    
236            public void removeRecentFolderId(
237                    PortletRequest portletRequest, String className, long classPK);
238    
239            public void subscribe(
240                            PermissionChecker permissionChecker, long groupId, long plid,
241                            String portletId)
242                    throws PortalException;
243    
244            public void unregisterAssetQueryProcessor(
245                    String assetQueryProcessorClassName);
246    
247            public void unsubscribe(
248                            PermissionChecker permissionChecker, long plid, String portletId)
249                    throws PortalException;
250    
251    }