Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

The methods available in the MapperUtilityClass class are:

 charAt ()

Summary:

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

Syntax:

java:MapperUtilityClass.charAt('Adeptia', 3) 
 equalsIgnoreCase ()

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') 
 matches ()

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(.*)")
 replaceAll ()

Summary:

Replaces all the occurrences of a particular string from the given data string. This method accepts following three parameters - data string, value to be replaced, and the replaced value.

Syntax:

java:MapperUtilityClass.replaceAll('beauty','y' ,'iful') 
 replaceFirst ()

Summary:

Replaces the first occurrence of a particular string from the given data string. This method accepts following three parameters - data string, value to be replaced, and the replaced value.

Syntax:

java:MapperUtilityClass.replaceFirst('adeptia','a' ,'A') 
 toLowerCase ()

Summary:

Converts the data string to lower case. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.toLowerCase('ADEPTIA') 
 toUpperCase ()

Summary:

Converts the data string to upper case. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.toUpperCase('adeptia') 
 getCurrentDate ()

Summary:

Gets the current date and time from the server and gives the date and time as output in 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’) 
 abortMapping ()

Summary:

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

Syntax:

java:MapperUtilityClass.abortMapping("Error message") 
 stringToHex ()

Summary:

Converts the string to hexadecimal representation. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.stringToHex('Adeptia') 
 newLineBefore ()

Summary:

Inserts a new line just before the start of the data. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.newLineBefore('Adeptia') 
 newLineAfter ()

Summary:

Inserts a newline at the end of the data. This method accepts one string type parameter only.

Syntax:

java:MapperUtilityClass.newLineAfter('Adeptia') 
 newLineBeforeAndAfter ()

Summary:

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

Syntax:

java:MapperUtilityClass.newLineBeforeAndAfter('Adeptia') 
 getRandomNumber ()

Summary:

Generates a random number. This method accepts no input parameter.

Syntax:

java:MapperUtilityClass.getRandomNumber() 
 getNextorPreviousDate ()

Summary:

Adds or subtracts the number of days to the current date based on the value passed. If the value passed is a positive integer then it will add the passed number of days to the current date and vice versa. This method accepts one integer type parameter only.

Syntax:

java:MapperUtilityClass.getNextorPreviousDate(2) 
 getJulian7fromDate ()

Summary:

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

Syntax:

java:MapperUtilityClass.getJulian7FromDate('dd-MM-yyyy','yyyyddd') 
 getJulian7IntoDate ()

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') 
 dateAdd ()

Summary:

This method increases the date and timestamp 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 format in which you have entered the previous parameter value. The third parameter value is in string format, it’s the date-time in which you want the output. The fourth parameter value is the integer value by which you want to increase the year. The fifth parameter value is the integer value by which you want to increase the month. The sixth parameter value is the integer value by which you want to increase the day. The seventh parameter value is the integer value by which you want to increase the hour. The eighth parameter value is the integer value by which you want to increase the minutes. The ninth parameter value is the 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) 
 executeDbUpdateQuery ()

Summary:

Performs an update operation in the database. This method accepts following two parameters: dBConnectionInfoID and database query.

Syntax:

java:MapperUtilityClass.executeDbUpdateQuery( $dbInfo,'select * from Table') 
 executeDbInsertQuery ()

Summary:

Performs an insert operation on the database. This method accepts following two parameters: dBConnectionInfoID and database query.

Syntax:

java:MapperUtilityClass.executeDbInsertQuery($dbInfo,'select * from Table') 
 executeDbDeleteQuery ()

Summary:

Performs the delete operation on the database. This method accepts following two parameters: dBConnectionInfoID and database query.

Syntax:

java:MapperUtilityClass.executeDbDeleteQuery($dbInfo,'select * from Table') 
 encodefileAsBase64 ()

Summary:

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

Syntax:

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

Summary:

This method calls RESTful web service. It accepts 8 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 that doesn't require any input, leave this field blank (' ').
  4. Request media type, e.g., text/html, application/xml etc.
  5. Response media type, e.g., 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., name=san, id=3.
  7. Username required to perform authentication of your WebService. Leave this parameter blank (' ') if the WebService doesn't require any authentication.
  8. Password required to perform authentication of your WebService. Leave this parameter blank (' ') if the WebService doesn't require any authentication.

Syntax:

'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') 
  • No labels