/** * Publishes the current project.<p> * * @param cms the cms request context * @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 */ public CmsUUID publishProject(CmsObject cms, I_CmsReport report) throws CmsException { return publishProject(cms, report, getPublishList(cms)); }
/** * Publishes the current project.<p> * * @param cms the cms request context * @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 */ public CmsUUID publishProject(CmsObject cms, I_CmsReport report) throws CmsException { return publishProject(cms, report, getPublishList(cms)); }
/** * Publishes a single resource.<p> * * @param cms the cms request context * @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 */ public CmsUUID publishResource(CmsObject cms, String resourcename, boolean publishSiblings, I_CmsReport report) throws Exception { CmsResource resource = cms.readResource(resourcename, CmsResourceFilter.ALL); return publishProject(cms, report, resource, publishSiblings); }
/** * Publishes a single resource.<p> * * @param cms the cms request context * @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 */ public CmsUUID publishResource(CmsObject cms, String resourcename, boolean publishSiblings, I_CmsReport report) throws Exception { CmsResource resource = cms.readResource(resourcename, CmsResourceFilter.ALL); return publishProject(cms, report, resource, publishSiblings); }
/** * Direct publishes a specified resource.<p> * * @param cms the cms request context * @param report an instance of <code>{@link I_CmsReport}</code> to print messages * @param directPublishResource a <code>{@link CmsResource}</code> that gets directly published; * or <code>null</code> if an entire project gets published. * @param directPublishSiblings if a <code>{@link CmsResource}</code> that should get published directly is * provided as an argument, all eventual siblings of this resource * get publish too, if this flag is <code>true</code>. * * @return the publish history id of the published project * * @throws CmsException if something goes wrong */ public CmsUUID publishProject( CmsObject cms, I_CmsReport report, CmsResource directPublishResource, boolean directPublishSiblings) throws CmsException { return publishProject(cms, report, getPublishList(cms, directPublishResource, directPublishSiblings)); }
/** * Direct publishes a specified resource.<p> * * @param cms the cms request context * @param report an instance of <code>{@link I_CmsReport}</code> to print messages * @param directPublishResource a <code>{@link CmsResource}</code> that gets directly published; * or <code>null</code> if an entire project gets published. * @param directPublishSiblings if a <code>{@link CmsResource}</code> that should get published directly is * provided as an argument, all eventual siblings of this resource * get publish too, if this flag is <code>true</code>. * * @return the publish history id of the published project * * @throws CmsException if something goes wrong */ public CmsUUID publishProject( CmsObject cms, I_CmsReport report, CmsResource directPublishResource, boolean directPublishSiblings) throws CmsException { return publishProject(cms, report, getPublishList(cms, directPublishResource, directPublishSiblings)); }
/** * 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(); }
/** * Publishes the current project, printing messages to a shell report.<p> * * @param cms the cms request context * @return the publish history id of the published project * * @throws Exception if something goes wrong * * @see CmsShellReport */ public CmsUUID publishProject(CmsObject cms) throws Exception { return publishProject(cms, new CmsShellReport(cms.getRequestContext().getLocale())); }
/** * Publishes the current project, printing messages to a shell report.<p> * * @param cms the cms request context * @return the publish history id of the published project * * @throws Exception if something goes wrong * * @see CmsShellReport */ public CmsUUID publishProject(CmsObject cms) throws Exception { return publishProject(cms, new CmsShellReport(cms.getRequestContext().getLocale())); }
/** * 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 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; }
/** * 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 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); }
/** * 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); }
/** * @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; }
/** * Imports a folder or a ZIP file to the root folder of the * current site, creating a temporary project for this.<p> * * @param importFile the absolute path of the import resource * @throws Exception if something goes wrong */ public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
/** * Imports a folder or a ZIP file to the root folder of the * current site, creating a temporary project for this.<p> * * @param importFile the absolute path of the import resource * @throws Exception if something goes wrong */ public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }