Copyright© 2008-2026 Sitevision AB, all rights reserved.
public interface TextModuleCreator
Required configuration:
Optional configuration:
Usage example:
import createContentFactory from '@sitevision/api/server/CreateContentFactory';
// Script module and legacy apps would typically use the require function:
// const createContentFactory = require('CreateContentFactory');
const creator = createContentFactory.getTextModuleCreator();
creator
.setName('Welcome Message')
.setParent(pageNode)
.setMarkdownContent('# Welcome\n\nThis is a **welcome** message.');
// Optionally check if configuration is valid before executing
if (creator.isValid()) {
const node = creator.execute();
}
Permission requirements:
The current user must have permission to update the parent page. An exception will be
thrown during execute() if the user lacks the necessary permissions.
An instance of the Sitevision class implementing this interface can be obtained via
CreateContentFactory.getTextModuleCreator().
See CreateContentFactory for how to
obtain an instance of the CreateContentFactory interface.
| Modifier and Type | Method and Description |
|---|---|
Node |
execute()
Creates the text module with the configured settings.
|
boolean |
isValid()
Best-attempt validation of the current builder configuration.
|
TextModuleCreator |
setContent(String aContent,
ContentFormat aContentFormat)
Sets the content of the text module with an explicit format.
|
TextModuleCreator |
setMarkdownContent(String aMarkdownContent)
Sets the content of the text module using Markdown format.
|
TextModuleCreator |
setName(String aName)
Sets the display name of the text module to be created.
|
TextModuleCreator |
setParent(Node aParent)
Sets the parent node where the text module will be created.
|
TextModuleCreator setName(String aName)
The name is displayed as the portlet title and should be descriptive.
aName - The name of the text moduleTextModuleCreator setParent(Node aParent)
The parent can be either:
This is a required configuration parameter.
aParent - The parent node. Must be a valid page or content nodeTextModuleCreator setMarkdownContent(String aMarkdownContent)
This is a convenience method equivalent to calling
setContent(aMarkdownContent, ContentFormat.MARKDOWN).
The Markdown content will be parsed and converted to rich text elements.
See ContentFormat.MARKDOWN for details on supported syntax.
aMarkdownContent - The Markdown content. Must not be null or emptyTextModuleCreator setContent(String aContent, ContentFormat aContentFormat)
This method allows you to specify the content and its format explicitly. The content will be parsed according to the specified format and converted to rich text elements.
aContent - The text content. Must not be null or emptyaContentFormat - The format of the content. Must not be nullboolean isValid()
Checks if all required parameters are set and valid:
Node execute() throws IllegalStateException, ConstraintViolationException, RepositoryException
Important: This method modifies the VersionUtil.OFFLINE_VERSION
of the page content and saves the changes. The operation is performed under a lock to ensure consistency.
IllegalStateException - If the configuration is invalidConstraintViolationException - If the parent is invalid, or the user lacks permission to update the page, or the page is trashedRepositoryException - If something else goes wrongSitevision - Content Management Made Easy
Sitevision is an advanced Java enterprise portal product that implements Java Content Repository (JSR 283).
Copyright© 2008-2026 Sitevision AB, all rights reserved.