
com.univocity.api.config.builders.UnmatchedReferenceHandling Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2014 uniVocity Software Pty Ltd. All rights reserved.
* This file is subject to the terms and conditions defined in file
* 'LICENSE.txt', which is part of this source code package.
******************************************************************************/
package com.univocity.api.config.builders;
import com.univocity.api.engine.*;
import com.univocity.api.exception.*;
/**
* The UnmatchedReferenceHandling
configuration is obtained from a {@link UnmatchedReference} configuration
* which is part of the configuration initialized by a call to {@link 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.
*
* @see ReferenceMappingSetup
* @see FunctionCall
* @see DataIntegrationEngine
*
* @author uniVocity Software Pty Ltd - [email protected]
*
*/
public interface UnmatchedReferenceHandling {
/**
* Defines that in case a reference cannot be matched, the entire record must be discarded.
* This completes the configuration started in {@link ReferenceMappingSetup#using(String...)}
*/
public void discard();
/**
* Defines that in case a reference cannot be matched, the mapping cycle must be aborted.
* A {@link CycleAbortedException} will be thrown from within the {@link DataIntegrationEngine}
* This completes the configuration started in {@link ReferenceMappingSetup#using(String...)}
*/
public void abort();
/**
* 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 {@link ReferenceMappingSetup#using(String...)}
*/
public void ignore();
/**
* Defines that in case a reference cannot be matched, the entire record must be discarded.
* This completes the configuration started in {@link ReferenceMappingSetup#using(String...)}
*
* @param 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.
*/
public void executeAndDiscard(String... functionNames);
/**
* Defines that in case a reference cannot be matched, the mapping cycle must be aborted.
* A {@link CycleAbortedException} will be thrown from within the {@link DataIntegrationEngine}
* This completes the configuration started in {@link ReferenceMappingSetup#using(String...)}
*
* @param 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.
*/
public void executeAndAbort(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 {@link ReferenceMappingSetup#using(String...)}
*
* @param 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.
*/
public void executeAndIgnore(String... functionNames);
}