memComp Java™ example
Example code explores the capabilities of memComp.
// Create a member compare interaction object.
IxnMemCompare memComp = new IxnMemCompare(ctx);
// Create member rowlists to hold input
// and output row(s).
MemRowList inpMemRows = new MemRowList();
MemRowList outMemRows = new MemRowList();
// Set the member type to one of the member types
// listed in mpi_memtype table.
memComp.setMemType("<member-type>");
// Set entity type to one of the entity types
// listed in mpi_enttype table.
memComp.setEntType("<entity-type>");
// Create two member objects to compare. The following
// two members are very much identical. So we get a high
// score.
// This member's attributes are Source No: 214
// EID : 1000000005, FirstName: Vidalia
// LastName: Garay-Deras, MiddleName: G.
MemHead memHead = new MemHead();
memHead.setSrcCode("FGH");
memHead.setMemIdnum("988608");
memHead.setEntRecno(0);
inpMemRows.addRow(memHead);
// This member's attributes are Source No: 217
// EID: 1000000005, FirstName: Vidalia
// LastName: Garay-Deras, MiddleName: D.
MemHead memHead2 = new MemHead();
memHead2.setEntRecno(0);
memHead2.setSrcCode("PHYS");
memHead2.setMemIdnum("145212");
inpMemRows.addRow(memHead2);
// This would execute the comparison on the input
// members and the output is stored in outMemRows.
if (memComp.execute(inpMemRows, outMemRows, KeyType.MEMIDNUM))
{
// Print some internal details
// of the comparison process.
System.out.println(" CompareInfo: " + memComp.getCompareInfo());
//Print the output rows.
RowIterator rowIter = outMemRows.rows();
while (rowIter.hasMoreRows())
{
MemRow memRow = (MemRow) rowIter.nextRow();
if (memRow instanceof MemHead)
{
MemHead memHead3 = (MemHead) memRow;
// The match score is located in the
// MEMHEAD object returned in the output rowlist.
System.out.print(" memRecno: " + memHead3.getMemRecno());
System.out.print(" memSeqno: " + memHead3.getMemSeqno());
System.out.print(" srcCode: " + memHead3.getSrcCode());
System.out.print(" memIdnum: " + memHead3.getMemIdnum());
System.out.print(" matchScore: " + memHead3.getMatchScore());
}
System.out.println();
}
}
Note: System.out.println() statements can
be output in the mpinet.out file. Any System.out.print() run in a
handler is output in mpinet.out.
The resulting rows are stored in outMemRows upon successful completion of the interaction. The following shows the output: