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                    long[] groupIds, long[] classNameIds, String keywords, String userName,
084                    String title, String description, boolean advancedSearch,
085                    boolean andOperator, int start, int end, String orderByCol1,
086                    String orderByCol2, String orderByType1, String orderByType2);
087    
088            public List<AssetEntry> getAssetEntries(
089                            PortletPreferences portletPreferences, Layout layout,
090                            long scopeGroupId, int max, boolean checkPermission)
091                    throws PortalException;
092    
093            public List<AssetEntry> getAssetEntries(
094                            PortletRequest portletRequest,
095                            PortletPreferences portletPreferences,
096                            PermissionChecker permissionChecker, long[] groupIds,
097                            boolean deleteMissingAssetEntries, boolean checkPermission)
098                    throws Exception;
099    
100            public List<AssetEntry> getAssetEntries(
101                            PortletRequest portletRequest,
102                            PortletPreferences portletPreferences,
103                            PermissionChecker permissionChecker, long[] groupIds,
104                            long[] allCategoryIds, String[] allTagNames,
105                            boolean deleteMissingAssetEntries, boolean checkPermission)
106                    throws Exception;
107    
108            /**
109             * @deprecated As of 7.0.0, replaced by {@link
110             *             AssetPublisher#getAssetEntries( PortletRequest,
111             *             PortletPreferences, PermissionChecker, long[], long[],
112             *             String[], boolean , boolean)}
113             */
114            @Deprecated
115            public List<AssetEntry> getAssetEntries(
116                            PortletRequest portletRequest,
117                            PortletPreferences portletPreferences,
118                            PermissionChecker permissionChecker, long[] groupIds,
119                            long[] assetCategoryIds, String[] assetEntryXmls,
120                            String[] assetTagNames, boolean deleteMissingAssetEntries,
121                            boolean checkPermission)
122                    throws Exception;
123    
124            /**
125             * @deprecated As of 7.0.0, replaced by {@link
126             *             AssetPublisher#getAssetEntries( PortletRequest,
127             *             PortletPreferences, PermissionChecker, long[], boolean,
128             *             boolean)}
129             */
130            @Deprecated
131            public List<AssetEntry> getAssetEntries(
132                            PortletRequest portletRequest,
133                            PortletPreferences portletPreferences,
134                            PermissionChecker permissionChecker, long[] groupIds,
135                            String[] assetEntryXmls, boolean deleteMissingAssetEntries,
136                            boolean checkPermission)
137                    throws Exception;
138    
139            public int getAssetEntriesCount(
140                    long[] groupIds, long[] classNameIds, String keywords, String userName,
141                    String title, String description, boolean advancedSearch,
142                    boolean andOperator, int start, int end);
143    
144            /**
145             * @deprecated As of 7.0.0, replaced by {@link
146             *             AssetPublisher#getAssetEntryQuery(PortletPreferences, long[],
147             *             long[], String[])}
148             */
149            @Deprecated
150            public AssetEntryQuery getAssetEntryQuery(
151                            PortletPreferences portletPreferences, long[] siteGroupIds)
152                    throws PortalException;
153    
154            public AssetEntryQuery getAssetEntryQuery(
155                            PortletPreferences portletPreferences, long[] scopeGroupIds,
156                            long[] overrideAllAssetCategoryIds,
157                            String[] overrideAllAssetTagNames)
158                    throws PortalException;
159    
160            public String[] getAssetTagNames(
161                    PortletPreferences portletPreferences) throws Exception;
162    
163            /**
164             * @deprecated As of 7.0.0, replaced by {@link
165             *             AssetPublisher#getAssetTagNames(PortletPreferences)}
166             */
167            @Deprecated
168            public String[] getAssetTagNames(
169                            PortletPreferences portletPreferences, long scopeGroupId)
170                    throws Exception;
171    
172            public String getClassName(AssetRendererFactory assetRendererFactory);
173    
174            public long[] getClassNameIds(
175                    PortletPreferences portletPreferences, long[] availableClassNameIds);
176    
177            public Long[] getClassTypeIds(
178                    PortletPreferences portletPreferences, String className,
179                    List<ClassType> availableClassTypes);
180    
181            public Long[] getClassTypeIds(
182                    PortletPreferences portletPreferences, String className,
183                    Long[] availableClassTypeIds);
184    
185            public Map<Locale, String> getEmailAssetEntryAddedBodyMap(
186                    PortletPreferences portletPreferences);
187    
188            public boolean getEmailAssetEntryAddedEnabled(
189                    PortletPreferences portletPreferences);
190    
191            public Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
192                    PortletPreferences portletPreferences);
193    
194            public Map<String, String> getEmailDefinitionTerms(
195                    PortletRequest portletRequest, String emailFromAddress,
196                    String emailFromName);
197    
198            public String getEmailFromAddress(
199                    PortletPreferences portletPreferences, long companyId);
200    
201            public String getEmailFromName(
202                    PortletPreferences portletPreferences, long companyId);
203    
204            public long getGroupIdFromScopeId(
205                            String scopeId, long siteGroupId, boolean privateLayout)
206                    throws PortalException;
207    
208            public long[] getGroupIds(
209                    PortletPreferences portletPreferences, long scopeGroupId,
210                    Layout layout);
211    
212            public long getRecentFolderId(
213                    PortletRequest portletRequest, String className);
214    
215            public String getScopeId(Group group, long scopeGroupId)
216                    throws PortalException;
217    
218            public long getSubscriptionClassPK(long plid, String portletId)
219                    throws PortalException;
220    
221            public boolean isScopeIdSelectable(
222                            PermissionChecker permissionChecker, String scopeId,
223                            long companyGroupId, Layout layout)
224                    throws PortalException;
225    
226            public boolean isSubscribed(
227                            long companyId, long userId, long plid, String portletId)
228                    throws PortalException;
229    
230            public void notifySubscribers(
231                            PortletPreferences portletPreferences, long plid, String portletId,
232                            List<AssetEntry> assetEntries)
233                    throws PortalException;
234    
235            public void processAssetEntryQuery(
236                            User user, PortletPreferences portletPreferences,
237                            AssetEntryQuery assetEntryQuery)
238                    throws Exception;
239    
240            public void registerAssetQueryProcessor(
241                    String name, AssetEntryQueryProcessor assetQueryProcessor);
242    
243            public void removeAndStoreSelection(
244                            List<String> assetEntryUuids, PortletPreferences portletPreferences)
245                    throws Exception;
246    
247            public void removeRecentFolderId(
248                    PortletRequest portletRequest, String className, long classPK);
249    
250            public void subscribe(
251                            PermissionChecker permissionChecker, long groupId, long plid,
252                            String portletId)
253                    throws PortalException;
254    
255            public void unregisterAssetQueryProcessor(
256                    String assetQueryProcessorClassName);
257    
258            public void unsubscribe(
259                            PermissionChecker permissionChecker, long plid, String portletId)
260                    throws PortalException;
261    
262    }