Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected links that should have been relative instead of absolute.

You can use in-built inbuilt mapper utility classes and global methods available in the Data Mapper to map the elements. To use methods,

  1. Access the Data Mapper.
  2. From the Parameters panel, do the following as per your requirement:
    1. For mapper utility classes, expand Global Methods > MapperUtilityClass. The list of methods appears. The description of the methods is described later in this section.

      Image Added

    2. For global methods, expand Global Methods > GlobalMethodCall. The list of methods appears. The description of the methods is described later in this section.

      Image Added

  3. Select the tab to define the mapping from the Mapping Graphic area.

    Image Added

    To define mapping graphically, click Mapping Rules tab.
    To define mapping textually, click Textual Rules tab.
    To define mapping using variables, click Local Variables tab.
  4. Select the appropriate method from the Parameters panel. The definition of the method appears on the selected tab.

Methods Available in the Data Mapper

Following are the methods available in the MapperUtilityClass class are:class MapperUtilityClass. Click on the method to know its summary an syntax.

 

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’) 
Example,
java:MapperUtilityClass.getCurrentDate(‘yyyy-MM-dd HH:mm:ss’ , ‘US/Eastern’) 


Expand
titleabortMapping ()

Summary:

Aborts the mapping. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.abortMapping("Error message") 

...

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 date-time in string format. The second parameter value is in string format, it’s the This method accepts following nine parameters: date-time in the string format, date-time in the string 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'

 

Following are the global methods available in the class GlobalMehthodCall. Click on the method to know its summary an syntax.

 

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. This method accepts one string type parameter only in the <parameter-name> format.

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.

Syntax:

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


Expand
titlegetAccountType ()

Summary:

Returns the account type of the parameter passed to it. This method accepts one string type parameter only in the <parameter-name> format. It returns following three values: AlphabetNumeric, NumericNumeric, and ErrorData.

If you pass an alphabet followed by some numeral then it returns AlphabetNumeric. If you pass numeral followed by another numeral then it returns NumericNumeric. If you pass any other values or do not add a delimiter (-) between the two values then it returns ErrorData.

Syntax:

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