util
Methods
createConfigForScaleImage
createConfigForScaleImage():
ScaleImageConfig
Creates a configuration object that is used for scaling images.
Returns
a new ScaleImageConfig object
decodeBase64String
decodeBase64String(
pText,pCharset?):string
Decodes a Base64-encoded string and returns it as plain text. For this, the text is first converted to a byte[].
Parameters
string | number | booleanThe text to be decoded, base64 encoded.
string | number | booleanThe character set of the text.
Returns
stringThe text as a plain string.
Throws
May throw an exception.
Example
var cs="US-ASCII";
var text = "This is some new text. This is some more text. This is the rest of the text.";
var textEnc = util.encodeBase64String(text);
question.showMessage(textEnc);
var textDec = util.decodeBase64String(textEnc, cs);
question.showMessage(textDec);
encodeBase64String
encodeBase64String(
pText,pCharset?):string
This method encodes a text, converting it into a Base64-encoded value. For this, the text is first converted to a byte[].
Parameters
string | number | booleanThe text to be encoded.
string | number | booleanThe character set of the text.
Returns
stringThe text, Base64-encoded.
Throws
May throw an exception.
Example
var cs="US-ASCII";
var plainText = "Think different";
var encodedText = util.encodeBase64String(plainText, cs);
executeExternal
executeExternal(
pProgramName,pArguments,pWait):string
Runs a process on the server.
Only processes that do not require any user interaction can be executed.
Otherwise, util.executeExternal() corresponds to the swing.doClientIntermediate() command with the swing.CLIENTCMD_EXECUTE detail.
If the command is run in a client context, it is also possible to open processes that require user interaction.
Parameters
string | number | booleanName of the program to be executed.
string[]Command line arguments for the program.
booleanIf set to 'true', the JDito process will be interrupted until the program has terminated.
Returns
stringThe return value from the program.
Throws
May throw an exception.
Example
util.executeExternal("c:\temp\temp.exe", ["c:\temp\test.txt"], false);
getMimeType
getMimeType(
pFileName):string
Returns the Mime type of a file on the server.
Parameters
string | number | booleanThe name of the file to be evaluated, including its path.
Returns
stringThe Mime type, as a string.
Throws
May throw an exception.
Example
var fname = question.askQuestion("Where?", question.QUESTION_FILECHOOSER, "");
question.showMessage(util.getMimeType(fname));
getMimeTypeByContent
getMimeTypeByContent(
pContent):string
Returns the Mime type of a file. Here we explicitly use the content of the file, not the filename.
Parameters
string | number | booleanThe content of the file encoded as a Base64 String.
Returns
stringThe Mime type, as a string.
Throws
May throw an exception.
Throws
AditoBase64Exception
getNewUUID
getNewUUID():
string
Creates a new, globally unique UUID.
Returns
stringThe created UUID.
Example
var uid = util.getNewUUID();
question.showMessage(uid); // A string with 36 characters.
getRandom
getRandom(
pNumBytes):string
Returns a random string.
Parameters
numberLength of the random number in bytes.
Returns
stringThe random number.
Throws
May throw an exception.
Example
var random_value = util.getRandom(42);
getVMProperty
getVMProperty(
pKey):string
Returns a VM property of the server.
Parameters
string | number | booleanThe parameter.
Returns
stringThe value of the VM parameter.
Throws
May throw an exception.
Example
var key = "user.timezone";
var property = util.getVMProperty(key);
scaleImage
scaleImage(
pImage,pConfig):string
Returns an scaled instance of the given image.
Parameters
string | number | booleanthe image that will be scaled, in base64.
Returns
stringthe scaled image, in base64
Throws
May throw an exception.
sleep
sleep(
pTime):void
Interrupts the execution on the server for the specified period.
Parameters
numberPeriod during which the execution on the server is to be interrupted, specified in milliseconds.
Returns
voidThrows
May throw an exception.
Example
util.sleep(60000);
toJsonArray
toJsonArray(
pMultiStringTranscoded):string
Returns a multistring encoded array as a JSON array.
Parameters
string | number | booleanThe multistring encoded array.
Returns
stringThe JSON array.
Throws
May throw an exception.
Example
var multiString = "; Hans Meier; Franz Müller; Sepp Huber; Marianne Miller; Anna-Maria Maier; Beate Bauer;";
var json = util.toJsonArray(multiString);
toMultistringArray
toMultistringArray(
pJson):string
Returns a JSON array as a multistring encoded array.
Parameters
string | number | booleanThe JSON array.
Returns
stringThe multistring encoded array.
Throws
May throw an exception.
Example
var arr = ["Eins", "Zwei", "Drei"];
var multi = text.encodeMS(arr);
Properties
AUDIT_CONDITION_JDITO
numberAudit log typ: Condition is "JDito code" for CHANGE/TRANSFER
AUDIT_CONDITION_PLAIN
numberAudit log typ: Condition is "Plain" for CHANGE/TRANSFER
AUDIT_LOGTYPE_BLOB
numberAudit log typ: Value is "BLOB" for INSERT/UPDATE
AUDIT_LOGTYPE_CLOB
numberAudit log typ: Value is "CLOB" for INSERT/UPDATE
AUDIT_LOGTYPE_STRING
numberAudit log typ: Value is "String"
DATA_BINARY
numberdata format: Binary data, Base64-encoded
DATA_TEXT
numberdata format: text
EXITCODE_AUTHFAILED
stringCause for the exit: login error
EXITCODE_DENIED
stringCause for the exit: denied, e.g. by autostart
EXITCODE_ERROR
stringCause for the exit: error
EXITCODE_EXTERN
stringCause for the exit: external, e.g. server shutdown, critical server error,...
EXITCODE_MANAGER
stringCause for the exit: request from the manager
EXITCODE_OK
stringCause for the exit: everything okay
EXITCODE_TIMEOUT
stringCause for the exit: timeout
EXPORT_ABORT
numberMode for the export handling if a file exists: Aborts the current export.
EXPORT_APPEND
numberMode for the export handling if a file exists: Appends data to the current file.
EXPORT_OVERWRITE
numberMode for the export handling if a file exists: Overwrites the current file.