Friday, December 20, 2024

Oracle utilities Cloud - Batch job submission Rest API details

Working ...

Usecase:

In this scenario, we will utilize the provided REST API to submit a batch job to the CCS utilities server and monitor its status. The batch job will facilitate the upload of a file from OCI object storage to the CCS server.

Submit Batch Job

Verb : Post
https://server:port/spl/rest/apis/common/batch/batchJobSubmission/

This operation is used to add a batch job submission record for the input batch control. This API results in a generated Batch Job ID which can be used to review the status

Request Response:
TBD

Get Batch Job / Batch Run Details
Verb: Get
https://server:port/spl/rest/apis/common/batch/batchJobSubmission/{batchJobId}

This operation is used to retrieve the details related to a given batch job ID. Details related to the batch job submission record are returned. If the batch job has an associated batch run, then all the available batch run details are also returned.

Request and Response:

TBD

Reference:

OIC XSLT - Dynamic XPath Mapping in Oracle Integration: Handling Nested Transactions | use of current() function

Use Case Description:

Scenario:
In an integration process, we need to map and extract the ChequeNumber from a specific PaymentRecord dynamically based on the TransactionNumber of the stub account record. The mapping ensures that the correct record is retrieved by comparing the current TransactionNumber in context with the corresponding field in the source data.

Challenge:
Accurately identify and map the ChequeNumber when dealing with nested data structures, ensuring consistency and correctness in dynamic XPath expressions.

Solution:
Use the following XPath expression to achieve this:

$ReadSourceFile/nsmp0:ReadResponse/ns25:Payments/ns25:PaymentRecord[ns25:TransactionNumber=current()/ns25:TransactionNumber]/ns25:ChequeNumber




This approach ensures that the integration maps only the ChequeNumber for the record where the TransactionNumber matches the current context.

Note:
within a template, current() allows you to explicitly reference the node that is being processed without needing to specify its path. This can be helpful when working with recursive templates or when you want to access the current node while traversing through XML documents.


OIC XSLT - Use of fn:format-number() | Formatting Large Amount Values to Two Decimal Places in XSLT

Use Case: Formatting Large Amount Values to Two Decimal Places in XSLT.

Scenario:

We are receiving an amount field value in the following format:

Input Data: 0000567892987

Our goal is to transform this input into a properly formatted number with two decimal places:

Target Output: 5678929.87

solution code:

fn:format-number((number($ReadSourceFile/nsmp0:ReadResponse/ns25:Payments/ns25:FileTrailer/ns25:TotalStubAmount) div 100), "#.00")




Saturday, December 14, 2024

OIC - Implementing Robust Error Handling with Backup Service and Custom Fault Response

Usecase:

Enhancing the API's resilience by introducing error handling to fall back to a backup service if the primary REST API for retrieving country details fails. Additionally, global fault handling will be implemented to deliver a custom fault response for consistent error messaging.

Primary service:

https://restcountries.com/v3.1/alpha/IND

Backup service:

https://api.worldbank.org/v2/country/IND?format=json

Logic steps:

  1. Create 2 Rest invoke connections for primary and backup services.
  2. Create a application integration and configure the trigger with
    1. Uri: /country/{code}
    2. Get operation
    3. Provide json response
  3. Configure Primary service Rest api
  4. Take a scope and keep the primary service inboke and map inside of it.
  5. Add scope fault handler and do the following
    1. Configure backup service
    2. Map the input code 
    3. Take a return action and map the details.
  6. Configure global fault
    1. Add  "throw new fault" action to send custom fault to OIC Error Hospital 
Trigger response:
{
    "name": "United States of America",
    "alpha2Code": "US",
    "alpha3Code": "USA",
    "capital": "Washington
}

Detailed screenshots:
































Friday, December 13, 2024

OIC - How can we adjust a date to ensure it falls on a valid working day, excluding weekends and public holidays while comparing the feeded input day with the header record date in javascript?

Usecase:

If the input day of D1 record is greater than the day of the value date of RH record, the year and month should be set at 1 month before the value date of RH record.

(Note: Input day may be any day of the month i.e. 01 to 31,

but value date can only be a working day, i.e. Monday to Saturday except public holidays)

Example 1:

If input day = 25, value date of RH record = 20020926 (Thursday)

Then the input date is derived as 20020925 (Wednesday)

Example 2:

If input day = 31, value date of RH record = 20020902 (Monday)

Then the input date is derived as 20020831 (Saturday)

Example 3:

If input day = 31, value date of RH record = 20030102 (Thursday)

Then the input date is derived as 20021231 (Tuesday)

Example 4:

If input day = 31, value date of RH record = 20030204 (Tuesday)

Then the input date is derived as 20030131 (Friday)

Example 5:

If input day = 25, value date of RH record = 20250104

Then the input date is derived as 20241226


Javascript codes used:

function deriveInputDate1(inputDay, rhValueDate, publicHolidays) {

  // Convert rhValueDate to a Date object

  const rhDate = new Date(rhValueDate.slice(0, 4), rhValueDate.slice(4, 6) - 1, rhValueDate.slice(6));

  // If inputDay is greater than the day of rhDate, adjust the year and month

  if (inputDay > rhDate.getDate()) {

    rhDate.setMonth(rhDate.getMonth() - 1);

  }

  // Set the date to the inputDay

  rhDate.setDate(inputDay);

  // Ensure the date is a working day (Monday to Saturday, excluding public holidays)

  // Sunday is a non-working day

  while (rhDate.getDay() === 0 || isPublicHoliday(rhDate, publicHolidays)) {

    rhDate.setDate(rhDate.getDate() + 1);

  }

  // Format the derived date as YYYYMMDD

  const derivedDate = rhDate.getFullYear() +

    ('0' + (rhDate.getMonth() + 1)).slice(-2) +

    ('0' + rhDate.getDate()).slice(-2);

  return derivedDate;

}

// Helper function to check if a date is a public holiday

function isPublicHoliday(date, publicHolidays) {

  // Format the date as YYYY-MM-DD for comparison

  const formattedDate = date.getFullYear() +

    ('0' + (date.getMonth() + 1)).slice(-2) +

    ('0' + date.getDate()).slice(-2);

  return publicHolidays.includes(formattedDate);

}

Screenshot of the code:


OIC steps for integration creation:








Test result:






Note: Create a lookup and store the public holidays list which we will call from oic and assign to a variable and map to the derived function in mapper to exclude the public holidays.


Wednesday, December 11, 2024

OIC - Major steps to import HDL file To HCM | Upload to UCM and Run import and load data job

Usecase:

Here, we will demonstrate how we can import worker data as HDL filwle to HCM using following multple steps:

  1. Upload the hdl file(.zip file) to ucm
    1. Security group: FAFusionImportExport
    2. Doc account: hcm$/dataloader$/import$/
  2. Run importAndLoadData operation 
    1. Query, create update or delete information >> HCMDataloader service

Detailed screenshots:


















Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...