Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="PageUtil") public interface PageUtil extends VelocityAccess.PageUtilConstants
sv:page
.
Note! This interface is used to create and update pages. You would typically use
StructureUtil
to move a page
and TrashcanUtil
to delete a page.
WebContentUtil
can be used to update the content
of a page.
Important note! Methods in this interface operates in the
VersionUtil.OFFLINE_VERSION
.
Hence, if you create a page, updates the name of a page or such, the page must be published
(see PublishingUtil
) to have any effect in the
VersionUtil.ONLINE_VERSION
An instance of the Sitevision class implementing this interface can be obtained via Utils.getPageUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_CREATED_BY
Name of the property specifying the creator of the page.
|
static String |
PROPERTY_CREATION_DATE
Name of the property specifying the creation date of the page.
|
static String |
PROPERTY_LAST_MODIFIED_BY
Name of the property specifying the last modifier of the page.
|
static String |
PROPERTY_LAST_MODIFIED_DATE
Name of the property specifying the last modified date of the page.
|
static String |
PROPERTY_LAST_PUBLISH_DATE
Name of the property specifying the last published date of a page.
|
static String |
PROPERTY_LAST_PUBLISHED_BY
Name of the property specifying the last publisher of a page.
|
static String |
PROPERTY_LOCALE
Name of the property specifying locale used by the page.
|
static String |
PROPERTY_PUBLISH_DATE
Name of the property specifying the published date of a page.
|
static String |
PROPERTY_PUBLISHED_BY
Name of the property specifying the publisher of a page.
|
static String |
PROPERTY_ROBOTS_INDEX
Name of the property specifying if the page is indexable.
|
static String |
PROPERTY_SHORTID
Name of the property specifying the short id for a page.
|
static String |
PROPERTY_TITLE
Name of the property specifying the title of a page.
|
static String |
PROPERTY_VISIBLE_IN_MENUS
Name of the property specifying if a page is visible in menus.
|
Modifier and Type | Method and Description |
---|---|
Node |
createPage(Node aParent,
Node aTemplate,
String aName)
Creates a page as sub node to the specified parent.
|
Node |
createPage(Node aParent,
Node aTemplate,
String aName,
Map<String,Object> properties,
Map<String,String> content)
Creates a page with properties and web content.
|
void |
renamePage(Node aPage,
String aName)
Alters the name of a page.
|
void |
updatePage(Node aPage,
Map<String,Object> properties)
Updates the properties of a page.
|
getPROPERTY_CREATED_BY, getPROPERTY_CREATION_DATE, getPROPERTY_LAST_MODIFIED_BY, getPROPERTY_LAST_MODIFIED_DATE, getPROPERTY_LAST_PUBLISH_DATE, getPROPERTY_LAST_PUBLISHED_BY, getPROPERTY_LOCALE, getPROPERTY_PUBLISH_DATE, getPROPERTY_PUBLISHED_BY, getPROPERTY_ROBOTS_INDEX, getPROPERTY_SHORTID, getPROPERTY_TITLE, getPROPERTY_VISIBLE_IN_MENUS
static final String PROPERTY_VISIBLE_IN_MENUS
visibleInMenus
.
The property value must be of type Boolean
.
static final String PROPERTY_TITLE
title
.
The property value must be of type String
.
static final String PROPERTY_SHORTID
shortId
.
The property value must be of type String
.
static final String PROPERTY_LOCALE
locale
.
The property value must be of type Locale
or a String
that can be resolved to a non-null Locale
via LocaleUtil.getLocaleByString(String)
.
static final String PROPERTY_ROBOTS_INDEX
robotsIndex
.
The property value must be of type Boolean
.
static final String PROPERTY_CREATION_DATE
creationDate
.
The property value must be of type Date
or a String
on format yyyy-MM-dd HH:mm:ss where
HH:mm:ss is optional (defaults to 00:00:00).
static final String PROPERTY_CREATED_BY
createdBy
.
The property value must be a Node
with primary node type sv:user or sv:systemUser.
static final String PROPERTY_LAST_MODIFIED_DATE
lastModifiedDate
.
The property value must be of type Date
or a String
on format yyyy-MM-dd HH:mm:ss where
HH:mm:ss is optional (defaults to 00:00:00).
static final String PROPERTY_LAST_MODIFIED_BY
lastModifiedBy
.
The property value must be of type Node
of type sv:user or sv:systemUser.
static final String PROPERTY_LAST_PUBLISH_DATE
lastPublishDate
.
The property value must be of type Date
or a String
on format yyyy-MM-dd HH:mm:ss, where
HH:mm:ss is optional (defaults to 00:00:00).
static final String PROPERTY_LAST_PUBLISHED_BY
lastPublishedBy
.
The property value must be a Node
with primary node type sv:user or sv:systemUser.
static final String PROPERTY_PUBLISH_DATE
publishDate
.
The property value must be of type Date
or a String
on format yyyy-MM-dd HH:mm:ss, where
HH:mm:ss is optional (defaults to 00:00:00).
static final String PROPERTY_PUBLISHED_BY
publishedBy
.
The property value must be a Node
with primary node type sv:user or sv:systemUser.
Node createPage(Node aParent, Node aTemplate, String aName) throws ConstraintViolationException, RepositoryException
Creates a page as sub node to the specified parent.
The parent may be either a sv:sitePage
, sv:page
, sv:folder
, sv:article
or a
sv:collaborationGroupPage
.
If other parent is specified a ConstraintViolationException
is thrown.
Any name can be given a page, it should however not contain the character '/'.
If no parent, no template or no name is specified a NullPointerException
is thrown.
The current user must be authorized to create pages, layouts and to do write operations on the parent node or
a ConstraintViolationException
will be thrown.
Note that a new page inherits metadata and permissions from its parent.
Use WebContentUtil.updateContent(javax.jcr.Node, java.util.Map)
to add content to the new page.
aParent
- the parent node of the page. May not be null
aTemplate
- the template used for the page. May not be null
aName
- the name of the sv:page. May not be null
null
ConstraintViolationException
- if an invalid parent is specified or if the current user
is not authorized to create a pageRepositoryException
- if something else goes wrongcreatePage(javax.jcr.Node, javax.jcr.Node, String, java.util.Map, java.util.Map)
Node createPage(Node aParent, Node aTemplate, String aName, Map<String,Object> properties, Map<String,String> content) throws ConstraintViolationException, RepositoryException
Creates a page with properties and web content.
The parent may be either a sv:sitePage
, sv:page
, sv:folder
, sv:article
or a sv:collaborationGroupPage
.
If other parent is specified a ConstraintViolationException
is thrown.
It is possible to provide the web content for the page as well as page properties.
Properties:
PROPERTY_VISIBLE_IN_MENUS
PROPERTY_TITLE
PROPERTY_SHORTID
- If the short id is already used by an other Sitevision node an IllegalArgumentException
is thrown
PROPERTY_LOCALE
PROPERTY_ROBOTS_INDEX
PROPERTY_CREATION_DATE
PROPERTY_CREATED_BY
PROPERTY_LAST_MODIFIED_DATE
PROPERTY_LAST_MODIFIED_BY
PROPERTY_LAST_PUBLISH_DATE
PROPERTY_LAST_PUBLISHED_BY
PROPERTY_PUBLISH_DATE
PROPERTY_PUBLISHED_BY
If an invalid value is provided for a property, an IllegalArgumentException
is thrown
Default values:
PROPERTY_VISIBLE_IN_MENUS
- truePROPERTY_TITLE
- ""PROPERTY_SHORTID
- "" (a short id will be generated by Sitevision)PROPERTY_LOCALE
- parent localePROPERTY_ROBOTS_INDEX
- truePROPERTY_CREATION_DATE
- current time stampPROPERTY_CREATED_BY
- current userPROPERTY_LAST_MODIFIED_DATE
- current time stampPROPERTY_LAST_MODIFIED_BY
- current userPROPERTY_LAST_PUBLISH_DATE
- null (will not have a value)PROPERTY_LAST_PUBLISHED_BY
- null (will not have a value)PROPERTY_PUBLISH_DATE
- null (will not have a value)PROPERTY_PUBLISHED_BY
- null (will not have a value)The page content is specified using the
content map containing keys corresponding to layout names (e.g. "mittenspalt") on the page and values containing the
HTML used to generate a portlet structure in the layout. The provided content is converted to
Sitevision text, table and image modules. It is also possible to specify that a horizontal or a vertical
layout should be created. For more information about the HTML to portlet mapping can be found in the
WebContentUtil
javadoc.
Any name can be given a page, it should however not contain the character '/'.
If no parent, no template or no name is specified a NullPointerException
is thrown.
The current user must be authorized to create pages, layouts and to do write operations on the parent node or
a ConstraintViolationException
will be thrown.
Note that a new page inherits metadata and permissions from its parent.
aParent
- the parent node of the page. May not be null
aTemplate
- the sv:template node to be used for the page. May not be null
aName
- the name of the sv:page. May not be null
properties
- the page properties. May be null
content
- a map containing the HTML content. The keys must correspond to layout names on the node. May be null
null
ConstraintViolationException
- if an invalid parent is specified or if the current user
is not authorized to create the pageRepositoryException
- if something else goes wrongcreatePage(javax.jcr.Node, javax.jcr.Node, String)
void updatePage(Node aPage, Map<String,Object> properties) throws ConstraintViolationException, RepositoryException
Updates the properties of a page. If no page is specified a NullPointerException
is thrown. If the node is not a sv:page an IllegalArgumentException
is thrown.
Properties:
PROPERTY_VISIBLE_IN_MENUS
PROPERTY_TITLE
PROPERTY_SHORTID
- If the short id is already used by an other Sitevision node an IllegalArgumentException
is thrown
PROPERTY_LOCALE
PROPERTY_ROBOTS_INDEX
PROPERTY_CREATION_DATE
PROPERTY_CREATED_BY
PROPERTY_LAST_MODIFIED_DATE
PROPERTY_LAST_MODIFIED_BY
PROPERTY_LAST_PUBLISH_DATE
PROPERTY_LAST_PUBLISHED_BY
PROPERTY_PUBLISH_DATE
PROPERTY_PUBLISHED_BY
If an invalid value is provided for a property, an IllegalArgumentException
is thrown.
The current user must be authorized to do write operations on the page or
a ConstraintViolationException
will be thrown.
If no properties map is specified a NullPointerException
is thrown.
aPage
- the sv:page that will be altered. May not be null
properties
- the page properties. May not be null
ConstraintViolationException
- if the current user is not authorized to alter the pageRepositoryException
- if something else goes wrongvoid renamePage(Node aPage, String aName) throws ConstraintViolationException, RepositoryException
Alters the name of a page. If no page is specified a NullPointerException
is thrown. If the node is not a sv:page an IllegalArgumentException
is thrown.
Any name can be given a page, it should however not contain the character '/'. If null
is
provided a NullPointerException
is thrown.
The current user must be authorized to do write operations on the page or
a ConstraintViolationException
will be thrown.
aPage
- the page that should be renamed. May not be null
aName
- the new name of the page. May not be null
ConstraintViolationException
- if the current user is not authorized to alter the name of the
pageRepositoryException
- if something else goes wrongSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.