/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Date } from "../../types/java/util/Date"; import type { Publisher } from "../../types/senselogic/sitevision/api/versioning/Publisher"; import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder"; /** * Builder for creating a {@link Publisher} with a specific setup of state. * *
* Initial state of a PublisherBuilder is: *
*publishDate is null == imminent publishingunpublishDate is null == no unpublishingnotificationDate is null == no ("Best before") notificationnotifyMobileUsers is false == no mobile notification* 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");
* }
*
*
* * Tip! The {@link senselogic.sitevision.api.base.Builder Builder interface documentation} contains * more information about Builders and how to work with them! *
* *
* An instance of the Sitevision class implementing this interface can be obtained via
* {@link PublishingUtil#getPublisherBuilder()}.
* See {@link PublishingUtil} for how to obtain an instance of the PublishingUtil interface.
*
* A publish date before "now" will throw an IllegalStateException when calling {@link #build()}.
* Use null for immediate publishing.
*
* A unpublish date before "now" will throw an IllegalStateException when calling {@link #build()}. *
** A unpublish date must differ at least one minute from the actual publish date, * otherwise an IllegalStateException will be thrown when calling {@link #build()}. *
* @param aUnpublishDate the unpublish date to set, or null for no unpublishing * @return this builder instance */ setUnpublishDate(aUnpublishDate: Date): PublisherBuilder; /** * Sets the ("Best before") notification date. * ** A notification date before "now" will throw an IllegalStateException when calling {@link #build()}. *
** A notification date must be equal or after the actual publish date, * otherwise an IllegalStateException will be thrown when calling {@link #build()}. *
* @param aNotificationDate the notification date to set, or null for no notification * @return this builder instance */ setNotificationDate(aNotificationDate: Date): PublisherBuilder; /** * Whether mobile users should be notified when the page is published. * *
* Note that this setting in practice is only applicable when publishing a sv:article
* and current user must have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#SEND_PUSH_NOTIFICATIONS}
* for it to have any effect.
*