public class ScriptUtils extends BaseScopableProcessorExtension
Modifier and Type | Field and Description |
---|---|
protected ServiceRegistry |
services
Services
|
Constructor and Description |
---|
ScriptUtils() |
Modifier and Type | Method and Description |
---|---|
ScriptPagingDetails |
createPaging(int maxItems,
int skipCount)
Builds a paging object, from the supplied
Max Items and Skip Count
|
ScriptPagingDetails |
createPaging(int maxItems,
int skipCount,
String queryExecutionId)
Builds a paging object, from the supplied
Max Items, Skip Count and Query Execution ID
|
ScriptPagingDetails |
createPaging(Map<String,String> args)
Builds a paging object, from the supplied Args object.
|
void |
disableRules()
Disable rule execution for this thread
|
String |
displayPath(ScriptNode node)
Function to return the cm:name display path for a node with minimum performance overhead.
|
void |
enableRules()
Enable rule execution for this thread
|
Date |
fromISO8601(String isoDateString)
Parse date from ISO formatted string
|
String |
getLocale()
Returns current thread's locale
|
ScriptNode |
getNodeFromString(String nodeRefString)
Gets a JS node object from a string noderef
|
String |
longQName(String s)
Given a short-form QName string, this method returns the fully qualified QName string.
|
boolean |
moduleInstalled(String moduleName)
Function to check if a module is installed
|
String |
pad(String s,
int len)
Function to pad a string with zero '0' characters to the required length
|
ScriptNode |
resolveNodeReference(String reference)
Use the Node Locator Service to find the a node reference from a number of possible locator types.
|
void |
setLocale(String localeStr)
Sets current Locale from string
|
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setServiceRegistry(ServiceRegistry services)
Sets the service registry
|
String |
shortQName(String s)
Given a long-form QName string, this method uses the namespace service to create a
short-form QName string.
|
boolean |
toBoolean(String booleanString)
Gets a boolean value from a string
|
String |
toISO8601(Date date)
Format date to ISO 8601 formatted string
|
String |
toISO8601(long timeInMillis)
Format timeInMillis to ISO 8601 formatted string
|
getScope, setScope
getExtensionName, register, setExtensionName, setProcessor
protected ServiceRegistry services
public void setServiceRegistry(ServiceRegistry services)
services
- the service registrypublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- the NodeService to setpublic String displayPath(ScriptNode node)
node
- ScriptNodepublic String pad(String s, int len)
s
- String to pad with leading zero '0' characterslen
- Length to pad topublic ScriptNode getNodeFromString(String nodeRefString)
nodeRefString
- string reference to a nodepublic ScriptNode resolveNodeReference(String reference)
This service supports 'virtual' nodes including the following:
alfresco://company/home The Company Home root node
alfresco://user/home The User Home node under Company Home
alfresco://company/shared The Shared node under Company Home
alfresco://sites/home The Sites home node under Company Home
workspace://.../... Any standard NodeRef
/app:company_home/cm:... XPath QName style node reference
reference
- The node reference - See above for list of possible node references supported.public boolean toBoolean(String booleanString)
booleanString
- boolean stringBoolean.parseBoolean(String)
public boolean moduleInstalled(String moduleName)
moduleName
- module name (e.g. "org.alfresco.module.foo")public String toISO8601(long timeInMillis)
timeInMillis
- longpublic String toISO8601(Date date)
date
- Datepublic Date fromISO8601(String isoDateString)
isoDateString
- Stringpublic String shortQName(String s)
s
- Fully qualified QName stringpublic String longQName(String s)
s
- Short form QName string, e.g. "cm:content"public ScriptPagingDetails createPaging(int maxItems, int skipCount)
public ScriptPagingDetails createPaging(int maxItems, int skipCount, String queryExecutionId)
public ScriptPagingDetails createPaging(Map<String,String> args)
args
- Mandatory hash of paging argumentsPossible arguments include:
maxItems - max count of items to return, default -1 (all)
skipCount - number of items to skip, default -1 (none)
queryId
queryExecutionId
public void disableRules()
public void enableRules()
public void setLocale(String localeStr)
public String getLocale()
Copyright © 2005–2017 Alfresco Software. All rights reserved.