0% found this document useful (0 votes)
33 views

Service Routines in Java Customer How To Guide 1.0

Uploaded by

Fahmi Abdeltif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Service Routines in Java Customer How To Guide 1.0

Uploaded by

Fahmi Abdeltif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Service Routines in Java

Customer How-to Guide 1.0 February 2020


Service Routines in Java Customer How-to Guide 1.0

Contents
1 About this how-to guide ........................................................................... 3
1.1 Legal .............................................................................................................................................. 3
1.2 History ............................................................................................................................................ 4

2 Introduction .............................................................................................. 5
2.1 L3 tables layout .............................................................................................................................. 5
2.1.1 AAL.MORTGAGE.LINK .......................................................................................................... 5
2.1.2 AAL.MORT.MULTI.AC.LINK .................................................................................................. 6

3 Creating the L3 tables .............................................................................. 7


3.1 Table Designer ............................................................................................................................... 7
3.2 EB.TABLE.DEFINITION application ............................................................................................... 8

4 Generating the Classes ........................................................................... 9


4.1 Create a Models Project and a Server Project ............................................................................... 9
4.2 Import locally developed applications ........................................................................................... 11
4.3 Generate API for imported applications........................................................................................ 12

5 Writing the Java implementation ............................................................ 13


5.1 Create a new Java project............................................................................................................ 13
5.2 Extend the Superclass ServiceLifecycle....................................................................................... 15
5.3 Writing the Java implementation for the batch job ........................................................................ 16
5.4 Placing the implementation in a library and loading in JBoss Classpath ...................................... 18
5.5 Link the Java Methods to Service Workflow ................................................................................. 19

6 Testing the service ................................................................................. 21

2
Service Routines in Java Customer How-to Guide 1.0

1 About this how-to guide


The Service Routines in Java Customer How-to Guide describes how to write service
routines in java to update fields of a locally developed application (L3).Prerequisites

This guide assumes that you:

 Have read the Java Extensibility Framework Customer Overview.

 Have a basic understanding of Java.

 Know how to configure and initiate a service in Transact (formerly known as T24).

 Have verified the JD product is installed in SPF.

1.1 Legal
© Copyright 2020 Temenos Headquarters SA. All rights reserved.

The information in this guide relates to TEMENOSTM information, products and services. It also
includes information, data and keys developed by other parties.

While all reasonable attempts have been made to ensure accuracy, currency and reliability of
the content in this guide, all information is provided "as is".

There is no guarantee as to the completeness, accuracy, timeliness or the results obtained


from the use of this information. No warranty of any kind is given, expressed or implied,
including, but not limited to warranties of performance, merchantability and fitness for a
particular purpose.

In no event will TEMENOS be liable to you or anyone else for any decision made or action
taken in reliance on the information in this document or for any consequential, special or similar
damages, even if advised of the possibility of such damages.

TEMENOS does not accept any responsibility for any errors or omissions, or for the results
obtained from the use of this information. Information obtained from this guide should not be
used as a substitute for consultation with TEMENOS.

References and links to external sites and documentation are provided as a service.
TEMENOS is not endorsing any provider of products or services by facilitating access to these
sites or documentation from this guide.

The content of this guide is protected by copyright and trademark law. Apart from fair dealing
for the purposes of private study, research, criticism or review, as permitted under copyright
law, no part may be reproduced or reused for any commercial purposes whatsoever without the

3
Service Routines in Java Customer How-to Guide 1.0

prior written permission of the copyright owner. All trademarks, logos and other marks shown in
this guide are the property of their respective owners.

1.2 History
Version Date Change Author

1.0 February 2020 Initial release Lizen Bista

4
Service Routines in Java Customer How-to Guide 1.0

2 Introduction
The Service Routines in Java Customer How-to Guide describes how to write service
routines in Java to update fields of a locally developed application (L3).

The use case in this document involves linking mortgage accounts with customer accounts
(savings and current), so that they provide preferential rates up to a certain applied percentage
of the loan balance.

2.1 L3 tables layout


We need to create two L3 tables for this use case.

2.1.1 AAL.MORTGAGE.LINK
This table records details of applied percentage and preferential interest rate for the linked
account of a mortgage loan. The objective is to write service routines in java to update the
fields LINKED.ACCT.BAL and LOAN.BALANCE of the L3 application with data from the
corresponding core applications.

5
Service Routines in Java Customer How-to Guide 1.0

2.1.2 AAL.MORT.MULTI.AC.LINK
This table records the linked account IDs of mortgage loans. The service routine uses this
application to retrieve arrangement IDs.

6
Service Routines in Java Customer How-to Guide 1.0

3 Creating the L3 tables


Use either the Table Designer or EB.TABLE.DEFINITION application to create the L3 tables
AAL.MORTGAGE.LINK and AAL.MORT.MULTI.AC.LINK.

3.1 Table Designer


Procedure

1. Go to Admin Menu > Table Designer

2. Click New User Table.

7
Service Routines in Java Customer How-to Guide 1.0

3. Create the table AAL.MORTGAGE.LINK and populate it with the required fields. Repeat
the above steps to create the table AAL.MORT.MULTI.AC.LINK.

3.2 EB.TABLE.DEFINITION application


Use the EB.TABLE.DEFINITION application to create the two L3 tables.

8
Service Routines in Java Customer How-to Guide 1.0

4 Generating the Classes


The following sections describe how to generate the classes for the two newly created L3
tables, AAL.MORTGAGE.LINK and AAL.MORT.MULTI.AC.LINK.

4.1 Create a Models Project and a Server Project


To import the application metadata of the newly created L3 tables, create a Models project in
Design Studio.

Procedure

1. In the menu bar, click File > New > Project. Select Design Studio > Design Studio
Template Projects.

2. Click choose a template drop down and select Design Studio Model Project.

3. In the Project Name field, type the name of the new project (for example, L3).

4. Click Finish to create the project. Package Explorer displays the new Design Studio
project.

As well as the *-models project and *-models-gen project, you also need to add a *-
server project to the workspace.

Procedure

1. In the menu bar, click File > New > Project.

2. Expand Design Studio > Design Studio T24 server connectivity.

3. Enter a name for the server project ending with –server (for example, L3-server).

9
Service Routines in Java Customer How-to Guide 1.0

4. Click Next. The Choose the server connection type dialog is displayed.

5. Select T24 Server - Web service as the connection type. Click Finish.

6. Double click server.properties under *-server to open the properties file in the editor
window:

a. Enter a valid T24 username, password and company code in the T24 User
section.

b. In WebService connection, set:

 Hostname = localhost (or the IP address of the remote server).

 Port = 9089 (the JBoss port number).

c. In the Service view pane, verify that the server connection is set to Active.

10
Service Routines in Java Customer How-to Guide 1.0

4.2 Import locally developed applications


You also need to import T24 application metadata into the design studio workspace.

Procedure

1. Select File > Import > Design Studio - Import T24 Applications.

2. Select the T24 server from the list and click Next. Design Studio connects to T24 and
retrieves all existing applications.

3. Select the L3 application(s) to import.

4. Click Next and select the *-model project where you want the applications to be
imported.

5. Click Finish.

Ignore the error on the *-models project. The imported domain has
dependencies on other domains which are missing in the workspace.

6. Toggle the *-models project to TAFJ nature.

11
Service Routines in Java Customer How-to Guide 1.0

4.3 Generate API for imported applications

Procedure

1. Right-click the *-models project > Design Studio > Generate T24 API.

2. Provide a location for the jar. The API is generated.

12
Service Routines in Java Customer How-to Guide 1.0

5 Writing the Java implementation


To write the service routine in Java, start Design Studio and switch to the Java perspective..

5.1 Create a new Java project


Procedure

1. Create a new Java project (File > New > Java project). In the wizard supply a project
name.

2. Configure the build path settings for the Java project to add dependent T24 and TAFJ
libraries.

a. Right click the project, for example L3JAVA > Build path > Configure build
path.

b. Click Libraries tab > Add Library > User Library > User Libraries.

c. In the User Libraries window, click New and give the library a name, for
example, t24lib.

d. Click Add external jars. Navigate to the T24 libraries folder under
%JBOSS_HOME%/modules. Select all the jars and click Open.

Click OK and finish.

13
Service Routines in Java Customer How-to Guide 1.0

Alternatively, just add the required T24 hook jars like EB_TemplateHook.jar,
T24_API-Tables.jar etc using Add External JARs.

e. In the Libraries tab, click Add External JARs and add TAFJClient.jar from
%TAFJ_HOME%/lib

f. In the Libraries tab, click Add External JARs, navigate to the T24_API-
Tables.jar folder and click open.

14
Service Routines in Java Customer How-to Guide 1.0

5.2 Extend the Superclass ServiceLifecycle


Procedure

1. Create a new Java package. Right click the project > New > Package and supply a
name.

2. Right click the package and add a new Class to the package, for example,
ETDUpdateService.

3. Extend the superclass ServiceLifecycle for your class.

4. Click Finish. The method outlines of the superclass ServiceLifecycle is generated.


The class has several methods that can be overridden.

15
Service Routines in Java Customer How-to Guide 1.0

To find out more about the class ServiceLifecycle and what methods can be
overridden, click the com.temenos.t24.api.hook.system package in L3 API
documentation in the browser.

5.3 Writing the Java implementation for the batch job


Procedure

1. Override the inherited methods:

 getTableName() to return all IDs from AAL.MORT.MULTI.AC.LINK (SELECT


routine).

 process() to update LINKED.ACCT.BAL and LOAN.BALANCE in


AAL.MORTGAGE.LINK (RECORD routine).

2. Click Ctrl + S to save the code. See code sample below.

16
Service Routines in Java Customer How-to Guide 1.0

package com.local.service;

import java.util.List;
import java.util.logging.Logger;

import com.temenos.api.TBoolean;
import com.temenos.api.TStructure;
import com.temenos.api.exceptions.T24CoreException;
import com.temenos.api.exceptions.T24IOException;
import
com.temenos.t24.api.complex.aa.contractapi.BalanceMovement;
import
com.temenos.t24.api.complex.eb.servicehook.ServiceData;
import com.temenos.t24.api.contract.accounting.Contract;

import
com.temenos.t24.api.hook.system.ServiceLifecycle
; import
com.temenos.t24.api.records.account.AccountRecor
d; import com.temenos.t24.api.system.DataAccess;
import com.temenos.t24.api.tables.aalmortgagelink.AalMortgageLinkRecord;
import com.temenos.t24.api.tables.aalmortgagelink.AalMortgageLinkTable;
import com.temenos.t24.api.tables.aalmortmultiaclink.AalMortMultiAcLinkRecord;
public class ETDUpdateService extends ServiceLifecycle {

Logger logger = Logger.getLogger("T24");

@Override
public String getTableName(ServiceData serviceData, List<String>
controlList) { return "F.AA.AAL.MORT.MULTI.AC.LINK";
}
@Override
public void process(String id, ServiceData serviceData, String controlItem) {
DataAccess da = new DataAccess(this);
try {
AalMortMultiAcLinkRecord accountLinkRecord = new AalMortMultiAcLinkRecord(

da.getRecord("AA.AAL.MORT.MULTI.AC.LINK", id));

String mortgageLoanId = accountLinkRecord.getLoanId().getValue();


AccountRecord accountRecord = new AccountRecord(da.getRecord("ACCOUNT",
id)); String actualBalance =
accountRecord.getOpenActualBal().getValue().toString();
AalMortgageLinkTable mortgageTable = new AalMortgageLinkTable(this);
AalMortgageLinkRecord mortgageRecord = new AalMortgageLinkRecord(

da.getRecord("AA.AAL.MORTGAGE.LINK", mortgageLoanId));

17
Service Routines in Java Customer How-to Guide 1.0

mortgageRecord.setLinkedAcctBal(actualBalance
); Contract contract = new Contract(this);
contract.setContractId(mortgageLoanId);
List<BalanceMovement> loanBalance =
contract.getBalanceMovements("CURACCOUNT", ""); int dateBalance =
loanBalance.get(0).getBalance().intValue();
String balanceAsString =
Integer.toString(dateBalance);
mortgageRecord.setLoanBalance(balanceAsString);
mortgageTable.write(mortgageLoanId, mortgageRecord);
} catch (T24IOException e) {
System.out.println("Write failed " + e);
} catch (T24CoreException tce) {
System.out.println("File does not exist " + tce);
}

}
}

5.4 Placing the implementation in a library and loading


in JBoss Classpath
Procedure

1. After the Java code is written, right click the project > Export > JAR file. Select the
export destination.

18
Service Routines in Java Customer How-to Guide 1.0

2. Update module.xml in %JBOSS_HOME%/modules with the new jar path and name.
Restart JBoss.

5.5 Link the Java Methods to Service Workflow


Procedure

1. Create a PGM.FILE record for the job.

2. Create EB.API records for each of the overridden methods (select and record routine).
Append .SELECT to EB.API ID for the select routine. (For a load routine, append
.LOAD to the ID).

19
Service Routines in Java Customer How-to Guide 1.0

3. Add EB.API record to the service workflow.

4. Create a TSA.SERVICE record with the same ID as BATCH.

20
Service Routines in Java Customer How-to Guide 1.0

6 Testing the service


Procedure

1. Manually add records in AAL.MORT.MULTI.AC.LINK and AAL.MORTGAGE.LINK to


test the service.

2. After running the service, the local table fields Linked Acct Bal and Loan Balance are
updated for the Arrangement.

21

You might also like