Examples

This example returns a transaction ID that is based on the predefined position, looking for a transaction ID that is ADM or XFR. If no such ID is found, then NULL is returned.

/*
 * $Id:$
 * Infor
 */
import com.healthvision.CLOVERLEAF.upoc.*;
public class Trixid extends Trxid {
/**
*  process a Trxid
*/
public String process(CloverEnv cloverEnv, Message msg)
        throws CLOVERLEAFException {
        String trxid = null;
        System.out.println("in TestTrxid");
//get the message data to parse trixid
        String messageData = msg.getContent();
        String findTrxid = messageData.substring(5, 8);
        System.out.println("Trxid = " + findTrxid);
//determine whether trxid had found
        if ( findTrxid.compareTo("ADM") == 0 || \
                findTrxid.compareTo("XFR") == 0) {
        trxid = new String("ADMANDXFR");
        } else trxid = findTrxid;
System.out.println("End of TestTrxid");
return trxid;
        }
}

This example returns a transaction ID that is based on the message metadata Userdata. It looks for a value that has been stored under a TRXID key. If no such ID has been stored, then NULL is returned.

import com.healthvision.CLOVERLEAF.upoc.*;
public class SampleTrxid extends Trxid
{
        public String process(CloverEnv cloverEnv, Message msg)
        throws CLOVERLEAFException
        {
        String returnString = msg.getUserdata().getString("TRXID");
        if (returnString == null)
                returnString = "NULL";

        return returnString;
        }
}