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