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