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.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            public void checkDefaultLayoutSetBranches(
057                            long userId, Group liveGroup, boolean branchingPublic,
058                            boolean branchingPrivate, boolean remote,
059                            ServiceContext serviceContext)
060                    throws PortalException, SystemException;
061    
062            public void copyFromLive(PortletRequest PortletRequest) throws Exception;
063    
064            public void copyFromLive(PortletRequest PortletRequest, Portlet portlet)
065                    throws Exception;
066    
067            public void copyPortlet(
068                            PortletRequest PortletRequest, long sourceGroupId,
069                            long targetGroupId, long sourcePlid, long targetPlid,
070                            String portletId)
071                    throws Exception;
072    
073            public void copyRemoteLayouts(
074                            long sourceGroupId, boolean privateLayout,
075                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
076                            String remoteAddress, int remotePort, String remotePathContext,
077                            boolean secureConnection, long remoteGroupId,
078                            boolean remotePrivateLayout, Date startDate, Date endDate)
079                    throws Exception;
080    
081            public void deleteLastImportSettings(Group liveGroup, boolean privateLayout)
082                    throws PortalException, SystemException;
083    
084            public void deleteRecentLayoutRevisionId(
085                            HttpServletRequest request, long layoutSetBranchId, long plid)
086                    throws SystemException;
087    
088            public void deleteRecentLayoutRevisionId(
089                            User user, long layoutSetBranchId, long plid)
090                    throws SystemException;
091    
092            /**
093             * @deprecated As of 6.2.0, replaced by {@link
094             *             com.liferay.portal.service.StagingLocalService#disableStaging(
095             *             Group, ServiceContext)}
096             */
097            public void disableStaging(
098                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
099                    throws Exception;
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(Group liveGroup, ServiceContext serviceContext)
107                    throws Exception;
108    
109            /**
110             * @deprecated As of 6.2.0, replaced by {@link
111             *             com.liferay.portal.service.StagingLocalService#disableStaging(
112             *             PortletRequest, Group, ServiceContext)}
113             */
114            public void disableStaging(
115                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
116                            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             *             PortletRequest, Group, ServiceContext)}
123             */
124            public void disableStaging(
125                            PortletRequest portletRequest, Group liveGroup,
126                            ServiceContext serviceContext)
127                    throws Exception;
128    
129            /**
130             * @deprecated As of 6.2.0, replaced by {@link
131             *             com.liferay.portal.service.StagingLocalService#enableLocalStaging(
132             *             long, Group, boolean, boolean, ServiceContext)}
133             */
134            public void enableLocalStaging(
135                            long userId, Group scopeGroup, Group liveGroup,
136                            boolean branchingPublic, boolean branchingPrivate,
137                            ServiceContext serviceContext)
138                    throws Exception;
139    
140            /**
141             * @deprecated As of 6.2.0, replaced by {@link
142             *             com.liferay.portal.service.StagingLocalService#enableRemoteStaging(
143             *             long, Group, boolean, boolean, String, int, String, boolean,
144             *             long, ServiceContext)}
145             */
146            public void enableRemoteStaging(
147                            long userId, Group scopeGroup, Group liveGroup,
148                            boolean branchingPublic, boolean branchingPrivate,
149                            String remoteAddress, int remotePort, String remotePathContext,
150                            boolean secureConnection, long remoteGroupId,
151                            ServiceContext serviceContext)
152                    throws Exception;
153    
154            public JSONArray getErrorMessagesJSONArray(
155                    Locale locale, Map<String, MissingReference> missingReferences,
156                    Map<String, Serializable> contextMap);
157    
158            public JSONObject getExceptionMessagesJSONObject(
159                    Locale locale, Exception e, Map<String, Serializable> contextMap);
160    
161            public Group getLiveGroup(long groupId)
162                    throws PortalException, SystemException;
163    
164            public long getLiveGroupId(long groupId)
165                    throws PortalException, SystemException;
166    
167            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
168                    throws Exception;
169    
170            public long getRecentLayoutRevisionId(
171                            HttpServletRequest request, long layoutSetBranchId, long plid)
172                    throws PortalException, SystemException;
173    
174            public long getRecentLayoutRevisionId(
175                            User user, long layoutSetBranchId, long plid)
176                    throws PortalException, SystemException;
177    
178            public long getRecentLayoutSetBranchId(
179                    HttpServletRequest request, long layoutSetId);
180    
181            public long getRecentLayoutSetBranchId(User user, long layoutSetId)
182                    throws SystemException;
183    
184            public String getSchedulerGroupName(String destinationName, long groupId);
185    
186            public String getStagedPortletId(String portletId);
187    
188            public Map<String, String[]> getStagingParameters();
189    
190            public Map<String, String[]> getStagingParameters(
191                    PortletRequest PortletRequest);
192    
193            public JSONArray getWarningMessagesJSONArray(
194                    Locale locale, Map<String, MissingReference> missingReferences,
195                    Map<String, Serializable> contextMap);
196    
197            public WorkflowTask getWorkflowTask(
198                            long userId, LayoutRevision layoutRevision)
199                    throws PortalException, SystemException;
200    
201            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
202                    throws PortalException, SystemException;
203    
204            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
205    
206            public void lockGroup(long userId, long groupId) throws Exception;
207    
208            public void publishLayout(
209                            long userId, long plid, long liveGroupId, boolean includeChildren)
210                    throws Exception;
211    
212            public void publishLayouts(
213                            long userId, long sourceGroupId, long targetGroupId,
214                            boolean privateLayout, long[] layoutIds,
215                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
216                    throws PortalException, SystemException;
217    
218            public void publishLayouts(
219                            long userId, long sourceGroupId, long targetGroupId,
220                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
221                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
222                    throws PortalException, SystemException;
223    
224            public void publishLayouts(
225                            long userId, long sourceGroupId, long targetGroupId,
226                            boolean privateLayout, Map<String, String[]> parameterMap,
227                            Date startDate, Date endDate)
228                    throws PortalException, SystemException;
229    
230            public void publishToLive(PortletRequest PortletRequest) throws Exception;
231    
232            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
233                    throws Exception;
234    
235            public void publishToRemote(PortletRequest PortletRequest) throws Exception;
236    
237            public void scheduleCopyFromLive(PortletRequest PortletRequest)
238                    throws Exception;
239    
240            public void schedulePublishToLive(PortletRequest PortletRequest)
241                    throws Exception;
242    
243            public void schedulePublishToRemote(PortletRequest PortletRequest)
244                    throws Exception;
245    
246            public void setRecentLayoutBranchId(
247                            HttpServletRequest request, long layoutSetBranchId, long plid,
248                            long layoutBranchId)
249                    throws SystemException;
250    
251            public void setRecentLayoutBranchId(
252                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
253                    throws SystemException;
254    
255            public void setRecentLayoutRevisionId(
256                            HttpServletRequest request, long layoutSetBranchId, long plid,
257                            long layoutRevisionId)
258                    throws SystemException;
259    
260            public void setRecentLayoutRevisionId(
261                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
262                    throws SystemException;
263    
264            public void setRecentLayoutSetBranchId(
265                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
266    
267            public void setRecentLayoutSetBranchId(
268                            User user, long layoutSetId, long layoutSetBranchId)
269                    throws SystemException;
270    
271            public void unlockGroup(long groupId) throws SystemException;
272    
273            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
274                    throws Exception;
275    
276            public void unschedulePublishToLive(PortletRequest PortletRequest)
277                    throws Exception;
278    
279            public void unschedulePublishToRemote(PortletRequest PortletRequest)
280                    throws Exception;
281    
282            public void updateLastImportSettings(
283                            Element layoutElement, Layout layout,
284                            PortletDataContext portletDataContext)
285                    throws Exception;
286    
287            public void updateLastPublishDate(
288                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
289                    throws Exception;
290    
291            public void updateLastPublishDate(
292                            String portletId, PortletPreferences portletPreferences,
293                            Date lastPublishDate)
294                    throws Exception;
295    
296            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
297                    throws Exception;
298    
299            public void validateRemote(
300                            String remoteAddress, int remotePort, String remotePathContext,
301                            boolean secureConnection, long remoteGroupId)
302                    throws PortalException;
303    
304    }