Understanding the Business Rules Method Palette

Understanding the Business Rules Method Palette

The topics listed here provide reference information about each method that appears in the Method Palette of the Business Rule Designer . Many of these methods are based on standard XPath functions. Refer to the W3C XML Path Language documentation for additional information. If you have any questions or problems, see the Java CAPS web site at http://goldstar.stc.com/support.

Java CAPS Business Rules Method Palette Overview

The Method Palette displays a menu of methods that you can incorporate into your process models to manipulate data in a variety of ways. These methods are grouped logically by the type of function performed. By default, not all methods appear in the Method Palette menus. To view complete lists of operators for each type, click Settings from any of the Method Palette menus. The Method Palette dialog appears, and you can select and deselect functions to indicate which functions should appear in each menu.

To display a method on the Business Rule Designer canvas, click the menu containing the method you want to use and then click the method name or symbol. A method box appears on the canvas, and you can then map the input and output values for the method.

For most of the methods, you can either drag an object from the attributes tree to the method box to enter a value into a parameter, or you can right click a parameter in the method box to add a literal value directly into the box.

Operator Methods

Operator methods allow you to manipulate data with standard mathematical andcomparison operators. To display a complete list of available operator methods, click Operator and then click Settings.

Table 1 Operator Methods

Description 

The addition method adds the numerical value of number1 to the numerical value of number2, and returns the sum.

The AND method returns Boolean true if both boolean1 and boolean2 are true; otherwise, it returns Boolean false.

Note: Boolean parameters cannot accept values with capital letters. For example, “True” and “TRUE” are not valid Boolean values, but “true” is.

The div method divides the numerical value of number1 by the numerical value of number2, and returns the quotient.

The EQUAL method returns Boolean true if object1 is equal to object2; otherwise, it returns Boolean false.

The greater or equal method returns Boolean true if the numerical value of number1 is greater than or equal to the numerical value of number2; otherwise, it returns Boolean false.

The greater than method returns Boolean true if the numerical value of number1 is greater than the numerical value of number2; otherwise, it returns Boolean false.

The lesser or equal method returns Boolean true if the numerical value of number1 is less than or equal to the numerical value of number2; otherwise, it returns Boolean false.

The lesser than method returns Boolean true if the numerical value of number1 is less than the numerical value of number2; otherwise, it returns Boolean false.

The mod method divides the numerical value of number1 by the numerical value of number2, and returns only the remainder.

The multiplication method multiplies the numerical value of number1 by the numerical value of number2, and returns the product.

The negative method converts the numerical value of number1 to its negative. The result is a number having the same absolute value as the input number. For example, if the input is “10”, it is converted to “-10”; if the input is “-10”, it is converted to “10”.

The not equal method returns Boolean true if object1 is not equal to object2; otherwise, it returns Boolean false.

The OR method returns Boolean false if both boolean1 and boolean2 are false; otherwise, it returns Boolean true.

Note: Boolean parameters cannot accept values with capital letters. For example, “True” and “TRUE” are not valid Boolean values, but “true” is.

The subtraction method subtracts the numerical value of number2 from the numerical value of number1, and returns the difference.

String Methods

The String methods allow you to manipulate string data. To display a complete list of available string methods, click String and then click Settings.

Table 2 String Methods

Description 

The bytes to text method decodes a bytes object into text using the specified encoding. If no encoding is specified, the platform’s default encoding is used. For a list of possible values for the encoding parameter, see Encoder Parameter Values.

The concat method returns the string created by concatenating the value of the str parameter to the end of the value of the string parameter.

Note: You can add multiple str parameters to the method. The method automatically adds an unmapped node as needed.

The contains method returns Boolean true if the value of string1 is contained within the value of string2; otherwise, it returns false

The convertUnicode method returns the equivalent string value to the Unicode value in the string parameter. The Unicode value can be hexadecimal, octal, or decimal in format. For example, the Unicode number for a new line character is:

  • 0X00A in hexadecimal format

  • 012 in octal format

  • 10 in decimal format

    Use this method to insert other special characters, such as spaces, tabs, and so on.

The copy from method allows you to type in an XPath expression as the source of a copy operation. This is useful for entering XPath predicates. When you select copy from, the Copy From dialog box appears for you to enter the XPath.

Note: This feature is for advanced users who are familiar with XPath and BPEL syntax.

The copy to method allows you to type in an XPath expression as the destination of a copy operation. This is useful for entering XPath predicates. When you select copy to, the Copy To dialog box appears for you to enter the XPath.

Note: This feature is for advanced users who are familiar with XPath and BPEL syntax.

The normalize space method removes leading and trailing spaces from the string contained in string1.

The starts with method returns Boolean true if the value of string1 starts with the value of string2; otherwise, it returns false.

The string method converts the value of object1 to a string.

The string length method returns the number of characters in string1.

The string literal method allows you to create a literal string; that is, a sequence of characters of fixed length and content. Type the literal value directly into the method box.

Tips:

  • Use Control+Enter to insert a line break in a literal.

  • To add a string literal directly into a parameter without using the string literal method, right-click the parameter, and then click Add Literal. Type the literal directly into the parameter field.

  • To edit an existing literal from a method, right-click the literal, click Edit, and then modify the value.

  • To delete a literal from a method, right-click the literal, and then click Delete Literal.

The text to bytes method encodes the input text into a sequence of bytes using the specified encoding. If no encoding is specified, the platform’s default encoding is used. For a complete list of available values for the encoding parameter, see Encoder Parameter Values.

The substring method returns a substring of string1, with number2 indicating the position of the first character in the substring and number3 indicating the number of characters to include. number2 represents the position of a character from the beginning of string1. If number3 is empty, the return string includes the characters from the position indicated by number2 to the end of string1.

For example, if the parameters are (“Input Data”, 6, 3), the return string is “Dat”. If the third parameter is empty, the return string is “Data”. 

Note: The first character position is 1, not 0.

The substring after method returns the substring in string1 that occurs after the first instance of the substring in string2.

For example, if the parameters are (“Input Data”, “Input ”), the return string is “Data”. You would get the same return string if the second parameter contained only a space. 

Note: The first character position is 1, not 0.

The substring before method returns the substring in string1 that occurs before the first instance of the substring in string2.

For example, if the parameters are (“Input Data”, “ Data”, the return string is “Input”. You would get the same return string if the second parameter contained only a space. 

Note: The first character position is 1, not 0.

The translate method returns the value of string1, replacing any occurrences of the characters in string2 with the characters in the corresponding positions in string3. If string2 contains more than one instance of a character, only the first instance is taken into account. If string3 is longer than string2, the extra characters in string3 are ignored. If string2 is longer than string3, the extra characters in string2 are removed from string1.

For example, if the parameters are (“Sun”,”un”,”MI”), the original string, Sun, is translated to SMI. 

Number Methods

The Number methods allow you to manipulate numeric data. To display a complete list of available number methods, click Number and then click Settings.

Table 3 Number Methods

Description 

The ceiling method returns the smallest integer that is not less than the value of number1.

The floor method returns the largest integer that is not greater than the value of number1.

The number method converts object1 to a numerical value according to the following rules:

  • Boolean true is converted to 1; Boolean false is converted to 0.

  • A string that includes whitespace at the beginning and end, a minus sign, and a number (where the whitespace and minus sign are optional) is converted to the closest IEEE 754 number.

  • Strings that do not compute to a numerical value are converted to NaN.

  • A set of nodes is converted to a string and then converted as a string (as described above).

The number literal method allows you to create a number of fixed length and content. You can type the value directly into the method box.

The round method rounds the value of number1 to the nearest integer.

The sum method returns the total value of the set of numeric values in node-set1.

Boolean Methods

Boolean methods allow you to apply boolean logic to your data. To display a complete list of available Boolean methods, click Boolean and then click Settings.

Table 4 Boolean Methods

Description 

The boolean method converts the value of object1 to Boolean, and returns true or false.

The exists method checks whether a value is present in object1. If a value is present, it returns Boolean true; otherwise, it returns Boolean false.

The false method always returns Boolean false.

The lang method returns Boolean true if the value of string1 matches the language of the xsl:lang element; otherwise, it returns Boolean false.

The not method returns Boolean true if boolean1 is false, and returns Boolean false if boolean1 is true.

Note: Boolean parameters cannot accept values with capital letters. For example, “True” and “TRUE” are not valid Boolean values, but “true” is.

The true method always returns Boolean true.

Node Methods

Node methods allow you to manipulate node data. To display a complete list of available nodes methods, click Nodes and then click Settings.

Table 5 Nodes Methods

Description 

The count method returns the number of nodes in the node-set contained in node-set1.

The get BPid method returns the business process instance ID.

The get current time method returns the current time in ISO 8601 format (for example, 2003-08-15T02:03:49.92Z).

The get GUID method returns a randomly generated globally unique ID.

The get local time method returns the local time in ISO 8601 format (for example, 2003-08-15T02:03:49.92Z).

The id method returns a node-set of elements selected by the unique ID specified in object1.

The last method returns the position number of the last node in the processed node list.

The local name method returns the local part of the first node in node-set1. A node usually consists of a prefix and a colon, followed by the local name.

The name method returns the name of the first node in node-set1.

The namespace url method returns the namespace URL of the first node in node-set1.

The position method returns the position in the node list of the node that is currently being processed

XSD Operation

The XSD Operation methods enable you to marshal and unmarshal messages. To display a complete list of available XSD operation methods, click XSDOperation and then click Settings.

Table 6 XSD Operation Methods

Description 

The marshal method marshals the information in the OTD bean, and returns an XML document.

The unmarshal method unmarshals the information in an XML document, and returns an OTD bean.

The marshalToBytes method marshals the information in the OTD bean, and returns the data as bytes.

The unmarshalFromBytes method unmarshals the bytes input, and returns an OTD bean.

Conversion

There is one Conversion method, convert, that allows you to make conversions from various data types. To display the settings for the Conversion menu, click Conversion and then click Settings.

Table 7 Conversion Methods

Description 

The convert method converts the input object to the output object. This method is only supported in version 5.0.X Projects.

Encoder Parameter Values

The text to bytes and bytes to text methods both take a parameter that specifies the type of encoding to use when performing the conversion. The possible values for the encoder parameter include the following:

  • Big5

  • Big5-HKSCS

  • EUC-JP

  • EUC-KR

  • GB18030

  • GBK

  • ISO-2022-JP

  • ISO-2022-KR

  • ISO-8859-1

  • ISO-8859-13

  • ISO-8859-15

  • ISO-8859-2

  • ISO-8859-3

  • ISO-8859-4

  • ISO-8859-5

  • ISO-8859-6

  • ISO-8859-7

  • ISO-8859-8

  • ISO-8859-9

  • JIS_X0201

  • JIS_X0212-1990

  • KO18-R

  • Shift_JIS

  • TIS-620

  • US-ASCII

  • UTF-16

  • UTF-16BE

  • UTF-16LE

  • UTF-8

  • windows-1250

  • windows-1251

  • windows-1252

  • windows-1253

  • windows-1254

  • windows-1255

  • windows-1256

  • windows-1257

  • windows-1258

  • windows-31j

  • x-EUC-CN

  • x-euc-jp-linux

  • x-EUC-TW

  • x-eucJP-Open

  • x-ISC1191

  • x-JIS0208

  • x-JISAutoDetect

  • x-Johab

  • x-MS950-HKSCS

  • x-mswin-936

  • x-windows-50220

  • x-windows-50221

  • x-windows-949

  • x-windows-950

  • x-windows-iso2022jp