001    /**
002     * Copyright (c) 2000-present 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.sites.kernel.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.model.Group;
019    import com.liferay.portal.model.Layout;
020    import com.liferay.portal.model.LayoutPrototype;
021    import com.liferay.portal.model.LayoutSet;
022    import com.liferay.portal.model.LayoutSetPrototype;
023    import com.liferay.portal.model.User;
024    import com.liferay.portal.security.permission.PermissionChecker;
025    import com.liferay.portal.service.ServiceContext;
026    
027    import java.io.File;
028    import java.io.InputStream;
029    
030    import java.util.List;
031    import java.util.Map;
032    
033    import javax.portlet.ActionRequest;
034    import javax.portlet.ActionResponse;
035    import javax.portlet.PortletPreferences;
036    import javax.portlet.PortletURL;
037    import javax.portlet.RenderRequest;
038    import javax.portlet.RenderResponse;
039    
040    import javax.servlet.http.HttpServletRequest;
041    import javax.servlet.http.HttpServletResponse;
042    
043    /**
044     * @author Eudaldo Alonso
045     */
046    public interface Sites {
047    
048            public static final String ANALYTICS_PREFIX = "analytics_";
049    
050            public static final int CONTENT_SHARING_WITH_CHILDREN_DEFAULT_VALUE = -1;
051    
052            public static final int CONTENT_SHARING_WITH_CHILDREN_DISABLED = 0;
053    
054            public static final int CONTENT_SHARING_WITH_CHILDREN_DISABLED_BY_DEFAULT =
055                    1;
056    
057            public static final int CONTENT_SHARING_WITH_CHILDREN_ENABLED = 3;
058    
059            public static final int CONTENT_SHARING_WITH_CHILDREN_ENABLED_BY_DEFAULT =
060                    2;
061    
062            public static final String LAST_MERGE_TIME = "last-merge-time";
063    
064            public static final String LAST_RESET_TIME = "last-reset-time";
065    
066            public static final String LAYOUT_UPDATEABLE = "layoutUpdateable";
067    
068            public static final String MERGE_FAIL_COUNT = "merge-fail-count";
069    
070            public static final String MERGE_FAIL_FRIENDLY_URL_LAYOUTS =
071                    "merge-fail-friendly-url-layouts";
072    
073            public void addMergeFailFriendlyURLLayout(Layout layout)
074                    throws PortalException;
075    
076            public void addPortletBreadcrumbEntries(
077                            Group group, HttpServletRequest request,
078                            RenderResponse renderResponse)
079                    throws Exception;
080    
081            public void addPortletBreadcrumbEntries(
082                            Group group, String pagesName, PortletURL redirectURL,
083                            HttpServletRequest request, RenderResponse renderResponse)
084                    throws Exception;
085    
086            public void applyLayoutPrototype(
087                            LayoutPrototype layoutPrototype, Layout targetLayout,
088                            boolean linkEnabled)
089                    throws Exception;
090    
091            public void copyLayout(
092                            long userId, Layout sourceLayout, Layout targetLayout,
093                            ServiceContext serviceContext)
094                    throws Exception;
095    
096            public void copyLookAndFeel(Layout targetLayout, Layout sourceLayout)
097                    throws Exception;
098    
099            public void copyPortletPermissions(Layout targetLayout, Layout sourceLayout)
100                    throws Exception;
101    
102            public void copyPortletSetups(Layout sourceLayout, Layout targetLayout)
103                    throws Exception;
104    
105            public void copyTypeSettings(Group sourceGroup, Group targetGroup)
106                    throws Exception;
107    
108            public Object[] deleteLayout(
109                            ActionRequest actionRequest, ActionResponse actionResponse)
110                    throws Exception;
111    
112            public Object[] deleteLayout(
113                            HttpServletRequest request, HttpServletResponse response)
114                    throws Exception;
115    
116            public void deleteLayout(
117                            RenderRequest renderRequest, RenderResponse renderResponse)
118                    throws Exception;
119    
120            public File exportLayoutSetPrototype(
121                            LayoutSetPrototype layoutSetPrototype,
122                            ServiceContext serviceContext)
123                    throws PortalException;
124    
125            public Long[] filterGroups(List<Group> groups, String[] names);
126    
127            public Layout getLayoutSetPrototypeLayout(Layout layout);
128    
129            public Map<String, String[]> getLayoutSetPrototypeParameters(
130                    ServiceContext serviceContext);
131    
132            public int getMergeFailCount(LayoutPrototype layoutPrototype)
133                    throws PortalException;
134    
135            public int getMergeFailCount(LayoutSetPrototype layoutSetPrototype)
136                    throws PortalException;
137    
138            public List<Layout> getMergeFailFriendlyURLLayouts(LayoutSet layoutSet)
139                    throws PortalException;
140    
141            public List<String> getOrganizationNames(Group group, User user)
142                    throws Exception;
143    
144            public List<String> getUserGroupNames(Group group, User user)
145                    throws Exception;
146    
147            public void importLayoutSetPrototype(
148                            LayoutSetPrototype layoutSetPrototype, InputStream inputStream,
149                            ServiceContext serviceContext)
150                    throws PortalException;
151    
152            public boolean isContentSharingWithChildrenEnabled(Group group);
153    
154            public boolean isFirstLayout(
155                    long groupId, boolean privateLayout, long layoutId);
156    
157            public boolean isLayoutDeleteable(Layout layout);
158    
159            public boolean isLayoutModifiedSinceLastMerge(Layout layout)
160                    throws PortalException;
161    
162            public boolean isLayoutSetMergeable(Group group, LayoutSet layoutSet)
163                    throws PortalException;
164    
165            public boolean isLayoutSetPrototypeUpdateable(LayoutSet layoutSet);
166    
167            public boolean isLayoutSortable(Layout layout);
168    
169            public boolean isLayoutUpdateable(Layout layout);
170    
171            public boolean isUserGroupLayout(Layout layout) throws PortalException;
172    
173            public boolean isUserGroupLayoutSetViewable(
174                            PermissionChecker permissionChecker, Group userGroupGroup)
175                    throws PortalException;
176    
177            public void mergeLayoutPrototypeLayout(Group group, Layout layout)
178                    throws Exception;
179    
180            /**
181             * @deprecated As of 6.2.0, replaced by {@link
182             *             #mergeLayoutPrototypeLayout(Group, Layout)}
183             */
184            @Deprecated
185            public void mergeLayoutProtypeLayout(Group group, Layout layout)
186                    throws Exception;
187    
188            public void mergeLayoutSetPrototypeLayouts(Group group, LayoutSet layoutSet)
189                    throws Exception;
190    
191            /**
192             * @deprecated As of 6.2.0, replaced by {@link
193             *             #mergeLayoutSetPrototypeLayouts(Group, LayoutSet)}
194             */
195            @Deprecated
196            public void mergeLayoutSetProtypeLayouts(Group group, LayoutSet layoutSet)
197                    throws Exception;
198    
199            public void removeMergeFailFriendlyURLLayouts(LayoutSet layoutSet);
200    
201            public void resetPrototype(Layout layout) throws PortalException;
202    
203            public void resetPrototype(LayoutSet layoutSet) throws PortalException;
204    
205            public void setMergeFailCount(
206                            LayoutPrototype layoutPrototype, int newMergeFailCount)
207                    throws PortalException;
208    
209            public void setMergeFailCount(
210                            LayoutSetPrototype layoutSetPrototype, int newMergeFailCount)
211                    throws PortalException;
212    
213            public void updateLayoutScopes(
214                            long userId, Layout sourceLayout, Layout targetLayout,
215                            PortletPreferences sourcePreferences,
216                            PortletPreferences targetPreferences, String sourcePortletId,
217                            String languageId)
218                    throws Exception;
219    
220            public void updateLayoutSetPrototypesLinks(
221                            Group group, long publicLayoutSetPrototypeId,
222                            long privateLayoutSetPrototypeId,
223                            boolean publicLayoutSetPrototypeLinkEnabled,
224                            boolean privateLayoutSetPrototypeLinkEnabled)
225                    throws Exception;
226    
227    }