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