United Planet GmbH

Groovy context objects in Intrexx 6

g_context


g_ctx

  • BPEE processing context. Only available in webservice context.

g_dbConnections

  • Access available database connections.
  • JavaDoc Link
  • //System connection
    def conn = g_dbConnections.systemConnection
    
    //Foreign data connection
    def conn = g_dbConnections["CONNECTION_NAME"]

g_dbQuery

  • Object to prepare and execute database queries.
  • JavaDoc Link
  • //Prepare a statement
    def stmt = g_dbQuery.prepare(conn, "SELECT * FROM MYTABLE WHERE LID = ?")
    stmt.setInt(1, iLid)
    stmt.executeQuery()
    stmt.close()
    
    //Get a single value
    def iMax = g_dbQuery.executeAndGetScalarValue(conn, "SELECT MAX(LID) FROM MYTABLE", 0)

g_defaultLanguage

  • Default language of the current portal.

g_dirWorkflow

  • Directory of the current workflow. Only available in workflows. This directory must be accessed read only.

g_dirWorkflowTmp

  • Get a temporary workflow directory. The directory is also accessible for all following workflow elements during a workflows execution, until the workflow has terminated.

g_event

  • Represents the event, that triggered the current workflow. Only defined in workflows. Note, that comparisons to the current event (see code snippet) have always to be made with the interfaces and never to the implementing classes.
  • JavaDoc Link
  • import de.uplanet.lucy.server.workflow.event.*
    
    if(g_event instanceof IGlobalTimerWorkflowEvent)
    	//Code to react on the timer event

g_fileScript

  • Path to the current script as java.io.File. This object is not available in webservice environments.

g_guidSelf

  • The variable contains the GUID of the current workflow object (action, condition or event handler). This variable is only defined in workflows.

g_guidWf

  • This variable contains the GUID of the current workflow. This variable is only defined in workflows.

g_language

  • Get the used language of current user.

g_log

  • Write an entry to the log file belonging to the current processing context.
  • g_log.info("Workflow terminated without errors.")
    g_log.error("An error occurred.")

g_mutexSelf

  • Synchronizes on the surrounding object (event handler, condition, action). The variable is only defined in workflows.

g_om

  • Objeto access the user structure
  • Details

g_portal

  • Object to access portal properties like name or base url.
  • Details

g_record

  • Access the current data record.
  • JavaDoc Link
  • def iLid = g_record["0D8F13B2B43B128DB23C0C1CC8C5DC1143C9D826"].value // datafield (PK) (S) ID

g_rtCache

  • RtCache. Access datagroups, applications, fields etc..
  • JavaDoc Link
  • //Get all datagroups of an application
    //with GUID 68C97BF4D89E8466BDE08AF03A4EF95F5B23AF72.
    def datagroups = g_rtCache.dataGroups.findAll{it.appGuid == "68C97BF4D89E8466BDE08AF03A4EF95F5B23AF72"}

g_session

  • The current session.
  • JavaDoc Link
  • //Name of the current logged in user
    def strUserName = g_session?.user?.name

g_sharedState

  • Shared State, where variables and values can be written and read.
  • JavaDoc Link
  • //Write variable in shared state
    g_sharedState.myVariable = "Mein Wert"
    
    //Read variable from shared state
    def strValue = g_sharedState.myVariable

g_springApplicationContext

  • Spring application context

g_sysDg

  • Access a system data group
  • JavaDoc Link
  • //Use as GUID the GUID of the system data field
    def strValue            = g_sysDg['C1BFDD165EBFD0713D306D3E2B124E80021E613F']
    def strValueByFieldGuid = g_sysDg.getValueByFieldGuid('C1BFDD165EBFD0713D306D3E2B124E80021E613F')
    def vhByFieldGuid       = g_sysDg.getValueHolderByFieldGuid('C1BFDD165EBFD0713D306D3E2B124E80021E613F')

g_syslog

  • Logging object to write outputs to the portals log file (portal.log).
  • g_syslog.info("My portal.log message.")

g_wfContext

  • Processing context of the current workflow.

g_ws

  • Object to call a webservice. Object is only defined in webservice scripts.
  • //Call a webservice within a webservices groovy script
    g_ws.invoke()

checkInterrupted()

  • Checks, if an interruption was requested.

createTemporaryDirectory()

  • Creates a temporary working directory, thats accessible till the termination of the current workflow.

getStackTraceString()

  • Returns a complete stacktrace as string of an occurred exception.

newGuid()

  • Create a new GUID.

now()

  • Create a new date (now) as timestamp or as valueholder.

vh()

  • Create a new valueholder from the given object.
  • def vhDate = vh(new Date())
    def vhInt  = vh(1000)

parseGuids(strText)

  • Parse GUIDs from the given string (e.g. a pipe separated list) and returns a TreeSet with the found GUIDs.
  • def strText = "18CC231E0A71F6F27091855C4C0FD0D6F2F26038||D0CACC8058DC36A9A499AB2DD3B993F427AB9200"
    def guids   = parseGuids(strText)
    guids.each{println it}