Copyright© 2008-2024 Sitevision AB, all rights reserved.
@Requireable(value="Utils") public interface Utils
An instance of this interface can be obtained from your portlet via the request attribute "sitevision.utils
".
Once you have obtained an Utils
instance, you can use it to retrieve instances of all other interfaces in the Sitevision API.
In all JCR capable portlets that are bundled with Sitevision and exposes a "Custom template", you always have an Utils
instance
available as "$sitevisionUtils
" in the VelocityContext.
Example of how to get hold of a PropertyUtil
instance from your JSR 286 portlet:
Utils utils = (Utils) aRequest.getAttribute("sitevision.utils");
PropertyUtil propertyUtil = utils.getPropertyUtil();
...
propertyUtil.get...
Example of how to get hold of a PropertyUtil
instance in Velocity for a JCR capable
standard Sitevision portlet with a "Custom template" (e.g. the JCR Menu portlet):
#set($propertyUtil = $sitevisionUtils.propertyUtil)
...
$propertyUtil.get...
If sitevisionUtils is not available on the VelocityContext, you can use the PortletRequest instead if available (e.g. the Script portlet):
#set($propertyUtil = $request.getAttribute('sitevision.utils').propertyUtil)
Modifier and Type | Method and Description |
---|---|
AliasUtil |
getAliasUtil()
Gets an instance of an alias utility class.
|
ArchiveUtil |
getArchiveUtil()
Gets an instance of an archive utility class
|
ArticleUtil |
getArticleUtil()
Gets an instance of an article utility class
|
AuthenticationUtil |
getAuthenticationUtil()
Gets an instance of an authentication utility class
|
BookmarkUtil |
getBookmarkUtil()
Gets an instance of a bookmark utility class
|
BuddyIconRenderer |
getBuddyIconRenderer()
Creates and returns a new instance of a stateful buddy icon renderer.
|
ClientUtil |
getClientUtil()
Gets an instance of a client utility class
|
CollaborationFactory |
getCollaborationFactory()
Gets an instance of a factory for collaboration-related instances.
|
ColorUtil |
getColorUtil()
Gets an instance of a color utility class
|
ContentNodeUtil |
getContentNodeUtil()
Gets an instance of a content node utility class.
|
CurrencyFactory |
getCurrencyFactory()
Gets an instance of a currency factory class.
|
DateUtil |
getDateUtil()
Gets an instance of an date utility class.
|
DecorationUtil |
getDecorationUtil()
Gets an instance of a decoration utility class
|
DeviceUtil |
getDeviceUtil()
Gets an instance of a device utility class
|
DirectoryUtil |
getDirectoryUtil()
Gets an instance of a directory utility class
|
DocTypeUtil |
getDocTypeUtil()
Gets an instance of a DOCTYPE utility class
|
EndecUtil |
getEndecUtil()
Gets an instance of an encode/decode utility class
|
ExceptionSuppressingCollection |
getExceptionSuppressingCollection(Collection aCollection)
Creates and returns an instance of a collection decorator that exposes an exception-suppressing iterator.
|
ExceptionSuppressingIterator |
getExceptionSuppressingIterator(Iterator anIterator)
Creates and returns an instance of an exception-suppressing iterator that returns exception-suppressing dynamic proxys.
|
ExceptionSuppressingProxy |
getExceptionSuppressingProxy(Object anObject)
Creates and returns an instance of an exception-suppressing proxy.
|
FileIconRenderer |
getFileIconRenderer()
Creates and returns a new instance of a stateful file icon renderer.
|
FileUtil |
getFileUtil()
Gets an instance of a file utility class
|
FolderUtil |
getFolderUtil()
Gets an instance of a folder utility class
|
FontUtil |
getFontUtil()
Gets an instance of a font utility class
|
FormatterBuilderFactory |
getFormatterBuilderFactory()
Gets an instance of a formatter builder factory class.
|
IconUtil |
getIconUtil()
Gets an instance of an icon utility class
|
ImageLinkRenderer |
getImageLinkRenderer()
Creates and returns a new instance of a stateful image link renderer.
|
ImageRenderer |
getImageRenderer()
Creates and returns a new instance of a stateful image renderer.
|
ImageScaler |
getImageScaler(int aMaxWidth,
int aMaxHeight)
Gets an instance of an immutable image scaler that enables scaling of images to a certain size.
|
ImageUtil |
getImageUtil()
Gets an instance of an image utility class
|
InstanceCreatorUtil |
getInstanceCreatorUtil()
Gets an instance of an instance creator utility class.
|
InstanceTypeUtil |
getInstanceTypeUtil()
Gets an instance of an instance type utility class
|
LandingPageUtil |
getLandingPageUtil()
Gets an instance of a landing page utility class.
|
LinkRenderer |
getLinkRenderer()
Creates and returns a new instance of a stateful link renderer.
|
LocaleUtil |
getLocaleUtil()
Gets an instance of a locale utility class.
|
LogUtil |
getLogUtil()
Gets an instance of a logging utility class
|
MailUtil |
getMailUtil()
Gets an instance of a mail utility class.
|
MessageDigesterFactory |
getMessageDigesterFactory()
Gets an instance of a message digester factory class.
|
MessagesFactory |
getMessagesFactory()
Gets an instance of a messages factory class.
|
MetadataDefinitionUtil |
getMetadataDefinitionUtil()
Gets an instance of an metadata definition utility class
|
MetadataUtil |
getMetadataUtil()
Gets an instance of a metadata utility class
|
MimeTypeUtil |
getMimeTypeUtil()
Gets an instance of a MIME type utility class
|
NodeComparatorUtil |
getNodeComparatorUtil()
Gets an instance of a node comparator utility class.
|
NodeFactoryUtil |
getNodeFactoryUtil()
Gets an instance of a node factory utility class.
|
NodeFilterUtil |
getNodeFilterUtil()
Gets an instance of a node filter utility class.
|
NodeIteratorUtil |
getNodeIteratorUtil()
Gets an instance of a node iterator utility class
|
NodeResolverUtil |
getNodeResolverUtil()
Gets an instance of a node resolver utility class.
|
NodeTreeUtil |
getNodeTreeUtil()
Gets an instance of a utility class for node trees.
|
NodeTypeUtil |
getNodeTypeUtil()
Gets an instance of a node type utility class
|
OutputUtil |
getOutputUtil()
Gets an instance of a output utility class
|
PageUtil |
getPageUtil()
Gets an instance of a page utility class
|
PermissionUtil |
getPermissionUtil()
Gets an instance of a permission utility class
|
PortletContextUtil |
getPortletContextUtil()
Gets an instance of a portlet context utility class
|
PortletUtil |
getPortletUtil()
Gets an instance of a portlet utility class
|
PrincipalUtil |
getPrincipalUtil()
Gets an instance of an principal utility class
|
PropertyUtil |
getPropertyUtil()
Gets an instance of a utility class for jcr properties
|
PublishingUtil |
getPublishingUtil()
Gets an instance of a publishing utility class
|
RedirectUtil |
getRedirectUtil()
Gets an instance of a redirect utility class.
|
ResourceLocatorUtil |
getResourceLocatorUtil()
Gets an instance of a resource locator utility class
|
RoleUtil |
getRoleUtil()
Gets an instance of a role utility class.
|
ScriptUtil |
getScriptUtil()
Gets an instance of a scripting utility class
|
SearchFactory |
getSearchFactory()
Gets an instance of a factory for search-related instances.
|
SearchFieldUtil |
getSearchFieldUtil()
Deprecated.
|
SearchUtil |
getSearchUtil()
Gets an instance of a search utility class
|
SiteCookieUtil |
getSiteCookieUtil()
Gets an instance of a site cookie utility class.
|
StructureUtil |
getStructureUtil()
Gets an instance of a structure utility class
|
SubscriberUtil |
getSubscriberUtil()
Gets an instance of an subscriber utility class
|
SubscriptionUtil |
getSubscriptionUtil()
Gets an instance of an subscription utility class
|
TagUtil |
getTagUtil()
Gets an instance of a tag utility class.
|
TemplateUtil |
getTemplateUtil()
Gets an instance of a template utility class
|
TextModuleRendererBuilder |
getTextModuleRendererBuilder()
Gets an instance of a Text module renderer builder class.
|
TimestampUtil |
getTimestampUtil()
Gets an instance of a timestamp utility class.
|
TranslationUtil |
getTranslationUtil()
Gets an instance of a translation utility class.
|
TrashcanUtil |
getTrashcanUtil()
Gets an instance of a trashcan utility class
|
UserFactory |
getUserFactory()
Gets an instance of a factory for user-related instances.
|
UserFieldRenderer |
getUserFieldRenderer()
Creates and returns a new instance of a stateful user field renderer.
|
UserUtil |
getUserUtil()
Deprecated.
use
getUserFactory() to get a SystemUserUtil and
UserIdentityUtil instead |
WebContentUtil |
getWebContentUtil()
Gets an instance of a web content utility class
|
WebResourceFactory |
getWebResourceFactory()
Gets an instance of a web resource factory utility class.
|
VelocityRenderer |
getVelocityRenderer()
Gets an instance of a Velocity renderer class.
|
VersionedPropertyUtil |
getVersionedPropertyUtil(int aVersion)
Gets an instance of a property utility class for a specified version.
|
VersionUtil |
getVersionUtil()
Gets an instance of a version utility class
|
XmlParserUtil |
getXmlParserUtil()
Gets an instance of a xml parser utility class.
|
XSLTUtil |
getXSLTUtil()
Gets an instance of a XSLT utility class.
|
PortletContextUtil getPortletContextUtil()
NodeIteratorUtil getNodeIteratorUtil()
NodeTreeUtil getNodeTreeUtil()
PropertyUtil getPropertyUtil()
LinkRenderer getLinkRenderer()
OutputUtil getOutputUtil()
ColorUtil getColorUtil()
DecorationUtil getDecorationUtil()
FontUtil getFontUtil()
ResourceLocatorUtil getResourceLocatorUtil()
EndecUtil getEndecUtil()
ScriptUtil getScriptUtil()
LogUtil getLogUtil()
IconUtil getIconUtil()
PermissionUtil getPermissionUtil()
DirectoryUtil getDirectoryUtil()
ClientUtil getClientUtil()
SearchUtil getSearchUtil()
@Deprecated SearchFieldUtil getSearchFieldUtil()
PortletUtil getPortletUtil()
MetadataUtil getMetadataUtil()
BookmarkUtil getBookmarkUtil()
PublishingUtil getPublishingUtil()
VersionUtil getVersionUtil()
ArchiveUtil getArchiveUtil()
FolderUtil getFolderUtil()
StructureUtil getStructureUtil()
WebContentUtil getWebContentUtil()
ArticleUtil getArticleUtil()
FileUtil getFileUtil()
ImageUtil getImageUtil()
PageUtil getPageUtil()
TrashcanUtil getTrashcanUtil()
TemplateUtil getTemplateUtil()
AuthenticationUtil getAuthenticationUtil()
PrincipalUtil getPrincipalUtil()
FileIconRenderer getFileIconRenderer()
ImageRenderer getImageRenderer()
ImageScaler getImageScaler(int aMaxWidth, int aMaxHeight)
Image scaler instance will respect the size ratio of the original image when scaling it.
Note that an image scaler must be created in context of a currently executing portlet. In other words:
if PortletContextUtil.getCurrentPortlet()
is null
, no image scaler can be created (i.e. this method will return null
).
aMaxWidth
- max width in pixels for scaled images, must be 10 or higheraMaxHeight
- max height in pixels for scaled images, must be 10 or higherImageRenderer
.
If aMaxWidth
or aMaxHeight
has illegal values, null
will be returned.ExceptionSuppressingProxy getExceptionSuppressingProxy(Object anObject)
Note! Be aware of null
's. They are never proxied. If you try to proxy null
, this method
will just return null
, not a proxy instance. In other words: even though you're trying to use a
ExceptionSuppressingProxy
to suppress exceptions,
method invocations will of course still throw NullPointerException
.
anObject
- an object to be proxied by an ExceptionSuppressingProxynull
if anObject
is null
.
If anObject
is a ExceptionSuppressingProxy
),
anObject
will be returned "as-is" (no new instance will be created).ExceptionSuppressingCollection getExceptionSuppressingCollection(Collection aCollection)
Note! The sole purpose of the ExceptionSuppressingCollection
is to provide easy access to a decorated iterator
(ExceptionSuppressingIterator
).
You should not create a collection of object proxys (i.e. Collection<ExceptionSuppressingProxy>
) yourself.
You should use ExceptionSuppressingCollection
with your "regular" collection since the actual proxying is done by the iterator itself.
aCollection
- a collection to be decorated by a ExceptionSuppressingCollection. Note that this should be your "regular" collection,
not a already proxied one (i.e. Collection<ExceptionSuppressingProxy>
).null
if aCollection
is null
.
If aCollection
is a ExceptionSuppressingCollection
),
aCollection
will be returned "as-is" (no new instance will be created).ExceptionSuppressingIterator getExceptionSuppressingIterator(Iterator anIterator)
anIterator
- an iterator to be decorated by a ExceptionSuppressingIteratornull
if anIterator
is null
.
If anIterator
is a ExceptionSuppressingIterator
),
anIterator
will be returned "as-is" (no new instance will be created).SubscriptionUtil getSubscriptionUtil()
SubscriberUtil getSubscriberUtil()
InstanceTypeUtil getInstanceTypeUtil()
NodeTypeUtil getNodeTypeUtil()
MetadataDefinitionUtil getMetadataDefinitionUtil()
ImageLinkRenderer getImageLinkRenderer()
MimeTypeUtil getMimeTypeUtil()
DocTypeUtil getDocTypeUtil()
VersionedPropertyUtil getVersionedPropertyUtil(int aVersion)
Note! This method returns an exotic sibling interface to PropertyUtil
that
can be used to extract property values from an other version than the one you are currently executing in.
If you don't know what a version is or haven't thought much about it, you would typically use the common property extraction interface -
getPropertyUtil()
.
aVersion
- VersionUtil.OFFLINE_VERSION
or
VersionUtil.ONLINE_VERSION
OfflineVersionPropertyUtil
or
OnlineVersionPropertyUtil
.
if aVersion has an illegal value, null will be returned.PropertyUtil
DeviceUtil getDeviceUtil()
@Deprecated UserUtil getUserUtil()
getUserFactory()
to get a SystemUserUtil
and
UserIdentityUtil
insteadVelocityRenderer getVelocityRenderer()
InstanceCreatorUtil getInstanceCreatorUtil()
DateUtil getDateUtil()
LandingPageUtil getLandingPageUtil()
BuddyIconRenderer getBuddyIconRenderer()
UserFieldRenderer getUserFieldRenderer()
MailUtil getMailUtil()
SearchFactory getSearchFactory()
LocaleUtil getLocaleUtil()
UserFactory getUserFactory()
CollaborationFactory getCollaborationFactory()
ContentNodeUtil getContentNodeUtil()
NodeComparatorUtil getNodeComparatorUtil()
NodeFilterUtil getNodeFilterUtil()
RedirectUtil getRedirectUtil()
NodeResolverUtil getNodeResolverUtil()
NodeFactoryUtil getNodeFactoryUtil()
WebResourceFactory getWebResourceFactory()
TranslationUtil getTranslationUtil()
XSLTUtil getXSLTUtil()
TimestampUtil getTimestampUtil()
MessageDigesterFactory getMessageDigesterFactory()
XmlParserUtil getXmlParserUtil()
RoleUtil getRoleUtil()
SiteCookieUtil getSiteCookieUtil()
CurrencyFactory getCurrencyFactory()
FormatterBuilderFactory getFormatterBuilderFactory()
TextModuleRendererBuilder getTextModuleRendererBuilder()
TagUtil getTagUtil()
AliasUtil getAliasUtil()
MessagesFactory getMessagesFactory()
Sitevision - 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-2024 Sitevision AB, all rights reserved.