Fabric enables using Java JAR libraries in Fabric objects like functions and Web Services to expedite project timelines via 3rd party code that already implements tasks like specific calculations or mapping. Using JAR libraries reduces the need for self-coding and also saves time during testing. There is also an option for customers to use their own code like for security or connectivity which is then used by Fabric.
This article discusses the following:
After the JAR files are associated to a specific project in the Fabric Studio, to be deployed they must be copied into the project in the Fabric server.
Note that the JAR files are copied to All Fabric nodes.
For more information refer to Fabric Server - Main Directories.
This example demonstrates how a Telco carrier can align their subscribers phone numbers to follow the E.164 standard format. The phone numbers, which are populated by CRM representatives or by integrated DBs, might vary. For example, in the Training demo project, the LU CONTRACT table contains the following associated phone numbers for customer ID "55": "+1 (343) 842-1521", "680 463 5415", "5846694228", "(820) 633-6790".
To enable the carrier to use a single format, the Google libphonenumber library is used in the demo project, as follows:
Add an additional column to the CONTRACT table, named E164_LINE_FMT populated by an enrichment function.
Save the libphonenumber JAR (e.g. "libphonenumber-8.12.13.jar") in the [Fabric Project's Directory]\demo\lib.
For example:
Note that JAR is highlighted in yellow.
Restart the Fabric local server or reopen the project.
Create a new enrichment function named E164PhoneFormat in the CUSTOMER LU:
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();<pre><code>String SQLNumber="SELECT ASSOCIATED_LINE FROM CONTRACT";
String SQLFormattedNumberE164="UPDATE CONTRACT SET E164_LINE_FMT = ? where ASSOCIATED_LINE = ?";
fabric().fetch(SQLNumber).each(row -> {
String cellValue=""+row.get("ASSOCIATED_LINE");
PhoneNumber parsedNumber = phoneUtil.parse(cellValue, COUNTRY_CODE);
String formattedNumber = phoneUtil.format(parsedNumber, PhoneNumberUtil.PhoneNumberFormat.E164) + "E";
fabric().execute(SQLFormattedNumberE164,formattedNumber,cellValue);
}
</code></pre>
* Note that the COUNTRY_CODE is defined in Fabric Globals.
Associate the enrichment function to the CONTRACT table and then deploy the CUSTOMER LU. Search for customer "55" via the the Data Viewer:
The new table's column is populated with the required single format in all associated lines.
Fabric enables using Java JAR libraries in Fabric objects like functions and Web Services to expedite project timelines via 3rd party code that already implements tasks like specific calculations or mapping. Using JAR libraries reduces the need for self-coding and also saves time during testing. There is also an option for customers to use their own code like for security or connectivity which is then used by Fabric.
This article discusses the following:
After the JAR files are associated to a specific project in the Fabric Studio, to be deployed they must be copied into the project in the Fabric server.
Note that the JAR files are copied to All Fabric nodes.
For more information refer to Fabric Server - Main Directories.
This example demonstrates how a Telco carrier can align their subscribers phone numbers to follow the E.164 standard format. The phone numbers, which are populated by CRM representatives or by integrated DBs, might vary. For example, in the Training demo project, the LU CONTRACT table contains the following associated phone numbers for customer ID "55": "+1 (343) 842-1521", "680 463 5415", "5846694228", "(820) 633-6790".
To enable the carrier to use a single format, the Google libphonenumber library is used in the demo project, as follows:
Add an additional column to the CONTRACT table, named E164_LINE_FMT populated by an enrichment function.
Save the libphonenumber JAR (e.g. "libphonenumber-8.12.13.jar") in the [Fabric Project's Directory]\demo\lib.
For example:
Note that JAR is highlighted in yellow.
Restart the Fabric local server or reopen the project.
Create a new enrichment function named E164PhoneFormat in the CUSTOMER LU:
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();<pre><code>String SQLNumber="SELECT ASSOCIATED_LINE FROM CONTRACT";
String SQLFormattedNumberE164="UPDATE CONTRACT SET E164_LINE_FMT = ? where ASSOCIATED_LINE = ?";
fabric().fetch(SQLNumber).each(row -> {
String cellValue=""+row.get("ASSOCIATED_LINE");
PhoneNumber parsedNumber = phoneUtil.parse(cellValue, COUNTRY_CODE);
String formattedNumber = phoneUtil.format(parsedNumber, PhoneNumberUtil.PhoneNumberFormat.E164) + "E";
fabric().execute(SQLFormattedNumberE164,formattedNumber,cellValue);
}
</code></pre>
* Note that the COUNTRY_CODE is defined in Fabric Globals.
Associate the enrichment function to the CONTRACT table and then deploy the CUSTOMER LU. Search for customer "55" via the the Data Viewer:
The new table's column is populated with the required single format in all associated lines.