com.univocity.api.config.builders
Interface UnmatchedReferenceHandling


public interface UnmatchedReferenceHandling

The UnmatchedReferenceHandling configuration is obtained from a UnmatchedReference configuration which is part of the configuration initialized by a call to ReferenceMappingSetup.using(String...)

It is to provide configuration options that define how to handle references that could not be matched.

For example, consider the following information in uniVocity's metadata:


 Source entity (WGT)    Destination entity (weight)
     nbr | seq                    gid
     ----+----                  -------
     001 | 1                       1
     001 | 2                       2
     002 | 1                       3
 

And the following mapping:


 EntityMapping weightDetails = mapping.map("WGT_DET", "weight_details");
 weightDetails.reference().using("wgt_nbr", "wgt_seq").referTo("WGT", "weight").on("weight_ref");
 

If a record in the source entity WGT_DET contains wgt_nbr = 1, seq = 3 and this is used to refer to WGT, no results will come from uniVocity's metadata.

This configuration class provides some options for handling like this.

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
ReferenceMappingSetup, FunctionCall, DataIntegrationEngine

Method Summary
 void abort()
          Defines that in case a reference cannot be matched, the mapping cycle must be aborted.
 void discard()
          Defines that in case a reference cannot be matched, the entire record must be discarded.
 void executeAndAbort(String... functionNames)
          Defines that in case a reference cannot be matched, the mapping cycle must be aborted.
 void executeAndDiscard(String... functionNames)
          Defines that in case a reference cannot be matched, the entire record must be discarded.
 void executeAndIgnore(String... functionNames)
          Defines that in case a reference cannot be matched, this will be ignored.
 void ignore()
          Defines that in case a reference cannot be matched, this will be ignored.
 

Method Detail

discard

void discard()
Defines that in case a reference cannot be matched, the entire record must be discarded.

This completes the configuration started in ReferenceMappingSetup.using(String...)


abort

void abort()
Defines that in case a reference cannot be matched, the mapping cycle must be aborted. A CycleAbortedException will be thrown from within the DataIntegrationEngine

This completes the configuration started in ReferenceMappingSetup.using(String...)


ignore

void ignore()
Defines that in case a reference cannot be matched, this will be ignored. The fields that are part of the reference will be set to null, and the record will be mapped anyway.

This completes the configuration started in ReferenceMappingSetup.using(String...)


executeAndDiscard

void executeAndDiscard(String... functionNames)
Defines that in case a reference cannot be matched, the entire record must be discarded.

This completes the configuration started in ReferenceMappingSetup.using(String...)

Parameters:
functionNames - the sequence of function names that will be executed against the reference values read from the source entity.

Note: The record will still be discarded after the execution of these functions.
The sequence of declared function names establishes a chaining of functions: If the first function trims strings, then the second function will receive a trimmed String instead of the original value.


executeAndAbort

void executeAndAbort(String... functionNames)
Defines that in case a reference cannot be matched, the mapping cycle must be aborted. A CycleAbortedException will be thrown from within the DataIntegrationEngine

This completes the configuration started in ReferenceMappingSetup.using(String...)

Parameters:
functionNames - the sequence of function names that will be executed against the reference values read from the source entity.

Note: The mapping cycle will still be aborted after the execution of these functions.
The sequence of declared function names establishes a chaining of functions: If the first function trims strings, then the second function will receive a trimmed String instead of the original value.


executeAndIgnore

void executeAndIgnore(String... functionNames)
Defines that in case a reference cannot be matched, this will be ignored. Fields that are part of the reference will be set to whatever result is obtained from a given sequence of function calls, and the record will be mapped.

This completes the configuration started in ReferenceMappingSetup.using(String...)

Parameters:
functionNames - the sequence of function names that will be executed against the reference values read from the source entity.

Note: The sequence of declared function names establishes a chaining of functions: If the first function trims strings, then the second function will receive a trimmed String instead of the original value.



Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.