close

Filter

loading table of contents...

Site Manager Developer Manual / Version 2210

Table Of Contents

4.9 Program Own ResourceNamingFactory Classes

A resource naming factory creates and modifies names of resources and folders. This is intended to enable customization of how resources and folders are named or renamed in different projects.

Interface to implement

Own resource naming factories must implement hox.corem.editor.ResourceNamingFactory. Please read the Editor API for more details.

Classes to subclass

The easiest way to write own resource naming factories is to subclass BasicResourceNamingFactory and to overwrite the appropriate methods. Please read the Editor API for more details.

Integrate your resource naming factory into the Site Manager using editor.xml

You can integrate your resource naming factory into the Site Manager using the attribute class of the ResourceNamingFactory element as shown in Example 4.15, “How to integrate a resource naming factory”.

<Editor>
	<ResourceNamingFactory class="MyResourceNames"/>
	.
	.
</Editor>

Example 4.15. How to integrate a resource naming factory


Example:

The following example shows a simple resource naming factory which allows only documents with the name "image" within the Test directory.

public MyResourceNames extends BasicResourceNamingFactory {
public boolean isValidResourceName(FolderModel folder,
ResourceTypeModel resourceType,
String name) {
return !(!folder.getName().equals("Test") || "image".equals(name)) 
&& super.isValidResourceName(folder, resourceType, name);
}
}

Example 4.16. Example of a resource naming factory


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.