public interface ProcessContext
Provides process context information in a scripted environment. The context of a running process contains information about the operation invocation that has triggered execution of the process, the current variable set of the running process, and the authenticated Subjects executing the process.
You can get information about the operation that has triggered the process execution as follows:
auditLog.debug("service is " + processContext.getService()); auditLog.debug("operation is " + processContext.getOperation());
The particular exchange for that operation that is triggering the process execution can be accessed as follows:
exchange = processContext.getCreatingExchange();
If there is authentication performed before a process is invoked as part of the process context you will be able to access who the authenticated subjects are. Each authenticated subject has a category as dictated by the authentication policies that were enforced. The aliases (typically only one) of the subjects authenticated prior to running the process can be accessed as follows:
categories = processContext.getAuthSubjectCategories(); for (var i = 0; i < categories.length; i++) { subject = processContext.getSubject(categories[i]); principals = subject.getPrincipals(); for (var j = 0; j < principals.length; j++); { alias = principals[j]; } }
A process can have variables that are used as part of it's running context. Those
variables may have been predefined at the time of process definition or they may
have been created dynamically by different activities. The variable values can be
either a string, int, float, long, boolean, or
Message
. The set of variables in the current
running context can be accessed as follows:
varNames = processContext.getVarNames(); for (var i = 0; i < varNames.length; i++) { v = processContext.getVariable(varNames[i]); // Do something }
You can create or change a variable with:
processContext.setVariable("var1", "myVarValue");
Modifier and Type | Method and Description |
---|---|
void |
changeSubjectCategory(java.lang.String oldCategory,
java.lang.String newCategory)
Change the subject category of a current subject.
|
java.lang.String[] |
getAuthSubjectCategories()
Returns the categories of subjects associated with the process.
|
Exchange |
getCreatingExchange()
Returns the message exchange implementing the operation invocation for which
the activity is performed.
|
javax.xml.namespace.QName |
getInterface()
Returns the interface name of the service for which the activity is performed.
|
java.lang.String |
getOperation()
Returns the name of the operation for which the activity is performed.
|
java.lang.String |
getProcessId()
Returns the unique ID of the running process that is executing the activity.
|
javax.xml.namespace.QName |
getService()
Returns the name of the service for which the activity is performed.
|
Subject |
getSubject(java.lang.String category)
Returns the Subject with the given subject category.
|
java.util.Set<java.lang.String> |
getSubjectCategories()
Deprecated.
Please use
getAuthSubjectCategories() instead.
Returns the categories of subjects associated with the process. |
java.lang.Object |
getVariable(java.lang.String name)
Returns the value of the variable with the given name.
|
java.util.List<java.lang.String> |
getVariableNames()
Deprecated.
Please use
getVarNames() instead.
Returns the names of the variables in the context of the process. Changes to the list
will not result in changes to the real variables. New or removed variables after
calling this method will not be reflected in this list without making another call. |
java.lang.String[] |
getVarNames()
Returns the names of the variables in the context of the process.
|
void |
setVariable(java.lang.String name,
java.lang.Object value)
Adds or changes the value of the variable with the given name.
|
void |
throwFault(java.lang.String faultName)
Throws a fault.
|
void |
throwFault(java.lang.String faultName,
java.lang.Object fault)
Throws a fault.
|
java.lang.String getProcessId()
javax.xml.namespace.QName getService()
javax.xml.namespace.QName getInterface()
java.lang.String getOperation()
Exchange getCreatingExchange()
java.util.List<java.lang.String> getVariableNames()
getVarNames()
instead.
Returns the names of the variables in the context of the process. Changes to the list
will not result in changes to the real variables. New or removed variables after
calling this method will not be reflected in this list without making another call.java.lang.String[] getVarNames()
java.lang.Object getVariable(java.lang.String name)
name
- Name of the variable.void setVariable(java.lang.String name, java.lang.Object value) throws java.lang.Exception
name
- Name of the variable.value
- New value of the variable.java.lang.Exception
- if unable to set the variable.java.util.Set<java.lang.String> getSubjectCategories()
getAuthSubjectCategories()
instead.
Returns the categories of subjects associated with the process.java.lang.String[] getAuthSubjectCategories()
Subject getSubject(java.lang.String category)
category
- Category of the subject to return.void changeSubjectCategory(java.lang.String oldCategory, java.lang.String newCategory)
oldCategory
- category of the subject to change.newCategory
- category to change the subject to.void throwFault(java.lang.String faultName)
faultName
- Name of the fault.void throwFault(java.lang.String faultName, java.lang.Object fault)
faultName
- Name of the fault.fault
- Fault message.?? 2022 Perforce Software, All rights reserved
This software is the confidential and proprietary information of Perforce, Inc. and is subject to copyright protection under laws of the United States of America and other countries. The use of this software should be in accordance with the license agreement terms you entered into with Perforce, Inc.