public interface I_CmsFileNameGenerator
urlName mapping
or when using a "new" operation in the context of the direct edit interface.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MACRO_NUMBER
The "number" macro.
|
static PrintfFormat |
NUMBER_FORMAT
Format for file create parameter.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCopyFileName(CmsObject cms,
java.lang.String parentFolder,
java.lang.String baseName)
Returns a unique copy filename for the given base name and the parent folder.
|
java.lang.String |
getNewFileName(CmsObject cms,
java.lang.String namePattern,
int defaultDigits)
Generates a new file name based on the provided OpenCms user context and name pattern.
|
java.lang.String |
getNewFileName(CmsObject cms,
java.lang.String namePattern,
int defaultDigits,
boolean explorerMode)
Generates a new file name based on the provided OpenCms user context and name pattern.
|
java.lang.String |
getUniqueFileName(CmsObject cms,
java.lang.String parentFolder,
java.lang.String baseName)
Returns a unique filename for the given base name and the parent folder.
|
java.util.Iterator<java.lang.String> |
getUrlNameSequence(java.lang.String baseName)
Returns a sequence of URL name candidates for the given base name as an iterator.
|
static final java.lang.String MACRO_NUMBER
static final PrintfFormat NUMBER_FORMAT
java.lang.String getCopyFileName(CmsObject cms, java.lang.String parentFolder, java.lang.String baseName)
For example from the given baseName 'test.txt' the copy file name 'test_copy.txt' will be generated.
cms - the current OpenCms user contextparentFolder - the parent folder of the filebaseName - the base file namejava.lang.String getNewFileName(CmsObject cms, java.lang.String namePattern, int defaultDigits) throws CmsException
Used by the collector API as well as the galleries introduced with OpenCms 8 (ADE).
cms - the current OpenCms user contextnamePattern - the pattern to be used when generating the new resource namedefaultDigits - the default number of digits to use for numbering the created file namesCmsException - in case something goes wrongjava.lang.String getNewFileName(CmsObject cms, java.lang.String namePattern, int defaultDigits, boolean explorerMode) throws CmsException
Used by the collector API as well as the galleries introduced with OpenCms 8 (ADE).
cms - the current OpenCms user contextnamePattern - the pattern to be used when generating the new resource namedefaultDigits - the default number of digits to use for numbering the created file namesexplorerMode - if true, tries the name without a number, and also automatically inserts an underscore before the numberCmsException - in case something goes wrongjava.lang.String getUniqueFileName(CmsObject cms, java.lang.String parentFolder, java.lang.String baseName)
cms - the current OpenCms user contextparentFolder - the parent folder of the filebaseName - the proposed file namejava.util.Iterator<java.lang.String> getUrlNameSequence(java.lang.String baseName) throws CmsException
This is used by the urlName mapping of XML contents which enable SEO friendly URLs
automatically generated for example from the resource title.
Usually the first URL name from this sequence which does not already exist for a different resource will be used for the URL name mapping.
baseName - the base nameCmsException - if something goes wrong