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 isLayoutDeleteable(Layout layout);
151    
152            public boolean isLayoutModifiedSinceLastMerge(Layout layout)
153                    throws PortalException, SystemException;
154    
155            public boolean isLayoutSetMergeable(Group group, LayoutSet layoutSet)
156                    throws PortalException, SystemException;
157    
158            public boolean isLayoutSetPrototypeUpdateable(LayoutSet layoutSet);
159    
160            public boolean isLayoutSortable(Layout layout);
161    
162            public boolean isLayoutUpdateable(Layout layout);
163    
164            public boolean isOrganizationUser(
165                            long companyId, Group group, User user,
166                            List<String> organizationNames)
167                    throws Exception;
168    
169            public boolean isUserGroupLayoutSetViewable(
170                            PermissionChecker permissionChecker, Group userGroupGroup)
171                    throws PortalException, SystemException;
172    
173            public boolean isUserGroupUser(
174                            long companyId, Group group, User user, List<String> userGroupNames)
175                    throws Exception;
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            public void mergeLayoutProtypeLayout(Group group, Layout layout)
185                    throws Exception;
186    
187            public void mergeLayoutSetPrototypeLayouts(Group group, LayoutSet layoutSet)
188                    throws Exception;
189    
190            /**
191             * @deprecated As of 6.2.0, replaced by {@link
192             *             #mergeLayoutSetPrototypeLayouts(Group, LayoutSet)}
193             */
194            public void mergeLayoutSetProtypeLayouts(Group group, LayoutSet layoutSet)
195                    throws Exception;
196    
197            public void removeMergeFailFriendlyURLLayouts(LayoutSet layoutSet)
198                    throws SystemException;
199    
200            public void resetPrototype(Layout layout)
201                    throws PortalException, SystemException;
202    
203            public void resetPrototype(LayoutSet layoutSet)
204                    throws PortalException, SystemException;
205    
206            public void setMergeFailCount(
207                            LayoutPrototype layoutPrototype, int newMergeFailCount)
208                    throws PortalException, SystemException;
209    
210            public void setMergeFailCount(
211                            LayoutSetPrototype layoutSetPrototype, int newMergeFailCount)
212                    throws PortalException, SystemException;
213    
214            public void updateLayoutScopes(
215                            long userId, Layout sourceLayout, Layout targetLayout,
216                            PortletPreferences sourcePreferences,
217                            PortletPreferences targetPreferences, String sourcePortletId,
218                            String languageId)
219                    throws Exception;
220    
221            public void updateLayoutSetPrototypesLinks(
222                            Group group, long publicLayoutSetPrototypeId,
223                            long privateLayoutSetPrototypeId,
224                            boolean publicLayoutSetPrototypeLinkEnabled,
225                            boolean privateLayoutSetPrototypeLinkEnabled)
226                    throws Exception;
227    
228    }