001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.assetpublisher.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.Group;
020    import com.liferay.portal.model.Layout;
021    import com.liferay.portal.model.User;
022    import com.liferay.portal.security.permission.PermissionChecker;
023    import com.liferay.portal.theme.ThemeDisplay;
024    import com.liferay.portlet.asset.model.AssetEntry;
025    import com.liferay.portlet.asset.model.AssetRendererFactory;
026    import com.liferay.portlet.asset.service.persistence.AssetEntryQuery;
027    
028    import java.util.List;
029    import java.util.Locale;
030    import java.util.Map;
031    
032    import javax.portlet.PortletPreferences;
033    import javax.portlet.PortletRequest;
034    
035    /**
036     * @author Eudaldo Alonso
037     */
038    public interface AssetPublisher {
039    
040            public static final String SCOPE_ID_CHILD_GROUP_PREFIX = "ChildGroup_";
041    
042            public static final String SCOPE_ID_GROUP_PREFIX = "Group_";
043    
044            public static final String SCOPE_ID_LAYOUT_PREFIX = "Layout_";
045    
046            public static final String SCOPE_ID_LAYOUT_UUID_PREFIX = "LayoutUuid_";
047    
048            public static final String SCOPE_ID_PARENT_GROUP_PREFIX = "ParentGroup_";
049    
050            public void addAndStoreSelection(
051                            PortletRequest portletRequest, String className, long classPK,
052                            int assetEntryOrder)
053                    throws Exception;
054    
055            public void addRecentFolderId(
056                    PortletRequest portletRequest, String className, long classPK);
057    
058            public void addSelection(
059                            PortletRequest portletRequest,
060                            PortletPreferences portletPreferences, String portletId)
061                    throws Exception;
062    
063            public void addSelection(
064                            ThemeDisplay themeDisplay, PortletPreferences portletPreferences,
065                            String portletId, long assetEntryId, int assetEntryOrder,
066                            String assetEntryType)
067                    throws Exception;
068    
069            public void addUserAttributes(
070                            User user, String[] customUserAttributeNames,
071                            AssetEntryQuery assetEntryQuery)
072                    throws Exception;
073    
074            public void checkAssetEntries() throws Exception;
075    
076            public long[] getAssetCategoryIds(PortletPreferences portletPreferences)
077                    throws Exception;
078    
079            public List<AssetEntry> getAssetEntries(
080                            PortletPreferences portletPreferences, Layout layout,
081                            long scopeGroupId, int max, boolean checkPermission)
082                    throws PortalException, SystemException;
083    
084            public List<AssetEntry> getAssetEntries(
085                            PortletRequest portletRequest,
086                            PortletPreferences portletPreferences,
087                            PermissionChecker permissionChecker, long[] groupIds,
088                            long[] assetCategoryIds, String[] assetEntryXmls,
089                            String[] assetTagNames, boolean deleteMissingAssetEntries,
090                            boolean checkPermission)
091                    throws Exception;
092    
093            public List<AssetEntry> getAssetEntries(
094                            PortletRequest portletRequest,
095                            PortletPreferences portletPreferences,
096                            PermissionChecker permissionChecker, long[] groupIds,
097                            String[] assetEntryXmls, boolean deleteMissingAssetEntries,
098                            boolean checkPermission)
099                    throws Exception;
100    
101            public List<AssetEntry> getAssetEntries(
102                            PortletRequest portletRequest,
103                            PortletPreferences portletPreferences,
104                            PermissionChecker permissionChecker, long[] groupIds,
105                            String[] assetEntryXmls, boolean deleteMissingAssetEntries,
106                            boolean checkPermission, boolean includeNonVisibleAssets)
107                    throws Exception;
108    
109            public AssetEntryQuery getAssetEntryQuery(
110                            PortletPreferences portletPreferences, long[] scopeGroupIds)
111                    throws PortalException, SystemException;
112    
113            public String[] getAssetTagNames(
114                            PortletPreferences portletPreferences, long scopeGroupId)
115                    throws Exception;
116    
117            public String getClassName(AssetRendererFactory assetRendererFactory);
118    
119            public long[] getClassNameIds(
120                    PortletPreferences portletPreferences, long[] availableClassNameIds);
121    
122            public Long[] getClassTypeIds(
123                    PortletPreferences portletPreferences, String className,
124                    Long[] availableClassTypeIds);
125    
126            public Map<Locale, String> getEmailAssetEntryAddedBodyMap(
127                    PortletPreferences portletPreferences);
128    
129            public boolean getEmailAssetEntryAddedEnabled(
130                    PortletPreferences portletPreferences);
131    
132            public Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
133                    PortletPreferences portletPreferences);
134    
135            public String getEmailFromAddress(
136                            PortletPreferences portletPreferences, long companyId)
137                    throws SystemException;
138    
139            public String getEmailFromName(
140                            PortletPreferences portletPreferences, long companyId)
141                    throws SystemException;
142    
143            public long getGroupIdFromScopeId(
144                            String scopeId, long siteGroupId, boolean privateLayout)
145                    throws PortalException, SystemException;
146    
147            public long[] getGroupIds(
148                    PortletPreferences portletPreferences, long scopeGroupId,
149                    Layout layout);
150    
151            public long getRecentFolderId(
152                    PortletRequest portletRequest, String className);
153    
154            public String getScopeId(Group group, long scopeGroupId)
155                    throws PortalException, SystemException;
156    
157            long getSubscriptionClassPK(long plid, String portletId)
158                    throws PortalException, SystemException;
159    
160            public long getSubscriptionClassPK(
161                            long ownerId, int ownerType, long plid, String portletId)
162                    throws PortalException, SystemException;
163    
164            public boolean isScopeIdSelectable(
165                            PermissionChecker permissionChecker, String scopeId,
166                            long companyGroupId, Layout layout)
167                    throws PortalException, SystemException;
168    
169            public boolean isSubscribed(
170                            long companyId, long userId, long plid, String portletId)
171                    throws PortalException, SystemException;
172    
173            public void notifySubscribers(
174                            PortletPreferences portletPreferences, long plid, String portletId,
175                            List<AssetEntry> assetEntries)
176                    throws PortalException, SystemException;
177    
178            public void processAssetEntryQuery(
179                            User user, PortletPreferences portletPreferences,
180                            AssetEntryQuery assetEntryQuery)
181                    throws Exception;
182    
183            public void registerAssetQueryProcessor(
184                    String name, AssetEntryQueryProcessor assetQueryProcessor);
185    
186            public void removeAndStoreSelection(
187                            List<String> assetEntryUuids, PortletPreferences portletPreferences)
188                    throws Exception;
189    
190            public void removeRecentFolderId(
191                    PortletRequest portletRequest, String className, long classPK);
192    
193            public void subscribe(
194                            PermissionChecker permissionChecker, long groupId, long plid,
195                            String portletId)
196                    throws PortalException, SystemException;
197    
198            public void unregisterAssetQueryProcessor(
199                    String assetQueryProcessorClassName);
200    
201            public void unsubscribe(
202                            PermissionChecker permissionChecker, long plid, String portletId)
203                    throws PortalException, SystemException;
204    
205    }