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