001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.staging;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.json.JSONArray;
020    import com.liferay.portal.kernel.json.JSONObject;
021    import com.liferay.portal.kernel.lar.MissingReference;
022    import com.liferay.portal.kernel.lar.PortletDataContext;
023    import com.liferay.portal.kernel.util.UnicodeProperties;
024    import com.liferay.portal.kernel.workflow.WorkflowTask;
025    import com.liferay.portal.kernel.xml.Element;
026    import com.liferay.portal.model.Group;
027    import com.liferay.portal.model.Layout;
028    import com.liferay.portal.model.LayoutRevision;
029    import com.liferay.portal.model.Portlet;
030    import com.liferay.portal.model.User;
031    import com.liferay.portal.service.ServiceContext;
032    
033    import java.io.Serializable;
034    
035    import java.util.Date;
036    import java.util.List;
037    import java.util.Locale;
038    import java.util.Map;
039    
040    import javax.portlet.PortletPreferences;
041    import javax.portlet.PortletRequest;
042    
043    import javax.servlet.http.HttpServletRequest;
044    
045    /**
046     * @author Raymond Augé
047     */
048    public interface Staging {
049    
050            public String buildRemoteURL(
051                    String remoteAddress, int remotePort, String remotePathContext,
052                    boolean secureConnection, long remoteGroupId, boolean privateLayout);
053    
054            public String buildRemoteURL(UnicodeProperties typeSettingsProperties);
055    
056            /**
057             * @deprecated As of 7.0.0, replaced by {@link
058             *             com.liferay.portal.service.StagingLocalServiceUtil#
059             *             checkDefaultLayoutSetBranches(long, Group, boolean, boolean,
060             *             boolean, ServiceContext))}
061             */
062            @Deprecated
063            public void checkDefaultLayoutSetBranches(
064                            long userId, Group liveGroup, boolean branchingPublic,
065                            boolean branchingPrivate, boolean remote,
066                            ServiceContext serviceContext)
067                    throws PortalException, SystemException;
068    
069            public void copyFromLive(PortletRequest PortletRequest) throws Exception;
070    
071            public void copyFromLive(PortletRequest PortletRequest, Portlet portlet)
072                    throws Exception;
073    
074            public void copyPortlet(
075                            PortletRequest PortletRequest, long sourceGroupId,
076                            long targetGroupId, long sourcePlid, long targetPlid,
077                            String portletId)
078                    throws Exception;
079    
080            public void copyRemoteLayouts(
081                            long sourceGroupId, boolean privateLayout,
082                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
083                            String remoteAddress, int remotePort, String remotePathContext,
084                            boolean secureConnection, long remoteGroupId,
085                            boolean remotePrivateLayout, Date startDate, Date endDate)
086                    throws Exception;
087    
088            public void deleteLastImportSettings(Group liveGroup, boolean privateLayout)
089                    throws PortalException, SystemException;
090    
091            public void deleteRecentLayoutRevisionId(
092                            HttpServletRequest request, long layoutSetBranchId, long plid)
093                    throws SystemException;
094    
095            public void deleteRecentLayoutRevisionId(
096                            User user, long layoutSetBranchId, long plid)
097                    throws SystemException;
098    
099            /**
100             * @deprecated As of 6.2.0, replaced by {@link
101             *             com.liferay.portal.service.StagingLocalService#disableStaging(
102             *             Group, ServiceContext)}
103             */
104            public void disableStaging(
105                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
106                    throws Exception;
107    
108            /**
109             * @deprecated As of 6.2.0, replaced by {@link
110             *             com.liferay.portal.service.StagingLocalService#disableStaging(
111             *             Group, ServiceContext)}
112             */
113            public void disableStaging(Group liveGroup, ServiceContext serviceContext)
114                    throws Exception;
115    
116            /**
117             * @deprecated As of 6.2.0, replaced by {@link
118             *             com.liferay.portal.service.StagingLocalService#disableStaging(
119             *             PortletRequest, Group, ServiceContext)}
120             */
121            public void disableStaging(
122                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
123                            ServiceContext serviceContext)
124                    throws Exception;
125    
126            /**
127             * @deprecated As of 6.2.0, replaced by {@link
128             *             com.liferay.portal.service.StagingLocalService#disableStaging(
129             *             PortletRequest, Group, ServiceContext)}
130             */
131            public void disableStaging(
132                            PortletRequest portletRequest, Group liveGroup,
133                            ServiceContext serviceContext)
134                    throws Exception;
135    
136            /**
137             * @deprecated As of 6.2.0, replaced by {@link
138             *             com.liferay.portal.service.StagingLocalService#enableLocalStaging(
139             *             long, Group, boolean, boolean, ServiceContext)}
140             */
141            public void enableLocalStaging(
142                            long userId, Group scopeGroup, Group liveGroup,
143                            boolean branchingPublic, boolean branchingPrivate,
144                            ServiceContext serviceContext)
145                    throws Exception;
146    
147            /**
148             * @deprecated As of 6.2.0, replaced by {@link
149             *             com.liferay.portal.service.StagingLocalService#enableRemoteStaging(
150             *             long, Group, boolean, boolean, String, int, String, boolean,
151             *             long, ServiceContext)}
152             */
153            public void enableRemoteStaging(
154                            long userId, Group scopeGroup, Group liveGroup,
155                            boolean branchingPublic, boolean branchingPrivate,
156                            String remoteAddress, int remotePort, String remotePathContext,
157                            boolean secureConnection, long remoteGroupId,
158                            ServiceContext serviceContext)
159                    throws Exception;
160    
161            public JSONArray getErrorMessagesJSONArray(
162                    Locale locale, Map<String, MissingReference> missingReferences,
163                            Map<String, Serializable> contextMap);
164    
165            public JSONObject getExceptionMessagesJSONObject(
166                            Locale locale, Exception e, Map<String, Serializable> contextMap);
167    
168            public Group getLiveGroup(long groupId)
169                    throws PortalException, SystemException;
170    
171            public long getLiveGroupId(long groupId)
172                    throws PortalException, SystemException;
173    
174            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
175                    throws Exception;
176    
177            public long getRecentLayoutRevisionId(
178                            HttpServletRequest request, long layoutSetBranchId, long plid)
179                    throws PortalException, SystemException;
180    
181            public long getRecentLayoutRevisionId(
182                            User user, long layoutSetBranchId, long plid)
183                    throws PortalException, SystemException;
184    
185            public long getRecentLayoutSetBranchId(
186                    HttpServletRequest request, long layoutSetId);
187    
188            public long getRecentLayoutSetBranchId(User user, long layoutSetId)
189                    throws SystemException;
190    
191            public String getSchedulerGroupName(String destinationName, long groupId);
192    
193            public String getStagedPortletId(String portletId);
194    
195            public Map<String, String[]> getStagingParameters();
196    
197            public Map<String, String[]> getStagingParameters(
198                    PortletRequest PortletRequest);
199    
200            public JSONArray getWarningMessagesJSONArray(
201                    Locale locale, Map<String, MissingReference> missingReferences,
202                    Map<String, Serializable> contextMap);
203    
204            public WorkflowTask getWorkflowTask(
205                            long userId, LayoutRevision layoutRevision)
206                    throws PortalException, SystemException;
207    
208            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
209                    throws PortalException, SystemException;
210    
211            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
212    
213            public void lockGroup(long userId, long groupId) throws Exception;
214    
215            public void publishLayout(
216                            long userId, long plid, long liveGroupId, boolean includeChildren)
217                    throws Exception;
218    
219            public void publishLayouts(
220                            long userId, long sourceGroupId, long targetGroupId,
221                            boolean privateLayout, long[] layoutIds,
222                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
223                    throws PortalException, SystemException;
224    
225            public void publishLayouts(
226                            long userId, long sourceGroupId, long targetGroupId,
227                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
228                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
229                    throws PortalException, SystemException;
230    
231            public void publishLayouts(
232                            long userId, long sourceGroupId, long targetGroupId,
233                            boolean privateLayout, Map<String, String[]> parameterMap,
234                            Date startDate, Date endDate)
235                    throws PortalException, SystemException;
236    
237            public void publishToLive(PortletRequest PortletRequest) throws Exception;
238    
239            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
240                    throws Exception;
241    
242            public void publishToRemote(PortletRequest PortletRequest) throws Exception;
243    
244            public void scheduleCopyFromLive(PortletRequest PortletRequest)
245                    throws Exception;
246    
247            public void schedulePublishToLive(PortletRequest PortletRequest)
248                    throws Exception;
249    
250            public void schedulePublishToRemote(PortletRequest PortletRequest)
251                    throws Exception;
252    
253            public void setRecentLayoutBranchId(
254                            HttpServletRequest request, long layoutSetBranchId, long plid,
255                            long layoutBranchId)
256                    throws SystemException;
257    
258            public void setRecentLayoutBranchId(
259                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
260                    throws SystemException;
261    
262            public void setRecentLayoutRevisionId(
263                            HttpServletRequest request, long layoutSetBranchId, long plid,
264                            long layoutRevisionId)
265                    throws SystemException;
266    
267            public void setRecentLayoutRevisionId(
268                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
269                    throws SystemException;
270    
271            public void setRecentLayoutSetBranchId(
272                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
273    
274            public void setRecentLayoutSetBranchId(
275                            User user, long layoutSetId, long layoutSetBranchId)
276                    throws SystemException;
277    
278            public void unlockGroup(long groupId) throws SystemException;
279    
280            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
281                    throws Exception;
282    
283            public void unschedulePublishToLive(PortletRequest PortletRequest)
284                    throws Exception;
285    
286            public void unschedulePublishToRemote(PortletRequest PortletRequest)
287                    throws Exception;
288    
289            public void updateLastImportSettings(
290                            Element layoutElement, Layout layout,
291                            PortletDataContext portletDataContext)
292                    throws Exception;
293    
294            public void updateLastPublishDate(
295                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
296                    throws Exception;
297    
298            public void updateLastPublishDate(
299                            String portletId, PortletPreferences portletPreferences,
300                            Date lastPublishDate)
301                    throws Exception;
302    
303            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
304                    throws Exception;
305    
306            public void validateRemote(
307                            String remoteAddress, int remotePort, String remotePathContext,
308                            boolean secureConnection, long remoteGroupId)
309                    throws PortalException;
310    
311    }