Copyright© 2008-2026 Sitevision AB, all rights reserved.
public interface Publisher
The Publisher is the powerful big brother of PublishingUtil when it comes to publishing.
When the publish convenience methods in PublishingUtil doesn't fit your needs,
you can always use the Publisher instead!
Example of how to use PublisherBuilder and Publisher to publish a page at a given time using server-side JavaScript:
// 1. Import PublishingUtil in apps (WebApp, RESTApp, Widget, MCPServer etc)
// NOTE! Use the require function instead in other server-side JavaScripts (e.g. Script module), i.e:
// const publishingUtil = require("PublishingUtil");
import publishingUtil from "@sitevision/api/server/PublishingUtil";
// 2. Create a publisher builder instance
const publisherBuilder = publishingUtil.getPublisherBuilder();
const page = ... // Get the page node to publish
const date = ... // Create a specific publish date, or null for imminent publishing
// 3. Create a publisher
const publisher = publisherBuilder
.setPublishDate(date)
.build();
// 4. Publish
try {
publisher.publish(page);
console.log("Page published successfully!");
} catch (e) {
console.log("Failed to publish page");
}
An instance of the Sitevision class implementing this interface can be obtained via PublisherBuilder.build().
See PublisherBuilder for how to obtain an instance of the PublisherBuilder interface.
PublishingUtil| Modifier and Type | Method and Description |
|---|---|
void |
publish(Node aPageNode)
Publish a given page node, using the state that was specified when the
Publisher was created. |
void publish(Node aPageNode) throws IllegalArgumentException, ConstraintViolationException, RepositoryException
Publisher was created.
Valid node types to publish are:
sv:pagesv:articlesv:collaborationGroupPagesv:sitePagesv:templatesv:link (must be a "page link", a stand-alone link in the page tree)
If a node of another node type is specified an IllegalArgumentException is thrown.
aPageNode - the node that should be published.IllegalArgumentException - if aPageNode is null or of invalid type.ConstraintViolationException - if current user is not authorized to publish aPageNode.RepositoryException - for other problems occur, such as locking failed, immutable PublishStatus or such.PermissionUtil.hasEffectivePublishPermission(Node, Node),
PublishingUtil.getPublishStatus(Node)Sitevision - 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.