public final class MQLUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeCommand(matrix.db.MQLCommand cmd)
Closes the specific command.
|
static java.lang.String |
doPrivilegedMQL(java.lang.String mql)
Executes the specified MQL with the super user context and returns the
result.
|
static java.lang.String |
escapeString(java.lang.String str)
Escapes the characters ", ', and \
in the specified string.
|
static java.lang.String |
executeCommand(matrix.db.MQLCommand mql,
java.lang.String command)
Executes the specified command using the provided context and mql-command
object.
|
static TxAction<java.lang.String> |
getMQLAction(java.lang.String mql)
Returns a
TxAction instance that will run the specified MQL
command and return the result as a String once executed. |
static java.lang.String |
getRPEVar(java.lang.String name,
boolean global)
Returns the RPE variable
|
static java.lang.String |
getSetRPEVarsCommand(java.util.Map<java.lang.String,java.lang.String> data,
boolean global) |
static boolean |
isAllowMultipleMQLCommandExecution()
Detects the mode we use when listing / printing properties.
|
static java.lang.String |
mql(java.lang.String mql)
Executes the specified MQL and returns the result.
|
static java.lang.String[] |
mql(java.lang.String[] mql)
Executes the specified MQL commands and returns the results.
|
static java.lang.String |
mqlf(boolean historyOff,
boolean triggerOff,
java.lang.String format,
java.lang.String... args) |
static java.lang.String |
mqlf(java.lang.String format,
java.lang.String... args) |
static boolean |
mqlfAvailable() |
static matrix.db.MQLCommand |
openCommand()
Creates a new MQLCommand instance and opens it.
|
static java.lang.String |
quoteString(java.lang.String s)
Encloses the specified string within quote characters.
|
static void |
setRPEVars(java.util.Map<java.lang.String,java.lang.String> data,
boolean global)
Sets the names and their respective value as a RPE (Runtime Program
Environment) variable.
|
static java.lang.String[] |
splitString(java.lang.String str,
char delim)
Splits the string by the specified delimeter.
|
static java.lang.String |
staticMql(java.lang.String mql)
Performs a static MQL call, where the result of the command may be cached
and reused for later calls.
|
static java.lang.String |
tcl(java.lang.String tcl)
Executes the specified TCL and returns the result.
|
public static boolean isAllowMultipleMQLCommandExecution()
public static java.lang.String staticMql(java.lang.String mql)
throws TVCException
NOTE: Only MQL commands where the result expects to be equal upon repeating calls, should be executed via this method !!!!!!! Otherwise, VERY suspicious behavior will appear !!
mql - The MQL statementTVCExceptionpublic static java.lang.String doPrivilegedMQL(java.lang.String mql)
throws TVCException
This method simply does:
TxManager.doPrivileged(new TxAction() {
public Object run() throws Exception {
return MQLUtils.mql(mql);
}
});
mql - the command to execute.TVCException - If an error occurs upon executing the commandpublic static TxAction<java.lang.String> getMQLAction(java.lang.String mql)
TxAction instance that will run the specified MQL
command and return the result as a String once executed.mql - The mql to execute.TxAction that till run the specified MQL command.public static java.lang.String mql(java.lang.String mql)
throws TVCException
mql - the command to execute.TVCException - if an error occurs upon executing the command.public static java.lang.String[] mql(java.lang.String[] mql)
throws TVCException
mql - the commands to execute.TVCException - if an error occurs upon executing the commands.public static java.lang.String tcl(java.lang.String tcl)
throws TVCException
tcl - the TCL to execute.TVCException - if an error occurs upon executing the TCL.public static boolean mqlfAvailable()
public static java.lang.String mqlf(java.lang.String format,
java.lang.String... args)
throws TVCException
TVCExceptionpublic static java.lang.String mqlf(boolean historyOff,
boolean triggerOff,
java.lang.String format,
java.lang.String... args)
throws TVCException
TVCExceptionpublic static java.lang.String executeCommand(matrix.db.MQLCommand mql,
java.lang.String command)
throws TVCException
mql - the mql-command object.command - the command string.TVCException - if failed to execute the command.public static matrix.db.MQLCommand openCommand()
throws TVCException
TVCExceptionpublic static void closeCommand(matrix.db.MQLCommand cmd)
cmd - the command object to close.public static java.lang.String quoteString(java.lang.String s)
s - the string to quote.public static java.lang.String[] splitString(java.lang.String str,
char delim)
The differences between this method and the one defined in
StringUtils is that this method will
return empty string array elements if two delimeters follow each other.
For example:
String[] s = MQLUtils.split("a|b||d|e|", '|');
for (int i = 0; i < s.length; i++) {
System.out.println("\"" + s[i] + "\"");
}
Produces the output:
"a" "b" "" "d" "e" ""
public static java.lang.String escapeString(java.lang.String str)
String expr = "(type == \"Part\") && (revision == last)";
String mqlStr = "escape evaluate expression \"" + MQLUtils.escapeString(expr) + "\" on businessobject "
+ objectId;
String result = MQLUtils.mql(ctx, mqlStr);
public static java.lang.String getRPEVar(java.lang.String name,
boolean global)
throws TVCException
name - The name of the variableglobal - True for globalTVCExceptionpublic static void setRPEVars(java.util.Map<java.lang.String,java.lang.String> data,
boolean global)
throws TVCException
data - The Map containing the variables to be set.global - True for global.TVCException - If unable to set the RPE vars.public static java.lang.String getSetRPEVarsCommand(java.util.Map<java.lang.String,java.lang.String> data,
boolean global)
data - global - StringCopyright ? Technia AB. All Rights Reserved.