public class RAPPGlobVar extends RAPPAction implements RAPPEnumerationItem
For "get" and "delete" operations, wildcards (like under the Windows operating system) are allowed. This will make it possible to retrieve multiple variables or to delete many in one single operation.
Wildcards are allowed like under Windows, with:
Set the single variables "CODE", "CUSTID" and "CUSTNAME" then retrieve all variables with the name starting with "LIST_", and at last delete all variables* ending with "_STATUS".
RAPPTransaction trans=new RAPPTransaction();
// Set variables.
trans.addAction(new RAPPGlobVar("CODE" ,"12" ));
trans.addAction(new RAPPGlobVar("CUSTID" ,"540179" ));
trans.addAction(new RAPPGlobVar("CUSTNAME","Charles Darwin"));
// Get all variables starting with "LIST_".
RAPPGlobVar get=new RAPPGlobVar("LIST_*",RAPPGlobVar.GLOB_VAR_GET);
trans.addAction(get);
// Delete all variables ending with "_STATUS".
trans.addAction(new RAPPGlobVar("*_STATUS",RAPPGlobVar.GLOB_VAR_DELETE));
... Send the transaction to server and get the reply ...
// Print out all variables from the "get".
RAPPGlobVars vars=get.getVariables();
for ( int ii=0, cc=vars.getCount(); ii<cc; ++ii )
{
RAPPGlobVar v=vars.getVariable(ii);
System.out.println("Index "+ii+", variable "+v.getName()
+": "+v.getValue());
}
| Modifier and Type | Field and Description |
|---|---|
static int |
GLOB_VAR_DELETE
Deletes the global variable(s).
|
static int |
GLOB_VAR_GET
Gets the global variable as a single value or as an enumeration,
depending on the name of the variable.
|
static int |
GLOB_VAR_SET
Sets the global variable as a single value.
|
ACTION_CALL_CLASS, ACTION_CALL_HOST, ACTION_CALL_OBJECT, ACTION_CALL_PANEL, ACTION_GLOB_VAR, ERROR_CALL_CLASS_RUN_ACTION, ERROR_CONTROL_ID_NOT_FOUND, ERROR_GLOB_VAR_NOT_FOUND, ERROR_HOST_FIELD_NOT_FOUND, ERROR_HOST_SESSION_NOT_CONNECTED, ERROR_INSTANCIATING_CALLED_CLASS, ERROR_INTERFACE_NOT_FOUND, ERROR_NOT_CURRENT_HOST_SCREEN, ERROR_OBJECT_NOT_FOUND, ERROR_UNEXPECTED_RETURN_STRING, errorCode, errorDescription| Modifier | Constructor and Description |
|---|---|
protected |
RAPPGlobVar()
Creates an empty request of globVar.
|
|
RAPPGlobVar(RAPPGlobVars enumeration)
Creates an instance initialized for an enumeration of variables.
|
|
RAPPGlobVar(String name,
int action)
Creates a request to set the variable to a string.
|
|
RAPPGlobVar(String name,
String value)
Creates a request to set the variable to a string.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getAction()
Gets the action to perform (GLOB_VAR_SET, GLOB_VAR_GET,
or GLOB_VAR_DELETE).
|
String |
getActionClass()
Always returns "globVar".
|
int |
getActionType()
Gets the type of action for this class.
|
String |
getComment()
Comment for action class tag when serialized from a request
the first time.
|
String |
getName()
Gets the name of the global variable.
|
RAPPNameSpaceItem |
getNameSpaceItem()
Gets the namespace item for this action.
|
String |
getValue()
Gets the single value of the variable (request and reply), null when not defined
or a the name contains wildcards.
|
RAPPGlobVars |
getVariables()
Gets the global variables (null for none).
|
void |
serializeFromDocument(RAPPElement element,
int index)
Initializes the item class instance from an Element
in the enumeration.
|
void |
serializeFromReply(RAPPElement reply)
Initializes the global variable class instance from a
reply element.
|
void |
serializeFromRequest(RAPPElement request)
Initializes the action class instance from a request element.
|
void |
serializeToDocument(RAPPElement element,
int index)
Initializes Element for the item in the enumeration.
|
void |
serializeToReply(RAPPElement reply)
Initializes the reply Element with all attributes.
|
void |
serializeToRequest(RAPPElement request)
Initializes the request Element with all attributes.
|
void |
setValue(String value)
Sets the single value of the variable.
|
void |
setVariables(RAPPGlobVars variables)
Sets the global variables from the server that matched the
"get" operation.
|
String |
toString()
Converts this class into a string for testing purposes.
|
appendReplyElement, appendReplyElement, appendRequestElement, getClass, getErrorCode, getErrorDescription, initialize, paramString, removeAllElements, setError, updateReplyFromDocumentpublic static final int GLOB_VAR_SET
public static final int GLOB_VAR_GET
public static final int GLOB_VAR_DELETE
protected RAPPGlobVar()
public RAPPGlobVar(String name, String value)
public RAPPGlobVar(String name, int action)
public RAPPGlobVar(RAPPGlobVars enumeration)
public RAPPNameSpaceItem getNameSpaceItem()
getNameSpaceItem in class RAPPActionpublic int getAction()
public String getName()
public void setValue(String value)
public String getValue()
public RAPPGlobVars getVariables()
public void setVariables(RAPPGlobVars variables)
public int getActionType()
getActionType in class RAPPActionpublic String getComment()
getComment in class RAPPActionpublic void serializeToRequest(RAPPElement request)
The XML for the node looks like (replace parenthesis with less-more-than signs):
(globVarRequest
action = {"get" | "set" | "delete"}
name = "VARNAME"
[ value = "StringValueForSet" ] /)
serializeToRequest in class RAPPActionpublic void serializeFromRequest(RAPPElement request) throws SAXException
serializeFromRequest in class RAPPActionSAXException - for errors in the document.public void serializeToReply(RAPPElement reply)
The XML for the node looks like (replace parenthesis with less-more-than signs) for a single variable:
(globVarReply
action = "get"
name = "VARNAME"
value = "StringValueForGet"/)
or for an enumeration:
(globVarReply action = "globVarEnumeration")
(globVarItem action = "get" name="VARNAME_1" value="Value1" /)
(globVarItem action = "get" name="VARNAME_2" value="Value1" /)
... etc ...
(globVarItem action = "get" name="VARNAME_XXX" value="ValueXXX"/)
(/globVarReply)
serializeToReply in class RAPPActionpublic void serializeToDocument(RAPPElement element, int index)
index parameter indicates the index in
the enumeration of the element.serializeToDocument in interface RAPPEnumerationItempublic void serializeFromReply(RAPPElement reply) throws SAXException
serializeFromReply in class RAPPActionSAXException - for errors in the document.public void serializeFromDocument(RAPPElement element, int index) throws SAXException
serializeFromDocument in interface RAPPEnumerationItemSAXException - for errors in the document.public String toString()
toString in class RAPPActionpublic String getActionClass()
getActionClass in class RAPPActionPhantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.