/** * Publishes the current project and waits until it finishes.<p> * * @throws Exception if something goes wrong */ public void publishProjectAndWait() throws Exception { OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
/** * Publishes the current project and waits until it finishes.<p> * * @throws Exception if something goes wrong */ public void publishProjectAndWait() throws Exception { OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
/** * Removes the given resources from the user's publish list.<p> * * @param idsToRemove list of structure ids identifying the resources to be removed * * @throws CmsException if something goes wrong */ public void removeResourcesFromPublishList(Collection<CmsUUID> idsToRemove) throws CmsException { OpenCms.getPublishManager().removeResourceFromUsersPubList(m_cms, idsToRemove); }
/** * Returns a publish list with all new/changed/deleted resources of the current (offline) * project that actually get published.<p> * * @return a publish list * * @throws CmsException if something goes wrong * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject) getPublishList(CmsObject)}</code> instead */ public CmsPublishList getPublishList() throws CmsException { return OpenCms.getPublishManager().getPublishList(this); }
/** * @see org.opencms.ade.publish.I_CmsVirtualProject#getResources(org.opencms.file.CmsObject, java.util.Map, java.lang.String) */ public List<CmsResource> getResources(CmsObject cms, Map<String, String> params, String workflowId) { try { return Lists.newArrayList(OpenCms.getPublishManager().getUsersPubList(cms)); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return Lists.newArrayList(); } }
/** * Returns a publish list with all new/changed/deleted resources of the current (offline) * project that actually get published for a direct publish of a single resource.<p> * * @param directPublishResource the resource which will be directly published * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct * published resource should also get published. * * @return a publish list * * @throws CmsException if something goes wrong * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, CmsResource, boolean) getPublishList(CmsObject, CmsResource, boolean)}</code> instead */ public CmsPublishList getPublishList(CmsResource directPublishResource, boolean directPublishSiblings) throws CmsException { return OpenCms.getPublishManager().getPublishList(this, directPublishResource, directPublishSiblings); }
/** * Returns a publish list with all new/changed/deleted resources of the current (offline) * project that actually get published for a direct publish of a List of resources.<p> * * @param directPublishResources the resources which will be directly published * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct * published resources should also get published. * * @return a publish list * * @throws CmsException if something goes wrong * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, List, boolean) getPublishList(CmsObject, List, boolean)}</code> instead */ public CmsPublishList getPublishList(List directPublishResources, boolean directPublishSiblings) throws CmsException { return OpenCms.getPublishManager().getPublishList(this, directPublishResources, directPublishSiblings, true); }
/** * Publishes the resources of a specified publish list.<p> * * @param report an instance of <code>{@link I_CmsReport}</code> to print messages * @param publishList a publish list * * @return the publish history id of the published project * * @throws CmsException if something goes wrong * * @see #getPublishList() * @see #getPublishList(CmsResource, boolean) * @see #getPublishList(List, boolean) * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject, I_CmsReport, CmsPublishList) publishProject(CmsObject, I_CmsReport, CmsPublishList)}</code> instead */ public CmsUUID publishProject(I_CmsReport report, CmsPublishList publishList) throws CmsException { CmsUUID publishHistoryId = OpenCms.getPublishManager().publishProject(this, report, publishList); OpenCms.getPublishManager().waitWhileRunning(); return publishHistoryId; }
/** * Publishes the current project.<p> * * @param report an instance of <code>{@link I_CmsReport}</code> to print messages * * @return the publish history id of the published project * * @throws CmsException if something goes wrong * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject, I_CmsReport) publishProject(CmsObject, I_CmsReport)}</code> instead */ public CmsUUID publishProject(I_CmsReport report) throws CmsException { CmsUUID publishHistoryId = OpenCms.getPublishManager().publishProject( this, report, OpenCms.getPublishManager().getPublishList(this)); OpenCms.getPublishManager().waitWhileRunning(); return publishHistoryId; }
/** * Publishes a single resource.<p> * * @param resourcename the name of the resource to be published * @param publishSiblings if <code>true</code>, all siblings of the resource are also published * @param report the report to write the progress information to * * @return the publish history id of the published project * * @throws Exception if something goes wrong * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishResource(CmsObject, String, boolean, I_CmsReport) publishResource(CmsObject, String, boolean, I_CmsReport)}</code> instead */ public CmsUUID publishResource(String resourcename, boolean publishSiblings, I_CmsReport report) throws Exception { CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL); CmsUUID publishHistoryId = OpenCms.getPublishManager().publishProject(this, report, resource, publishSiblings); OpenCms.getPublishManager().waitWhileRunning(); return publishHistoryId; }
/** * Publishes the current project, printing messages to a shell report.<p> * * @return the publish history id of the published project * * @throws Exception if something goes wrong * * @see CmsShellReport * * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject) publishProject(CmsObject)}</code> instead */ public CmsUUID publishProject() throws Exception { CmsUUID publishHistoryId = OpenCms.getPublishManager().publishProject( this, new CmsShellReport(m_context.getLocale())); OpenCms.getPublishManager().waitWhileRunning(); return publishHistoryId; }
/** * @see org.opencms.workflow.A_CmsWorkflowManager#initialize(org.opencms.file.CmsObject) */ @Override public void initialize(CmsObject adminCms) { super.initialize(adminCms); OpenCms.getPublishManager().addPublishListener(new CmsPublishEventAdapter() { @Override public void onFinish(CmsPublishJobRunning publishJob) { CmsExtendedWorkflowManager.this.onFinishPublishJob(publishJob); } /** * @see org.opencms.publish.CmsPublishEventAdapter#onStart(org.opencms.publish.CmsPublishJobEnqueued) */ @Override public void onStart(CmsPublishJobEnqueued publishJob) { CmsExtendedWorkflowManager.this.onStartPublishJob(publishJob); } }); }
/** * Called when the queue is full to remove the oldest element.<p> * * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove() */ @Override public Object remove() { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove(); try { OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob); } catch (CmsException exc) { if (LOG.isErrorEnabled()) { LOG.error(exc.getLocalizedMessage(), exc); } } return publishJob; } }, CmsPublishJobInfoBean.class));
/** * Called when the queue is full to remove the oldest element.<p> * * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove() */ @Override public Object remove() { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove(); try { OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob); } catch (CmsException exc) { if (LOG.isErrorEnabled()) { LOG.error(exc.getLocalizedMessage(), exc); } } return publishJob; } }, CmsPublishJobInfoBean.class));
/** * Publishes the given list of resources.<p> * * @param resources list of resources to publish * * @throws CmsException if something goes wrong */ public void publishResources(List<CmsResource> resources) throws CmsException { CmsObject cms = m_cms; I_CmsReport report = new CmsHtmlReport( cms.getRequestContext().getLocale(), cms.getRequestContext().getSiteRoot()); CmsPublishManager publishManager = OpenCms.getPublishManager(); CmsPublishList publishList = publishManager.getPublishListAll(m_cms, resources, false, true); OpenCms.getPublishManager().publishProject(m_cms, report, publishList); }
/** * @see org.opencms.workplace.editors.I_CmsEditorActionHandler#isButtonActive(CmsJspActionElement, java.lang.String) */ public boolean isButtonActive(CmsJspActionElement jsp, String resourceName) { try { OpenCms.getPublishManager().getPublishList( jsp.getCmsObject(), jsp.getCmsObject().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION), false); return true; } catch (Exception e) { return false; } } }
/** * @see org.opencms.workplace.editors.I_CmsEditorActionHandler#isButtonActive(CmsJspActionElement, java.lang.String) */ public boolean isButtonActive(CmsJspActionElement jsp, String resourceName) { try { OpenCms.getPublishManager().getPublishList( jsp.getCmsObject(), jsp.getCmsObject().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION), false); return true; } catch (Exception e) { return false; } } }
/** * @see org.opencms.workplace.CmsMultiDialog#performDialogOperation() */ @Override protected boolean performDialogOperation() throws CmsException { CmsPublishList publishList = getSettings().getPublishList(); if (publishList == null) { throw new CmsException( Messages.get().container(org.opencms.db.Messages.ERR_GET_PUBLISH_LIST_PROJECT_1, getProjectname())); } OpenCms.getPublishManager().publishProject( getCms(), new CmsHtmlReport(getLocale(), getCms().getRequestContext().getSiteRoot()), publishList); // wait 2 seconds, may be it finishes fast OpenCms.getPublishManager().waitWhileRunning(1500); return true; }
/** * @see org.opencms.workplace.CmsMultiDialog#performDialogOperation() */ @Override protected boolean performDialogOperation() throws CmsException { CmsPublishList publishList = getSettings().getPublishList(); if (publishList == null) { throw new CmsException(Messages.get().container( org.opencms.db.Messages.ERR_GET_PUBLISH_LIST_PROJECT_1, getProjectname())); } OpenCms.getPublishManager().publishProject( getCms(), new CmsHtmlReport(getLocale(), getCms().getRequestContext().getSiteRoot()), publishList); // wait 2 seconds, may be it finishes fast OpenCms.getPublishManager().waitWhileRunning(1500); return true; }
/** * Starts the publish thread for the project.<p> */ private void startPublishThread() { // create a publish thread from the current publish list CmsPublishList publishList = getSettings().getPublishList(); try { OpenCms.getPublishManager().publishProject( getCms(), new CmsHtmlReport(getLocale(), getCms().getRequestContext().getSiteRoot()), publishList); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer()); } setParamAction(REPORT_END); setAction(ACTION_REPORT_END); setParamThreadHasNext(CmsStringUtil.FALSE); }