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 Details

  • Constructor Details

    • PlatformFunctions

      public PlatformFunctions()
  • Method Details

    • getUserManager

      public UserManager getUserManager()
    • getDirService

      @Deprecated public DirectoryService getDirService()
      Deprecated.
      since 11.1. Use Framework.getService(Class) with DirectoryService instead.
    • getVocabularyLabel

      public String getVocabularyLabel(String voc, String key)
    • 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)
    • getEmail

      public String getEmail(String username)
    • 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 names
      usePrefix - indicates if user resolution takes into account nuxeo prefix user:
      Since:
      5.5
    • getNextId

      public String getNextId(String key)
    • getNextId

      public String getNextId(String key, String sequencerName)
    • htmlEscape

      public String htmlEscape(String str)
    • 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 A
      values - Value can be instance of Collection<Object> or an array of Objects or simply a scalar Object. 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 document
      idOrPath - The document Id or path
      Returns:
      true if the document exists, or false otherwise