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 List<AssetEntry> getAssetEntries(
077                            PortletPreferences preferences, Layout layout, long scopeGroupId,
078                            int max, boolean checkPermission)
079                    throws PortalException, SystemException;
080    
081            public List<AssetEntry> getAssetEntries(
082                            PortletRequest portletRequest,
083                            PortletPreferences portletPreferences,
084                            PermissionChecker permissionChecker, long[] groupIds,
085                            long[] assetCategoryIds, String[] assetEntryXmls,
086                            String[] assetTagNames, boolean deleteMissingAssetEntries,
087                            boolean checkPermission)
088                    throws Exception;
089    
090            public List<AssetEntry> getAssetEntries(
091                            PortletRequest portletRequest,
092                            PortletPreferences portletPreferences,
093                            PermissionChecker permissionChecker, long[] groupIds,
094                            String[] assetEntryXmls, boolean deleteMissingAssetEntries,
095                            boolean checkPermission)
096                    throws Exception;
097    
098            public AssetEntryQuery getAssetEntryQuery(
099                            PortletPreferences portletPreferences, long[] scopeGroupIds)
100                    throws PortalException, SystemException;
101    
102            public String[] getAssetTagNames(
103                            PortletPreferences portletPreferences, long scopeGroupId)
104                    throws Exception;
105    
106            public String getClassName(AssetRendererFactory assetRendererFactory);
107    
108            public long[] getClassNameIds(
109                    PortletPreferences portletPreferences, long[] availableClassNameIds);
110    
111            public Long[] getClassTypeIds(
112                    PortletPreferences portletPreferences, String className,
113                    Long[] availableClassTypeIds);
114    
115            public Map<Locale, String> getEmailAssetEntryAddedBodyMap(
116                    PortletPreferences preferences);
117    
118            public boolean getEmailAssetEntryAddedEnabled(
119                    PortletPreferences preferences);
120    
121            public Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
122                    PortletPreferences preferences);
123    
124            public String getEmailFromAddress(
125                            PortletPreferences preferences, long companyId)
126                    throws SystemException;
127    
128            public String getEmailFromName(
129                            PortletPreferences preferences, long companyId)
130                    throws SystemException;
131    
132            public long getGroupIdFromScopeId(
133                            String scopeId, long siteGroupId, boolean privateLayout)
134                    throws PortalException, SystemException;
135    
136            public long[] getGroupIds(
137                    PortletPreferences portletPreferences, long scopeGroupId,
138                    Layout layout);
139    
140            public long getRecentFolderId(
141                    PortletRequest portletRequest, String className);
142    
143            public String getScopeId(Group group, long scopeGroupId)
144                    throws PortalException, SystemException;
145    
146            public boolean isScopeIdSelectable(
147                            PermissionChecker permissionChecker, String scopeId,
148                            long companyGroupId, Layout layout)
149                    throws PortalException, SystemException;
150    
151            public boolean isSubscribed(
152                            long companyId, long userId, long plid, String portletId)
153                    throws PortalException, SystemException;
154    
155            public void notifySubscribers(
156                            PortletPreferences preferences, long plid, String portletId,
157                            List<AssetEntry> assetEntries)
158                    throws PortalException, SystemException;
159    
160            public void removeAndStoreSelection(
161                            List<String> assetEntryUuids, PortletPreferences portletPreferences)
162                    throws Exception;
163    
164            public void removeRecentFolderId(
165                    PortletRequest portletRequest, String className, long classPK);
166    
167            public void subscribe(
168                            PermissionChecker permissionChecker, long groupId, long plid,
169                            String portletId)
170                    throws PortalException, SystemException;
171    
172            public void unsubscribe(
173                            PermissionChecker permissionChecker, long plid, String portletId)
174                    throws PortalException, SystemException;
175    
176    }