Class Ivy

java.lang.Object
ch.ivyteam.ivy.environment.Ivy
Direct Known Subclasses:
IvyJSP

public class Ivy extends Object
This class defines the Java API to get access to all relevant environment data of ivy. It is the equivalent for the "ivy" environment variable in IvyScript or in JSP.

Access to some features (e.g. cms() or cms) are only possible within a certain scope (e.g. process request, etc.). If this scope is not available a EnvironmentNotAvailableException is thrown.

Some methods are only available depending on the request kind. If they are not available, they will return null. In such a case a method call on one of these fields will throw an IllegalStateException.

Newer features, like ivy.casemap, are not directly available by corresponding methods. Instead the methods get(String) and get(Class) can be used. E.g. Ivy.get(ICaseMapService.class). All environment interfaces have also a static current method to get the current instance of them. E.g. IContentManagementSystem#current()

API:
This is a public API.
  • Field Details

    • cal

      public final IDefaultBusinessCalendar cal
      API:
      This public API is available in Java.
    • request

      public final IProcessModelVersionRequest request
      The currently executed process request.
      API:
      This public API is available in Java.
    • response

      public final IResponse response
      The response for the currently executed request.
      API:
      This public API is available in Java.
    • wf

      public final IWorkflowContext wf
      Provides access to runtime information of the workflow subsystem (with respect to the current session).
      API:
      This public API is available in Java.
    • session

      public final IWorkflowSession session
      Provides information about the currently active session.
      API:
      This public API is available in Java.
    • wfCase

      public final ICase wfCase
      The currently executed case.
      If the case is not available (e.g. on a static HTML page), an IllegalStateException will be thrown on method invocation.
      API:
      This public API is available in Java.
    • wfTask

      public final ITask wfTask
      The currently executed task.
      If the task is not available (e.g. on a static HTML page), an IllegalStateException will be thrown on method invocation.
      API:
      This public API is available in Java.
    • security

      public final ISecurity security
      Provides access to runtime information of the security subsystem (with respect to the current session).
      Since:
      9.3
      API:
      This public API is available in Java.
    • cms

      public final IContentManagementSystem cms
      Provides access to the content management system of the currently active project (process model version).
      API:
      This public API is available in Java.
    • cm

      public final ContentManagement cm
      Provides access to the content management
      API:
      This public API is available in Java.
    • html

      public final IHtmlDialogContext html
      Provides access to the current HTML dialog context.
      API:
      This public API is available in Java.
    • log

      public final ILogger log
      Provides access to the ivy logging subsystem. Log entries are written to the category RuntimeLogCategory.USER.
      API:
      This public API is available in Java.
    • extensions

      public final IExtensions extensions
      Provides access to any extensions that are installed on the ivy server.
      API:
      This public API is available in Java.
    • datacache

      public final IDataCacheContext datacache
      Provides access to data cache context to manage application (global) and session (user-specific) data caches.
      API:
      This public API is available in Java.
    • persistence

      public final IPersistenceContext persistence
      Access to the IPersistenceContext of the current process model version.
      API:
      This public API is available in Java.
    • var

      public final IGlobalVariableContext var
      Access to variable context to manage variables. The exact values depend on the currently active environment.
      API:
      This public API is available in Java.
    • rest

      public final IRestClientContext rest

      Access to rest clients.

      Example:

      
       Ivy ivy = Ivy.getInstance();
       String response = ivy.rest.client("myRestClient").request().get().readEntity(String.class);
       
      API:
      This public API is available in Java.
    • repo

      public final BusinessDataRepository repo

      Provides access to the BusinessDataRepository.

      API:
      This public API is available in Java.
  • Method Details

    • getInstance

      public static Ivy getInstance()
      Returns the singleton of Ivy. Useful for access to the ivy fields in the same way as in IvyScript. So it possible to copy/paste code snippets forth and back from IvyScript to Java and vice versa.
      Example:
       Ivy ivy = Ivy.getInstance();
       ivy.cms.co("/Project/Banner");
       
      Returns:
      the singleton of Ivy.
      API:
      This public API is available in Java.
    • cal

      public static IDefaultBusinessCalendar cal()
      Returns the default business calendar.
      Returns:
      The default business calendar.
      API:
      This public API is available in Java.
    • request

      public static IProcessModelVersionRequest request()
      Returns the currently executed process request. Returns null if not available.
      Returns:
      the currently executed process request or null, if not available
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • response

      public static IResponse response()
      Returns the response for the currently executed request.
      Returns null if not available.
      Returns:
      IResponse instance or null if not available.
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • persistence

      public static IPersistenceContext persistence()
      Returns the persistence context of the current process model version. Returns null if not available.
      Returns:
      the IPersistenceContext of the current process model version or null if not available.
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • var

      public static IGlobalVariableContext var()
      Access to variable context to manage variables (constants). The exact values depend on the currently active environment.
      Returns:
      variable context with defined variables.
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • rest

      public static IRestClientContext rest()

      Access to rest clients.

      Example:

      
       String response = Ivy.rest().client("myRestClient").request().get().readEntity(String.class);
       
      Returns:
      rest clients
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException
      API:
      This public API is available in Java.
    • repo

      public static BusinessDataRepository repo()

      Provides access to the BusinessDataRepository.

      Returns:
      the Business Data Repository
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException
      API:
      This public API is available in Java.
    • html

      public static IHtmlDialogContext html()
      Returns the currently running HTML dialog context. Returns null if not available
      Returns:
      IHtmlDialogContext instance or null
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • cms

      public static IContentManagementSystem cms()
      Returns the content management system of the currently active project (process model version).
      Returns:
      the content management system of the currently active project (i.e. process model version).
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • cm

      public static ContentManagement cm()
      Returns the content management.
      Returns:
      content management
      API:
      This public API is available in Java.
    • session

      public static IWorkflowSession session()
      Returns the currently active session.
      Returns:
      the currently active session.
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • wf

      public static IWorkflowContext wf()
      Returns the workflow context (with respect to the current session) to access runtime information of the workflow subsystem.
      Returns:
      IWorkflowContext instance
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • security

      public static ISecurity security()
      Returns the security context (with respect to the current session) to access runtime information of the security subsystem.
      Returns:
      ISecurityContext instance
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      Since:
      9.3
      API:
      This public API is available in Java.
    • wfCase

      public static ICase wfCase()
      Returns the currently executed case.
      Returns:
      the currently executed case or null, if not available (e.g. on a static HTML page)
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • wfTask

      public static ITask wfTask()
      Returns the currently executed task.
      Returns:
      the currently executed task. or null, if not available (e.g. on a static HTML page)
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • log

      public static Logger log()
      Gets the runtime log from the environment. Log entries are written to the category RuntimeLogCategory.USER.
      Returns:
      the ivy runtime log instance for the category RuntimeLogCategory.USER
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if accessing this method outside a request thread
      API:
      This public API is available in Java.
    • extensions

      public static IExtensions extensions()
      Gets access to any extensions that are installed on the ivy server.
      Returns:
      interface to access ivy extensions
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if environment is not available
      API:
      This public API is available in Java.
    • datacache

      public static IDataCacheContext datacache()
      Provides access to data cache context to manage application (global) and session (user-specific) data caches.
      Returns:
      the data cache context to access data caches
      Throws:
      ch.ivyteam.ivy.environment.EnvironmentNotAvailableException - if environment is not available
      API:
      This public API is available in Java.
    • get

      public static <T> T get(String memberName)

      Provides access to the ivy variable member with the given name.

      Example:

      
       import ch.ivyteam.ivy.globalvars.IGlobalVariableContext;
       IGlobalVariableContext var = Ivy.get("var");
       

      Parameters:
      memberName - name of the member of the ivy variable
      Returns:
      value of the member or null if member does not exist
      API:
      This public API is available in Java.
    • get

      public static <T> T get(Class<T> type)

      Provides access to the ivy variable member that is an instance of the given type

      Example:

      
       import ch.ivyteam.ivy.globalvars.IGlobalVariableContext;
       IGlobalVariableContext var = Ivy.get(IGlobalVariableContext.class);
       

      Parameters:
      type - the type of the member of the ivy variable
      Returns:
      value of the member or null if member does not exist
      API:
      This public API is available in Java.