TRANSACTED_BUSINESS_FUNCTION

Description: Limited to code that is to be run in a separate, new transaction.

Abstract Base Class: AbstractExtensionPersistenceCallback

Interface: EStatelessTransactionalCallback

Module: Framework

Version Added: 2.2

Requires Code Extension Name or Name Pattern: No

Code Extension Name or Name Pattern: N/A

Where to Specify Code Extensions of this Type: In the executeInTransaction API. This API allows for code extensions of this type tto be executed inside a new separate transaction and returns any errors encountered in a message collector.

When using the executeInTransaction API, you must check the response MessageCollector for errors before proceeding.

System-Seeded Code Extensions Using this Type: None

 

Code example

The following code fetches the user database key and passes parameters by the called in inParms. The callback can populate the inOutResults parameter with any results.

import java.util.Map;

import com.navis.external.framework.persistence.AbstractExtensionPersistenceCallback;

import com.navis.security.business.user.BaseUser;

public class GroovyTestPersistenceCallback extends AbstractExtensionPersistenceCallback {

public void execute(Map inParms, Map inOutResults) {

// any business code inside will be executed in a transaction

  String uid = (String) inParms.get("UID");

  log("UID foud:" + uid);

  BaseUser user = BaseUser.findBaseUser(uid);

  inOutResults.put("GKEY", user.getPrimaryKey());     }

}