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