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