/** * Checks whether the content for the resource being imported exists either in the VFS or in the import file.<p> * * @param resource the resource which should be checked * * @return true if the content exists in the VFS or import file */ private boolean hasContentInVfsOrImport(CmsResource resource) { if (m_contentFiles.contains(resource.getResourceId())) { return true; } try { List<CmsResource> resources = getCms().readSiblings(resource, CmsResourceFilter.ALL); if (!resources.isEmpty()) { return true; } } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } return false; }
/** * Sets the userLastModified.<p> * * @param userLastModified the userLastModified to set * * @see #N_USERLASTMODIFIED * @see #addResourceAttributesRules(Digester, String) */ public void setUserLastModified(String userLastModified) { try { String userLastModifiedName = OpenCms.getImportExportManager().translateUser(userLastModified); try { m_userLastModified = getCms().readUser(userLastModifiedName).getId(); } catch (CmsDbEntryNotFoundException e) { m_userLastModified = getCms().getRequestContext().getCurrentUser().getId(); } } catch (Throwable e) { setThrowable(e); } }
/** * Sets the userCreated.<p> * * @param userCreated the userCreated to set * * @see #N_USERCREATED * @see #addResourceAttributesRules(Digester, String) */ public void setUserCreated(String userCreated) { try { String userCreatedName = OpenCms.getImportExportManager().translateUser(userCreated); try { m_userCreated = getCms().readUser(userCreatedName).getId(); } catch (CmsDbEntryNotFoundException e) { m_userCreated = getCms().getRequestContext().getCurrentUser().getId(); } } catch (Throwable e) { setThrowable(e); } }
/** * Sets the userCreated.<p> * * @param userCreated the userCreated to set * * @see #N_USERCREATED * @see #addResourceAttributesRules(Digester, String) */ public void setUserCreated(String userCreated) { try { String userCreatedName = OpenCms.getImportExportManager().translateUser(userCreated); try { m_userCreated = getCms().readUser(userCreatedName).getId(); } catch (CmsDbEntryNotFoundException e) { m_userCreated = getCms().getRequestContext().currentUser().getId(); } } catch (Throwable e) { setThrowable(e); } }
/** * Imports an ACE from the current xml data.<p> * * @see #addResourceAceRules(Digester, String) */ public void importAccessControlEntries() { // only set permissions if the resource did not exists or if the keep permissions flag is not set if ((m_resource == null) || !m_importACEs) { return; } if ((m_aces == null) || (m_aces.size() == 0)) { // no ACE in the list return; } // if the resource was imported add the access control entries if available try { getCms().importAccessControlEntries(m_resource, m_aces); } catch (CmsException exc) { getReport().println( Messages.get().container(Messages.RPT_IMPORT_ACL_DATA_FAILED_0), I_CmsReport.FORMAT_WARNING); } finally { m_aces = null; } }
/** * Imports an ACE from the current xml data.<p> * * @see #addResourceAceRules(Digester, String) */ public void importAccessControlEntries() { // only set permissions if the resource did not exists or if the keep permissions flag is not set if ((m_resource == null) || !m_importACEs) { return; } if ((m_aces == null) || (m_aces.size() == 0)) { // no ACE in the list return; } // if the resource was imported add the access control entries if available try { getCms().importAccessControlEntries(m_resource, m_aces); } catch (CmsException exc) { getReport().println( Messages.get().container(Messages.RPT_IMPORT_ACL_DATA_FAILED_0), I_CmsReport.FORMAT_WARNING); } finally { m_aces = null; } }
/** * Sets the userLastModified.<p> * * @param userLastModified the userLastModified to set * * @see #N_USERLASTMODIFIED * @see #addResourceAttributesRules(Digester, String) */ public void setUserLastModified(String userLastModified) { try { String userLastModifiedName = OpenCms.getImportExportManager().translateUser(userLastModified); try { m_userLastModified = getCms().readUser(userLastModifiedName).getId(); } catch (CmsDbEntryNotFoundException e) { m_userLastModified = getCms().getRequestContext().currentUser().getId(); } } catch (Throwable e) { setThrowable(e); } }
if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) { principal = OpenCms.getImportExportManager().translateGroup(principal); principalId = getCms().readGroup(principal).getId(); } else if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_USER)) { principal = OpenCms.getImportExportManager().translateUser(principal); principalId = getCms().readUser(principal).getId(); } else if (acePrincipalId.startsWith(CmsRole.PRINCIPAL_ROLE)) { principalId = CmsRole.valueOfRoleName(principal).getId();
if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) { principal = OpenCms.getImportExportManager().translateGroup(principal); principalId = getCms().readGroup(principal).getId(); } else if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_USER)) { principal = OpenCms.getImportExportManager().translateUser(principal); principalId = getCms().readUser(principal).getId(); } else if (acePrincipalId.startsWith(CmsRole.PRINCIPAL_ROLE)) { principalId = CmsRole.valueOfRoleName(principal).getId();
LOG.warn(Messages.get().getBundle().key( Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_RELATION_1, getCms().getRequestContext().removeSiteRoot(m_resource.getRootPath())), m_throwable);
Messages.get().getBundle().key( Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_RELATION_1, getCms().getRequestContext().removeSiteRoot(m_resource.getRootPath())), m_throwable);
LOG.warn(Messages.get().getBundle().key( Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1, getCms().getRequestContext().removeSiteRoot(m_resource.getRootPath())), m_throwable);
Messages.get().getBundle().key( Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1, getCms().getRequestContext().removeSiteRoot(m_resource.getRootPath())), m_throwable);
/** * Rewrites all parseable files, to assure link check.<p> * * This is a global process, that is executed only once at the * end of the import to be sure that all link targets are * available.<p> * * @see #addXmlDigesterRules(Digester) */ public void rewriteParseables() { if (m_parseables.isEmpty()) { return; } I_CmsReport report = getReport(); CmsObject cms = getCms(); cms.getRequestContext().setAttribute(CmsLogEntry.ATTR_LOG_ENTRY, Boolean.FALSE); report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE); parseLinks(cms, report); report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE); m_parseables = null; }