001    /**
002     * Copyright (c) 2000-2013 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 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 AssetEntryQuery getAssetEntryQuery(
102                            PortletPreferences portletPreferences, long[] scopeGroupIds)
103                    throws PortalException, SystemException;
104    
105            public String[] getAssetTagNames(
106                            PortletPreferences portletPreferences, long scopeGroupId)
107                    throws Exception;
108    
109            public String getClassName(AssetRendererFactory assetRendererFactory);
110    
111            public long[] getClassNameIds(
112                    PortletPreferences portletPreferences, long[] availableClassNameIds);
113    
114            public Long[] getClassTypeIds(
115                    PortletPreferences portletPreferences, String className,
116                    Long[] availableClassTypeIds);
117    
118            public Map<Locale, String> getEmailAssetEntryAddedBodyMap(
119                    PortletPreferences portletPreferences);
120    
121            public boolean getEmailAssetEntryAddedEnabled(
122                    PortletPreferences portletPreferences);
123    
124            public Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
125                    PortletPreferences portletPreferences);
126    
127            public String getEmailFromAddress(
128                            PortletPreferences portletPreferences, long companyId)
129                    throws SystemException;
130    
131            public String getEmailFromName(
132                            PortletPreferences portletPreferences, long companyId)
133                    throws SystemException;
134    
135            public long getGroupIdFromScopeId(
136                            String scopeId, long siteGroupId, boolean privateLayout)
137                    throws PortalException, SystemException;
138    
139            public long[] getGroupIds(
140                    PortletPreferences portletPreferences, long scopeGroupId,
141                    Layout layout);
142    
143            public long getRecentFolderId(
144                    PortletRequest portletRequest, String className);
145    
146            public String getScopeId(Group group, long scopeGroupId)
147                    throws PortalException, SystemException;
148    
149            long getSubscriptionClassPK(long plid, String portletId)
150                    throws PortalException, SystemException;
151    
152            public boolean isScopeIdSelectable(
153                            PermissionChecker permissionChecker, String scopeId,
154                            long companyGroupId, Layout layout)
155                    throws PortalException, SystemException;
156    
157            public boolean isSubscribed(
158                            long companyId, long userId, long plid, String portletId)
159                    throws PortalException, SystemException;
160    
161            public void notifySubscribers(
162                            PortletPreferences portletPreferences, long plid, String portletId,
163                            List<AssetEntry> assetEntries)
164                    throws PortalException, SystemException;
165    
166            public void processAssetEntryQuery(
167                            User user, PortletPreferences portletPreferences,
168                            AssetEntryQuery assetEntryQuery)
169                    throws Exception;
170    
171            public void registerAssetQueryProcessor(
172                    String name, AssetEntryQueryProcessor assetQueryProcessor);
173    
174            public void removeAndStoreSelection(
175                            List<String> assetEntryUuids, PortletPreferences portletPreferences)
176                    throws Exception;
177    
178            public void removeRecentFolderId(
179                    PortletRequest portletRequest, String className, long classPK);
180    
181            public void subscribe(
182                            PermissionChecker permissionChecker, long groupId, long plid,
183                            String portletId)
184                    throws PortalException, SystemException;
185    
186            public void unregisterAssetQueryProcessor(
187                    String assetQueryProcessorClassName);
188    
189            public void unsubscribe(
190                            PermissionChecker permissionChecker, long plid, String portletId)
191                    throws PortalException, SystemException;
192    
193    }