Class PlatformFunctions
- java.lang.Object
-
- org.nuxeo.ecm.automation.core.scripting.CoreFunctions
-
- org.nuxeo.ecm.automation.features.PlatformFunctions
-
- All Implemented Interfaces:
ContextHelper
public class PlatformFunctions extends CoreFunctions
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description static StringHIBERNATE_SEQUENCER_PROPERTY
-
Constructor Summary
Constructors Constructor Description PlatformFunctions()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> List<T>concatenateIntoList(List<T> list, Object... values)Concatenate into the list given as first argument other arguments.<T> List<T>concatenateValuesAsNewList(Object... values)Idem than concatenateInto except that a new list is created.booleandocumentExists(CoreSession session, String idOrPath)Checks if a document with the supplied id (or path) exists.DirectoryServicegetDirService()Deprecated.since 11.1.StringgetEmail(String username)protected StringgetEmail(NuxeoPrincipal principal, String userSchemaName, String userEmailFieldName)StringListgetEmails(List<String> usernames)StringListgetEmails(List<String> usernames, boolean usePrefix)Returns user emailsStringListgetEmailsFromGroup(String group)StringListgetEmailsFromGroup(String group, boolean ignoreGroups)StringgetNextId(String key)StringgetNextId(String key, String sequencerName)NuxeoPrincipalgetPrincipal(String username)NuxeoPrincipalgetPrincipal(String username, boolean fetchReferences)StringListgetPrincipalEmails(List<NuxeoPrincipal> principals)Set<NuxeoPrincipal>getPrincipalsFromGroup(String group)Set<NuxeoPrincipal>getPrincipalsFromGroup(String group, boolean ignoreGroups)UserManagergetUserManager()StringgetVocabularyLabel(String voc, String key)StringhtmlEscape(String str)StringnxqlEscape(String str)Escapes a string according to NXQL escaping rules.-
Methods inherited from class org.nuxeo.ecm.automation.core.scripting.CoreFunctions
calendar, calendar, date, escapeHtml
-
-
-
-
Field Detail
-
HIBERNATE_SEQUENCER_PROPERTY
public static final String HIBERNATE_SEQUENCER_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUserManager
public UserManager getUserManager()
-
getDirService
@Deprecated public DirectoryService getDirService()
Deprecated.since 11.1. UseFramework.getService(Class)withDirectoryServiceinstead.
-
getPrincipal
public NuxeoPrincipal getPrincipal(String username, boolean fetchReferences)
- Since:
- 2021.14
-
getPrincipal
public NuxeoPrincipal getPrincipal(String username)
-
getEmail
protected String getEmail(NuxeoPrincipal principal, String userSchemaName, String userEmailFieldName)
-
getPrincipalsFromGroup
public Set<NuxeoPrincipal> getPrincipalsFromGroup(String group)
-
getPrincipalsFromGroup
public Set<NuxeoPrincipal> getPrincipalsFromGroup(String group, boolean ignoreGroups)
-
getEmailsFromGroup
public StringList getEmailsFromGroup(String group)
-
getEmailsFromGroup
public StringList getEmailsFromGroup(String group, boolean ignoreGroups)
-
getPrincipalEmails
public StringList getPrincipalEmails(List<NuxeoPrincipal> principals)
-
getEmails
public StringList getEmails(List<String> usernames)
-
getEmails
public StringList getEmails(List<String> usernames, boolean usePrefix)
Returns user emails- Parameters:
usernames- list of user namesusePrefix- indicates if user resolution takes into account nuxeo prefix user:- Since:
- 5.5
-
nxqlEscape
public String nxqlEscape(String str)
Escapes a string according to NXQL escaping rules.The resulting string is safe to include between single quotes in a NXQL expression.
- Parameters:
str- the input string- Returns:
- the escaped string
- Since:
- 6.0-HF21, 7.10
-
concatenateIntoList
public <T> List<T> concatenateIntoList(List<T> list, Object... values)
Concatenate into the list given as first argument other arguments. Other arguments will be explosed if it is a list of object. ex: concatenateInto(myList, a, anotherList) with a is scalar object and anotherList is a list of object will produced myList.add(a) and the same for each object contained into the anotherList list.- Parameters:
list- List of values of type Avalues- Value can be instance ofCollection<Object>or an array ofObjectsor simply a scalarObject. If Null, the parameter is ignored- Returns:
- the list that contains the list contain and value (see value description)
- Throws:
ClassCastException- if in values there is at least one object type not compatible with the collection list
-
concatenateValuesAsNewList
public <T> List<T> concatenateValuesAsNewList(Object... values)
Idem than concatenateInto except that a new list is created.
-
documentExists
public boolean documentExists(CoreSession session, String idOrPath)
Checks if a document with the supplied id (or path) exists.- Parameters:
session- The CoreSession to obtain the documentidOrPath- The document Id or path- Returns:
- true if the document exists, or false otherwise
-
-