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 void addPortletBreadcrumbEntries(
072                            Group group, HttpServletRequest request,
073                            RenderResponse renderResponse)
074                    throws Exception;
075    
076            public void addPortletBreadcrumbEntries(
077                            Group group, String pagesName, PortletURL redirectURL,
078                            HttpServletRequest request, RenderResponse renderResponse)
079                    throws Exception;
080    
081            public void applyLayoutPrototype(
082                            LayoutPrototype layoutPrototype, Layout targetLayout,
083                            boolean linkEnabled)
084                    throws Exception;
085    
086            public void copyLayout(
087                            long userId, Layout sourceLayout, Layout targetLayout,
088                            ServiceContext serviceContext)
089                    throws Exception;
090    
091            public void copyLookAndFeel(Layout targetLayout, Layout sourceLayout)
092                    throws Exception;
093    
094            public void copyPortletPermissions(Layout targetLayout, Layout sourceLayout)
095                    throws Exception;
096    
097            public void copyPortletSetups(Layout sourceLayout, Layout targetLayout)
098                    throws Exception;
099    
100            public void copyTypeSettings(Group sourceGroup, Group targetGroup)
101                    throws Exception;
102    
103            public Object[] deleteLayout(
104                            ActionRequest actionRequest, ActionResponse actionResponse)
105                    throws Exception;
106    
107            public Object[] deleteLayout(
108                            HttpServletRequest request, HttpServletResponse response)
109                    throws Exception;
110    
111            public void deleteLayout(
112                            RenderRequest renderRequest, RenderResponse renderResponse)
113                    throws Exception;
114    
115            public File exportLayoutSetPrototype(
116                            LayoutSetPrototype layoutSetPrototype,
117                            ServiceContext serviceContext)
118                    throws PortalException, SystemException;
119    
120            public Long[] filterGroups(List<Group> groups, String[] names);
121    
122            public Layout getLayoutSetPrototypeLayout(Layout layout);
123    
124            public Map<String, String[]> getLayoutSetPrototypeParameters(
125                    ServiceContext serviceContext);
126    
127            public int getMergeFailCount(LayoutPrototype layoutPrototype)
128                    throws PortalException, SystemException;
129    
130            public int getMergeFailCount(LayoutSetPrototype layoutSetPrototype)
131                    throws PortalException, SystemException;
132    
133            public void importLayoutSetPrototype(
134                            LayoutSetPrototype layoutSetPrototype, InputStream inputStream,
135                            ServiceContext serviceContext)
136                    throws PortalException, SystemException;
137    
138            public boolean isContentSharingWithChildrenEnabled(Group group)
139                    throws SystemException;
140    
141            public boolean isLayoutDeleteable(Layout layout);
142    
143            public boolean isLayoutModifiedSinceLastMerge(Layout layout)
144                    throws PortalException, SystemException;
145    
146            public boolean isLayoutSetMergeable(Group group, LayoutSet layoutSet)
147                    throws PortalException, SystemException;
148    
149            public boolean isLayoutSetPrototypeUpdateable(LayoutSet layoutSet);
150    
151            public boolean isLayoutSortable(Layout layout);
152    
153            public boolean isLayoutUpdateable(Layout layout);
154    
155            public boolean isOrganizationUser(
156                            long companyId, Group group, User user,
157                            List<String> organizationNames)
158                    throws Exception;
159    
160            public boolean isUserGroupLayoutSetViewable(
161                            PermissionChecker permissionChecker, Group userGroupGroup)
162                    throws PortalException, SystemException;
163    
164            public boolean isUserGroupUser(
165                            long companyId, Group group, User user, List<String> userGroupNames)
166                    throws Exception;
167    
168            public void mergeLayoutPrototypeLayout(Group group, Layout layout)
169                    throws Exception;
170    
171            /**
172             * @deprecated As of 6.2.0, replaced by {@link
173             *             #mergeLayoutPrototypeLayout(Group, Layout)}
174             */
175            public void mergeLayoutProtypeLayout(Group group, Layout layout)
176                    throws Exception;
177    
178            public void mergeLayoutSetPrototypeLayouts(Group group, LayoutSet layoutSet)
179                    throws Exception;
180    
181            /**
182             * @deprecated As of 6.2.0, replaced by {@link
183             *             #mergeLayoutSetPrototypeLayouts(Group, LayoutSet)}
184             */
185            public void mergeLayoutSetProtypeLayouts(Group group, LayoutSet layoutSet)
186                    throws Exception;
187    
188            public void resetPrototype(Layout layout)
189                    throws PortalException, SystemException;
190    
191            public void resetPrototype(LayoutSet layoutSet)
192                    throws PortalException, SystemException;
193    
194            public void setMergeFailCount(
195                            LayoutPrototype layoutPrototype, int newMergeFailCount)
196                    throws PortalException, SystemException;
197    
198            public void setMergeFailCount(
199                            LayoutSetPrototype layoutSetPrototype, int newMergeFailCount)
200                    throws PortalException, SystemException;
201    
202            public void updateLayoutScopes(
203                            long userId, Layout sourceLayout, Layout targetLayout,
204                            PortletPreferences sourcePreferences,
205                            PortletPreferences targetPreferences, String sourcePortletId,
206                            String languageId)
207                    throws Exception;
208    
209            public void updateLayoutSetPrototypesLinks(
210                            Group group, long publicLayoutSetPrototypeId,
211                            long privateLayoutSetPrototypeId,
212                            boolean publicLayoutSetPrototypeLinkEnabled,
213                            boolean privateLayoutSetPrototypeLinkEnabled)
214                    throws Exception;
215    
216    }