Import a Library File

You can import a .zip, .jar, or .js library file into Oracle Integration. The ZIP file must contain only the library JAR and metadata XML file.

  1. In the navigation pane, click Design, then Libraries.
  2. Click Import.
    The Import panel opens.
  3. Click Drag and Drop to select a file or drag one to this field.
  4. Make updates, when necessary, then click Save.

Write JavaScript

JavaScript provides an alternative to using the mapper and assign action to enrich data, but not to develop application logic.

Refer to your JavaScript document when writing or copying JavaScript code to run in a development (sandbox) environment. See JavaScript. This documentation provides basic syntax and available constructs. Because the script runs in a development environment, network, file, and Java APIs are not available.

Code Format

Name function return parameters as shown in the following example. You must configure the return parameter type in the metadata user interface only if the return parameters are named. Consider the following code:

function add ( param1, param2 )
 {    return param1 + param2;
}
Although the above syntax is valid, the return parameter does not appear in the metadata user interface for configuration. For that to occur, the code must return a named parameter. Create a new variable and assign return values before the variable is returned. For example:
function add ( param1, param2 ) {
   var retValue = param1 + param2;
   return retValue;
}

Function Within Another Function

Functions defined within another function do not appear in the metadata user interface for configuration. You may need to refactor the code if you need to access the function from the callout or mapper.

In the following code, foo is defined within parseDate and does not appear in the metadata user interface for configuration.
function parseDate(d) {
    function foo(d) {
        if(typeof d === 'string') { return Date.parse(d.replace(/-/g,'/'));}
     if(!(d instanceof Array)) { throw new Error("parseDate: parameter must be arrays of strings"); }
     var ret = [],k;
     for(k=0;k<d.length;k++) { ret[k] = foo(d[k]); }
        return ret;
    }
     var retVal = foo(d);
     return retVal;
}

Extensions

Oracle Integration provides a set of extension functions organized under the following namespace:

Function Example
uuid functions:
oic.uuid
    uuidv1
    uuidv4
function uuidv1() {
  var uuidv1_result = oic.uuid.uuidv1();
  return uuidv1_result;
}
 
function uuidv4() {
  var uuidv4_result = oic.uuid.uuidv4();
  return uuidv4_result;
}
checksum functions:
oic.checksum
    sha
    sha256
    sha512
    md5
function checksum_sha(inputStr) {
  var sha_result = oic.checksum.sha(inputStr,"sha");
  return sha_result;
}
 
function checksum_sha256(inputStr) {
  var sha256_result = oic.checksum.sha256(inputStr,"sha-256");
  return sha256_result;
}
 
function checksum_sha512(inputStr) {
  var sha512_result = oic.checksum.sha512(inputStr,"sha-512");
  return sha512_result;
}
 
function checksum_md5(inputStr) {
  var md5_result = oic.checksum.md5(inputStr,"md5");
  return md5_result;
}
}
base64 functions:
oic.base64
    encode
    decode
function base64_encode(input_encode_str) {
  var encode_result = oic.base64.encode(input_encode_str);
  return encode_result;
}
function base64_decode(input_decode_str) {
  var encode_result = oic.base64.decode(input_decode_str);
  return encode_result;
}
crypto functions:
oic.crypto
    hmacsha256
function generate_hashCode(hmacString_value, hmacKey_value) {
  var hashCode_value = oic.crypto.hmacsha256 ( hmacString_value, hmacKey_value);
  return hashCode_value; 
}