Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use in-built inbuilt mapper utility classes and global methods available in the Data Mapper.

The methods available in the class MapperUtilityClass class are are:

Expand
titlecharAt ()

Summary:

Returns the character at the specified index. This method accepts following two parameters: data string and an integer index.

Syntax:

java:MapperUtilityClass.charAt('Adeptia', 3) 
Expand
titleequalsIgnoreCase ()

Summary:

Compares one string to another string, ignoring case considerations, and returns true or false. Two strings are considered equal ignoring case if they are of the same length and corresponding characters in the two strings are the equal ignoring case.

Syntax:

java:MapperUtilityClass.equalsIgnoreCase('adeptia','ADEPTIA') 
Expand
titlematches ()

Summary:

Checks if the given data string matches the given regular expression. This method accepts following two parameters: data string and string regular expression.

Syntax:

java:MapperUtilityClass.matches('Welcome to Adeptia.com',"(.*)Adeptia(.*)")

...

Expand
titlegetCurrentDate ()

Summary:

Gets the current date and time from the server and gives the date and time as output in the desired Java Time Zone. This method accepts following two parameters: Date/Time format in the data string and Time Zone in the data string.

Syntax:

java:MapperUtilityClass.getCurrentDate(‘yyyy-MM-dd HH:mm:ss’ , ‘time-zone’) 

...

Expand
titlenewLineBeforeAndAfter ()

Summary:

Inserts a new line just before the start of the data as well as and at the end of the data. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.newLineBeforeAndAfter('Adeptia') 

...

Expand
titlegetJulian7IntoDate ()

Summary:

Converts the Julian date CCYYDDD to the date format. This method accepts following two parameters: Julian date string and the format of the date.

Syntax:

java:MapperUtilityClass.putJulian7IntoDate('2008354' ,'yyyyMMdd') 
Expand
titledateAdd ()

Summary:

This method increases Increases the date and timestamp time stamp by the values specified in the parameters passed. The first 3 parameters in this function should be of string format and the rest of the 6 parameters should be integer in value. The first parameter value is This method accepts following nine parameters: date-time in the string format, date-time in the string format . The second parameter value is in string format, it’s the format in which you have entered the previous parameter value. The third parameter value is in string format, it’s the date-time in string format in which you want the output. The fourth parameter value is the , an integer value by which you want to increase the year. The fifth parameter value is the , an integer value by which you want to increase the month. The sixth parameter value is the , an integer value by which you want to increase the day. The seventh parameter value is the , an integer value by which you want to increase the hour. The eighth parameter value is the hours, an integer value by which you want to increase the minutes. The ninth parameter value is the , and an integer value by which you want to increase the seconds.

Syntax:

java:MapperUtilityClass.dateAdd(‘2013-11-27 HH:mm:ss’, ‘yyyy-MM-dd HH:mm:ss’, ‘MM-dd-yyyy HH:mm:ss’, yyyy, MM, dd, hh, mm, ss) 

...

Expand
titleencodefileAsBase64 ()

Summary:

Encodes the data as base64Base64. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.encodeFileAsBase64('C:\SourceFile.txt') 
Expand
titleinvokeREST ()

Summary:

This method calls Calls RESTful web service. It This method accepts 8 following eight parameters. All the parameters should be of String format. Parameter details are as follows:

  1. URL of the REST web service.
  2. Operation (GET, PUT, POST, or DELETE) to be performed.
  3. Data to be sent with POST request. This field is optional. For GET request and other WebService web services that doesndon't require any input, leave this field blank (' ').
  4. Request media type, e.g.for example, text/html, application/xml etc.
  5. Response media type, e.g. for example, text/html, application/xml etc.
  6. HTTP header to be sent with the request. Multiple header parameters should be separated by a comma, e.g. for example, name=san, id=3.
  7. Username required to perform authentication of your WebServiceweb service. Leave this parameter blank (' ') if the WebService web service doesn't require any authentication.
  8. Password required to perform authentication of your WebServiceweb service. Leave this parameter blank (' ') if the WebService web service doesn't require any authentication.

Syntax:

java:MapperUtilityClass.invokeREST('http://www.thomas-bayer.com/sqlrest/PRODUCT/12','GET/POST/PUT/DELETE','data to be sent (optional for get)' ,'application/xml','application/xml','Accept-Charset=utf-8,Cache-Control=no-cache,Content-Type: application/xml','username','password') 

The global methods available in the class MapperUtilityClass are:

Expand
titlegetAge ()

Summary:

Returns the present age. This method accepts one string type parameter only in the <parameter-name> format.

Syntax:

java:GlobalMethodCall.getAge(‘dd-MM-yyyy HH:mm:ss’) 
Expand
titlegetDaysLeft ()

Summary:

Returns a value (-1 or 0) depending on the value that you pass in it. It returns 0 if the value passed is greater than the current time and returns -1 if the value passed is less than the current time. You have to pass the value in yyyy-MM-dd HH:mm:ss format. This method accepts one string type parameter only in the <parameter-name> format.

Syntax:

java:GlobalMethodCall.getDaysLeft(‘yyyy-MM-dd’) 
Expand
titlegetAccountType ()

Summary:

This method returns the account type of the parameter passed init. It returns 3 values AlphabetNumeric, NumericNumeric, and ErrorData. If you pass alphabet followed by some numeral then it would return AlphabetNumeric. If you pass numeral followed by another numeral then it would return NumericNumeric. If you pass any other values or you do not add a delimiter (-) between the two values then, the method would return ErrorData. This method accepts one parameter in String <parameter-name> format.

Syntax:

java:GlobalMethodCall.getAccountType('alphabet-number-alphabet')
java:GlobalMethodCall.getAccountType('number-number-alphabet')