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                            User user, long layoutSetBranchId, long plid)
099                    throws SystemException;
100    
101            /**
102             * @deprecated As of 6.2.0, replaced by {@link
103             *             com.liferay.portal.service.StagingLocalService#disableStaging(
104             *             Group, ServiceContext)}
105             */
106            public void disableStaging(
107                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
108                    throws Exception;
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(Group liveGroup, ServiceContext serviceContext)
116                    throws Exception;
117    
118            /**
119             * @deprecated As of 6.2.0, replaced by {@link
120             *             com.liferay.portal.service.StagingLocalService#disableStaging(
121             *             PortletRequest, Group, ServiceContext)}
122             */
123            public void disableStaging(
124                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
125                            ServiceContext serviceContext)
126                    throws Exception;
127    
128            /**
129             * @deprecated As of 6.2.0, replaced by {@link
130             *             com.liferay.portal.service.StagingLocalService#disableStaging(
131             *             PortletRequest, Group, ServiceContext)}
132             */
133            public void disableStaging(
134                            PortletRequest portletRequest, Group liveGroup,
135                            ServiceContext serviceContext)
136                    throws Exception;
137    
138            /**
139             * @deprecated As of 6.2.0, replaced by {@link
140             *             com.liferay.portal.service.StagingLocalService#enableLocalStaging(
141             *             long, Group, boolean, boolean, ServiceContext)}
142             */
143            public void enableLocalStaging(
144                            long userId, Group scopeGroup, Group liveGroup,
145                            boolean branchingPublic, boolean branchingPrivate,
146                            ServiceContext serviceContext)
147                    throws Exception;
148    
149            /**
150             * @deprecated As of 6.2.0, replaced by {@link
151             *             com.liferay.portal.service.StagingLocalService#enableRemoteStaging(
152             *             long, Group, boolean, boolean, String, int, String, boolean,
153             *             long, ServiceContext)}
154             */
155            public void enableRemoteStaging(
156                            long userId, Group scopeGroup, Group liveGroup,
157                            boolean branchingPublic, boolean branchingPrivate,
158                            String remoteAddress, int remotePort, String remotePathContext,
159                            boolean secureConnection, long remoteGroupId,
160                            ServiceContext serviceContext)
161                    throws Exception;
162    
163            public JSONArray getErrorMessagesJSONArray(
164                    Locale locale, Map<String, MissingReference> missingReferences,
165                            Map<String, Serializable> contextMap);
166    
167            public JSONObject getExceptionMessagesJSONObject(
168                            Locale locale, Exception e, Map<String, Serializable> contextMap);
169    
170            public Date getLastPublishDate(LayoutSet layoutSet) throws PortalException;
171    
172            public Date getLastPublishDate(PortletPreferences jxPortletPreferences);
173    
174            public Group getLiveGroup(long groupId)
175                    throws PortalException, SystemException;
176    
177            public long getLiveGroupId(long groupId)
178                    throws PortalException, SystemException;
179    
180            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
181                    throws Exception;
182    
183            public long getRecentLayoutRevisionId(
184                            HttpServletRequest request, long layoutSetBranchId, long plid)
185                    throws PortalException, SystemException;
186    
187            public long getRecentLayoutRevisionId(
188                            User user, long layoutSetBranchId, long plid)
189                    throws PortalException, SystemException;
190    
191            public long getRecentLayoutSetBranchId(
192                    HttpServletRequest request, long layoutSetId);
193    
194            public long getRecentLayoutSetBranchId(User user, long layoutSetId)
195                    throws SystemException;
196    
197            public String getSchedulerGroupName(String destinationName, long groupId);
198    
199            public String getStagedPortletId(String portletId);
200    
201            public Map<String, String[]> getStagingParameters();
202    
203            public Map<String, String[]> getStagingParameters(
204                    PortletRequest PortletRequest);
205    
206            public JSONArray getWarningMessagesJSONArray(
207                    Locale locale, Map<String, MissingReference> missingReferences,
208                    Map<String, Serializable> contextMap);
209    
210            public WorkflowTask getWorkflowTask(
211                            long userId, LayoutRevision layoutRevision)
212                    throws PortalException, SystemException;
213    
214            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
215                    throws PortalException, SystemException;
216    
217            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
218    
219            public void lockGroup(long userId, long groupId) throws Exception;
220    
221            public void publishLayout(
222                            long userId, long plid, long liveGroupId, boolean includeChildren)
223                    throws Exception;
224    
225            public void publishLayouts(
226                            long userId, long sourceGroupId, long targetGroupId,
227                            boolean privateLayout, long[] layoutIds,
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<Long, Boolean> layoutIdMap,
234                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
235                    throws PortalException, SystemException;
236    
237            public void publishLayouts(
238                            long userId, long sourceGroupId, long targetGroupId,
239                            boolean privateLayout, Map<String, String[]> parameterMap,
240                            Date startDate, Date endDate)
241                    throws PortalException, SystemException;
242    
243            public void publishToLive(PortletRequest PortletRequest) throws Exception;
244    
245            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
246                    throws Exception;
247    
248            public void publishToRemote(PortletRequest PortletRequest) throws Exception;
249    
250            public void scheduleCopyFromLive(PortletRequest PortletRequest)
251                    throws Exception;
252    
253            public void schedulePublishToLive(PortletRequest PortletRequest)
254                    throws Exception;
255    
256            public void schedulePublishToRemote(PortletRequest PortletRequest)
257                    throws Exception;
258    
259            public void setRecentLayoutBranchId(
260                            HttpServletRequest request, long layoutSetBranchId, long plid,
261                            long layoutBranchId)
262                    throws SystemException;
263    
264            public void setRecentLayoutBranchId(
265                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
266                    throws SystemException;
267    
268            public void setRecentLayoutRevisionId(
269                            HttpServletRequest request, long layoutSetBranchId, long plid,
270                            long layoutRevisionId)
271                    throws SystemException;
272    
273            public void setRecentLayoutRevisionId(
274                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
275                    throws SystemException;
276    
277            public void setRecentLayoutSetBranchId(
278                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
279    
280            public void setRecentLayoutSetBranchId(
281                            User user, long layoutSetId, long layoutSetBranchId)
282                    throws SystemException;
283    
284            public void unlockGroup(long groupId) throws SystemException;
285    
286            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
287                    throws Exception;
288    
289            public void unschedulePublishToLive(PortletRequest PortletRequest)
290                    throws Exception;
291    
292            public void unschedulePublishToRemote(PortletRequest PortletRequest)
293                    throws Exception;
294    
295            public void updateLastImportSettings(
296                            Element layoutElement, Layout layout,
297                            PortletDataContext portletDataContext)
298                    throws Exception;
299    
300            public void updateLastPublishDate(
301                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
302                    throws Exception;
303    
304            public void updateLastPublishDate(
305                            long sourceGroupId, boolean privateLayout, DateRange dateRange,
306                            Date lastPublishDate)
307                    throws Exception;
308    
309            public void updateLastPublishDate(
310                            String portletId, PortletPreferences portletPreferences,
311                            Date lastPublishDate)
312                    throws Exception;
313    
314            public void updateLastPublishDate(
315                    String portletId, PortletPreferences portletPreferences,
316                    DateRange dateRange, Date lastPublishDate);
317    
318            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
319                    throws Exception;
320    
321            public void validateRemote(
322                            String remoteAddress, int remotePort, String remotePathContext,
323                            boolean secureConnection, long remoteGroupId)
324                    throws PortalException;
325    
326    }