public class CmsAliasManager extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected CmsSecurityManager |
m_securityManager
The security manager for accessing the database.
|
Constructor and Description |
---|
CmsAliasManager(CmsSecurityManager securityManager)
Creates a new alias manager instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkPermissionsForMassEdit(CmsObject cms)
Checks whether the current user has the permissions to mass edit the alias table, and throws an
exception otherwise.
|
java.util.List<CmsAlias> |
getAliasesForPath(CmsObject cms,
java.lang.String siteRoot,
java.lang.String aliasPath)
Gets the list of aliases for a path in a given site.
|
java.util.List<CmsAlias> |
getAliasesForSite(CmsObject cms,
java.lang.String siteRoot)
Gets the list of aliases for a given site root.
|
java.util.List<CmsAlias> |
getAliasesForStructureId(CmsObject cms,
CmsUUID structureId)
Gets the aliases for a given structure id.
|
java.util.List<CmsRewriteAlias> |
getRewriteAliases(CmsObject cms,
java.lang.String siteRoot)
Reads the rewrite aliases for a given site root.
|
CmsRewriteAliasMatcher |
getRewriteAliasMatcher(CmsObject cms,
java.lang.String siteRoot)
Gets the rewrite alias matcher for the given site.
|
boolean |
hasPermissionsForMassEdit(CmsObject cms,
java.lang.String siteRoot)
Checks whether the current user has permissions for mass editing the alias table.
|
protected CmsAliasImportResult |
importAlias(CmsObject cms,
java.lang.String siteRoot,
java.lang.String aliasPath,
java.lang.String vfsPath,
CmsAliasMode mode)
Imports a single alias.
|
java.util.List<CmsAliasImportResult> |
importAliases(CmsObject cms,
byte[] aliasData,
java.lang.String siteRoot,
java.lang.String separator)
Imports alias CSV data.
|
protected CmsAliasImportResult |
processAliasImport(CmsObject cms,
java.lang.String siteRoot,
java.lang.String aliasPath,
java.lang.String vfsPath,
CmsAliasMode mode)
Processes a single alias import operation which has already been parsed into fields.
|
protected CmsAliasImportResult |
processAliasLine(CmsObject cms,
java.lang.String siteRoot,
java.lang.String line,
java.lang.String separator)
Processes a line from a CSV file containing the alias data to be imported.
|
void |
saveAliases(CmsObject cms,
CmsUUID structureId,
java.util.List<CmsAlias> aliases)
Saves the aliases for a given structure id, completely replacing any existing aliases for the same structure id.
|
void |
saveRewriteAliases(CmsObject cms,
java.lang.String siteRoot,
java.util.List<CmsRewriteAlias> newAliases)
Saves the rewrite alias for a given site root.
|
void |
updateAliases(CmsObject cms,
java.util.Collection<CmsAlias> toDelete,
java.util.Collection<CmsAlias> toAdd)
Updates the aliases in the database.
|
protected CmsSecurityManager m_securityManager
public CmsAliasManager(CmsSecurityManager securityManager)
securityManager
- the security managerpublic java.util.List<CmsAlias> getAliasesForPath(CmsObject cms, java.lang.String siteRoot, java.lang.String aliasPath) throws CmsException
This should only return either an empty list or a list with a single element.
cms
- the current CMS contextsiteRoot
- the site root for which we want the aliasesaliasPath
- the alias pathCmsException
- if something goes wrongpublic java.util.List<CmsAlias> getAliasesForSite(CmsObject cms, java.lang.String siteRoot) throws CmsException
cms
- the current CMS contextsiteRoot
- the site rootCmsException
- if something goes wrongpublic java.util.List<CmsAlias> getAliasesForStructureId(CmsObject cms, CmsUUID structureId) throws CmsException
cms
- the current CMS contextstructureId
- the structure id of a resourceCmsException
- if something goes wrongpublic java.util.List<CmsRewriteAlias> getRewriteAliases(CmsObject cms, java.lang.String siteRoot) throws CmsException
cms
- the current CMS contextsiteRoot
- the site root for which the rewrite aliases should be retrievedCmsException
- if something goes wrongpublic CmsRewriteAliasMatcher getRewriteAliasMatcher(CmsObject cms, java.lang.String siteRoot) throws CmsException
cms
- the CMS context to usesiteRoot
- the site rootCmsException
- if something goes wrongpublic boolean hasPermissionsForMassEdit(CmsObject cms, java.lang.String siteRoot)
cms
- the current CMS contextsiteRoot
- the site root to checkpublic java.util.List<CmsAliasImportResult> importAliases(CmsObject cms, byte[] aliasData, java.lang.String siteRoot, java.lang.String separator) throws java.lang.Exception
cms
- the current CMS contextaliasData
- the alias datasiteRoot
- the root of the site into which the alias data should be importedseparator
- the field separator which is used by the imported datajava.lang.Exception
- if something goes wrongpublic void saveAliases(CmsObject cms, CmsUUID structureId, java.util.List<CmsAlias> aliases) throws CmsException
cms
- the current CMS contextstructureId
- the structure id of a resourcealiases
- the list of aliases which should be writtenCmsException
- if something goes wrongpublic void saveRewriteAliases(CmsObject cms, java.lang.String siteRoot, java.util.List<CmsRewriteAlias> newAliases) throws CmsException
cms
- the current CMS contextsiteRoot
- the site root for which the rewrite aliases should be savednewAliases
- the list of aliases to saveCmsException
- if something goes wrongpublic void updateAliases(CmsObject cms, java.util.Collection<CmsAlias> toDelete, java.util.Collection<CmsAlias> toAdd) throws CmsException
cms
- the current CMS contexttoDelete
- the collection of aliases to deletetoAdd
- the collection of aliases to addCmsException
- if something goes wrongprotected void checkPermissionsForMassEdit(CmsObject cms) throws CmsException
cms
- the current CMS contextCmsException
protected CmsAliasImportResult importAlias(CmsObject cms, java.lang.String siteRoot, java.lang.String aliasPath, java.lang.String vfsPath, CmsAliasMode mode) throws CmsException
cms
- the current CMS contextsiteRoot
- the site rootaliasPath
- the alias pathvfsPath
- the VFS pathmode
- the alias modeCmsException
- if something goes wrongprotected CmsAliasImportResult processAliasImport(CmsObject cms, java.lang.String siteRoot, java.lang.String aliasPath, java.lang.String vfsPath, CmsAliasMode mode)
cms
- the current CMS contextsiteRoot
- the site rootaliasPath
- the alias pathvfsPath
- the VFS resource pathmode
- the alias modeprotected CmsAliasImportResult processAliasLine(CmsObject cms, java.lang.String siteRoot, java.lang.String line, java.lang.String separator)
cms
- the current CMS contextsiteRoot
- the site rootline
- the line with the data to importseparator
- the field separator