Jump to content

Running Matching Programatically


Naman Doshi

Recommended Posts

Hi ,

I am trying to run matching on one of our table (Account) which has all records in the unmatched state. I want to perform matching operation on all records present in the table.

Had usedMatching API, but after running the code no match operation was performed on the table. Please find below the sample code:

 

AdaptationHome dataspace = Repository.getDefault().lookupHome(HomeKey.forBranchName("Test"));

Adaptation dataset = dataspace.findAllRoots().get(0);

 

AdaptationTable table = (AdaptationTable) dataset.get(BatchImportExportPaths._Root_BatchImport._Account);

 

final Procedure match = new Procedure()

{

@Override

public void execute(ProcedureContext procedureContext) throws Exception

{

TableContext context = new TableContext(table, procedureContext);

MatchingOperations operations = MatchingOperationsFactory.getMatchingOperations();

MatchingConfigurationOperations operations = MatchingConfigurationOperationsFactory.getMatchingConfigurationOperations();

ExactMatchAtOnceContext exactContext = new ExactMatchAtOnceContext();

operations.exactMatchAtOnceUnmatched(context, exactContext);

}

};

 

final ProgrammaticService matchService = ProgrammaticService

.createForSession(context.getSession(), dataspace);

ProcedureResult result = matchService.execute(match);

OperationException resultException = result.getException();

if (resultException != null)

{

throw resultException;

}

if (result.hasFailed())

{

throw OperationException.createError("Match operation failed.");

}

 

Can anyone please suggest how we can run matching programmatically. I could not figure out how to set the process and matching policy that we have configured on the table using API. There is one classProcessPolicyConfigurationContext , but could not find its usage.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...