Interface MergeOperations
public interface MergeOperations
Provides merging operations for the EBX� Match and Merge Add-on. These operations must be called within a different EBX context, such as a:
user service, script/user task, or trigger. For instance, given the java bean for a custom script task below:
public class ScriptTaskMergeSample extends ScriptTask { private AdaptationTable table; private BigDecimal groupId; public void executeScript(ScriptTaskContext scriptTaskContext) throws OperationException { Session session = scriptTaskContext.getSession(); MergeOperations mergeOperations = OperationsFactory.getMergeOperations(session); try { // Merge a specific group id MergeProcess mergeProcess = mergeOperations.merge(table, groupId); } catch (InvalidStateException e) { e.printStackTrace(); } // Merge groups when required GroupOperations groupOperations = OperationsFactory .getGroupOperations(session); List <Group> groupWithManualMergeRequired = Operations .getGroupsWithActionRequired(table) .getGroupsWithMergeRequired(); List <BigDecimal> groupIds = groupWithManualMergeRequired .stream() .map(Group::getGroupId) .collect(Collectors.toList()); // execute an asynchronous merging process to merge multiple groups // with default merge policy MergingProcess mergingProcess = mergeOperations .mergeGroups(table, groupIds); ProcessOperations processOperations = OperationsFactory .getProcessOperations(session); // waiting until the execution done processOperations.waitingForBackgroundProcessDone(table); // Get status of merging process ProcessStatus status = mergingProcess.getStatus(); } public AdaptationTable getTable() { return this.table; } public void setTable(AdaptationTable table) { this.table = table; } public BigDecimal getGroupId() { return this.groupId; } public void setGroupId(BigDecimal groupId) { this.groupId = groupId; } }
-
Method Summary
Modifier and TypeMethodDescriptionmerge
(com.onwbp.adaptation.AdaptationTable table, BigDecimal groupId) Deprecated.Since 5.3.0.mergeGroup
(com.onwbp.adaptation.AdaptationTable table, BigDecimal groupId) Executes a merging process to merge a group of records.mergeGroup
(com.onwbp.adaptation.AdaptationTable table, BigDecimal groupId, String mergePolicyCode) Executes a merging process to merge a group of records using the specified merge policy.mergeGroups
(com.onwbp.adaptation.AdaptationTable table, Set<BigDecimal> groupIds) Executes the merging process to merge multiple groups of records.mergeGroups
(com.onwbp.adaptation.AdaptationTable table, Set<BigDecimal> groupIds, String mergePolicyCode) Executes multiple merging processes to merge multiple groups of records using the specified merge policy.mergeRecords
(List<com.onwbp.adaptation.Adaptation> records) Executes a merging process to merge a selection of records.mergeRecords
(List<com.onwbp.adaptation.Adaptation> records, String mergePolicyCode) Executes a merging process to merge a selection of records using the specified merge policy.void
unmerge
(com.onwbp.adaptation.AdaptationTable table, com.onwbp.adaptation.PrimaryKey recordPk) Reverts a merge operation on a group.
-
Method Details
-
merge
@Deprecated MergeProcess merge(com.onwbp.adaptation.AdaptationTable table, BigDecimal groupId) throws com.orchestranetworks.service.OperationException, com.orchestranetworks.addon.mame.common.InvalidStateException Deprecated.Since 5.3.0. This method is replaced bymergeGroup(AdaptationTable, BigDecimal)
Executes a merging process to merge a group of records. A merge policy should be defined beforehand and linked to the table on which the merged action is executed.
- Parameters:
table
- An EBX tablegroupId
- A group id of a group of records- Returns:
- MergeProcess The information of a merging execution
- Throws:
com.orchestranetworks.service.OperationException
- When unexpected errors occurcom.orchestranetworks.addon.mame.common.InvalidStateException
- When one of the following occur:- No records found with the specified `groupId`
- The business table was not configured for matching or matching is not enabled
- No valid merging policy configured for the business table
-
mergeGroup
MergeProcess mergeGroup(com.onwbp.adaptation.AdaptationTable table, BigDecimal groupId) throws com.orchestranetworks.service.OperationException, com.orchestranetworks.addon.mame.common.InvalidStateException, com.orchestranetworks.addon.mame.common.InvalidParameterException Executes a merging process to merge a group of records. A merge policy should be defined beforehand and this merge policy should have the propertyUsed for manual merge
set to true. Note that only one merge policy can have this setting activated. If you prefer use another merge policy than the one configured by default, usemergeGroup(AdaptationTable, BigDecimal, String)
instead.- Parameters:
table
- An EBX tablegroupId
- A group id of a group of records- Returns:
- MergeProcess The information of a merging execution
- Throws:
com.orchestranetworks.service.OperationException
- When unexpected errors occurcom.orchestranetworks.addon.mame.common.InvalidParameterException
- When one of the following occur:- Given table is
null
- Given groupId is
null
- Number of valid records (Which does not have MERGED or DELETED state) is less than 2 and Auto-create new golden record mode is not 'Duplicates and Singletons'
- Given table is
com.orchestranetworks.addon.mame.common.InvalidStateException
- When one of the following occur:- No records found with the specified `groupId`
- The business table was not configured for matching or matching is not enabled
- No valid merging policy configured for the business table
-
mergeGroup
MergeProcess mergeGroup(com.onwbp.adaptation.AdaptationTable table, BigDecimal groupId, String mergePolicyCode) throws com.orchestranetworks.service.OperationException, com.orchestranetworks.addon.mame.common.InvalidStateException, com.orchestranetworks.addon.mame.common.InvalidParameterException Executes a merging process to merge a group of records using the specified merge policy.- Parameters:
table
- An EBX tablegroupId
- A group id of a group of recordsmergePolicyCode
- A merge policy code- Returns:
- MergeProcess The information of a merging execution
- Throws:
com.orchestranetworks.addon.mame.common.InvalidParameterException
- When one of the following occur:- Given records is
null
or empty - Given
mergePolicyCode
isnull
or empty - Number of valid records (Which does not have MERGED or DELETED state) is less than 2 and the
Auto-create new golden record
mode is not set toDuplicates and Singletons
.
- Given records is
com.orchestranetworks.addon.mame.common.InvalidStateException
- When one of the following occur:- The business table was not configured for matching or matching is not enabled
- No, or more than one, merging policy is defined with the given
mergePolicyCode
in the business table's matching configuration.
com.orchestranetworks.service.OperationException
-
mergeRecords
MergeProcess mergeRecords(List<com.onwbp.adaptation.Adaptation> records) throws com.orchestranetworks.service.OperationException, com.orchestranetworks.addon.mame.common.InvalidStateException, com.orchestranetworks.addon.mame.common.InvalidParameterException Executes a merging process to merge a selection of records. A merge policy should be defined beforehand and this merge policy should have theUsed for manual merged
property set to true. Note that only one merge policy can have this setting activated. If you prefer use another merge policy than the one configured by default, usemergeRecords(List, String)
instead.- Parameters:
records
- A selection of records need to be merged- Returns:
- MergeProcess The information of a merging execution
- Throws:
com.orchestranetworks.service.OperationException
- When unexpected errors occurcom.orchestranetworks.addon.mame.common.InvalidParameterException
- When one of the following occur:- Given records is
null
or empty - Number of valid records (Which does not have MERGED or DELETED state) is less than 2 and the
Auto create new golden record
mode is not set toDuplicates and Singletons
. - Number of valid records (Which does not have MERGED or DELETED state) is equal 0
- Given records is
com.orchestranetworks.addon.mame.common.InvalidStateException
- When one of the following occur:- The business table was not configured for matching or matching is not enabled
- No valid merging policy configured for the business table
-
mergeRecords
MergeProcess mergeRecords(List<com.onwbp.adaptation.Adaptation> records, String mergePolicyCode) throws com.orchestranetworks.service.OperationException, com.orchestranetworks.addon.mame.common.InvalidStateException, com.orchestranetworks.addon.mame.common.InvalidParameterException Executes a merging process to merge a selection of records using the specified merge policy.- Parameters:
records
- A selection of recordsmergePolicyCode
- A merge policy code- Returns:
- MergeProcess The information of a merging execution
- Throws:
com.orchestranetworks.addon.mame.common.InvalidParameterException
- When one of the following occur:- Given records is
null
or empty - Given mergePolicyCode is
null
or empty - Number of valid records (Which does not have MERGED or DELETED state) is less than 2 and the
Auto-create new golden record
mode is not set toDuplicates and Singletons
. - Number of valid records (Which does not have MERGED or DELETED state) is equal 0
- Given records is
com.orchestranetworks.addon.mame.common.InvalidStateException
- When one of the following occur:- The business table was not configured for matching or matching not enabled
- No, or more than one, merging policy is defined with the given
mergePolicyCode
in business table's matching configuration.
com.orchestranetworks.service.OperationException
-
mergeGroups
Executes the merging process to merge multiple groups of records. A merge policy should be defined beforehand and this merge policy should have theUsed for manual merge
property set to true.Note that only one merge policy can have this setting activated.
If you prefer to use another merge policy than the one configured by default, use
mergeGroups(AdaptationTable, Set, String)
instead.This method only creates one transaction during its execution. When having multiple groups to merge, this method offers better performance than calling
mergeGroup
multiple times.- Parameters:
table
- an EBX tablegroupIds
- set of group ids of groups- Returns:
- MergingProcess merging execution information
- Throws:
IllegalArgumentException
- When one of the following occurs:- Given
table
isnull
- Given
groupIds
isnull
orempty
- Given
IllegalStateException
- When one of the following occurs:- The business table was not configured for matching or matching is not enabled
- No default merging policy configured for the business table
-
mergeGroups
MergingProcess mergeGroups(com.onwbp.adaptation.AdaptationTable table, Set<BigDecimal> groupIds, String mergePolicyCode) Executes multiple merging processes to merge multiple groups of records using the specified merge policy.- Parameters:
table
- an EBX tablegroupIds
- the group's set of group idsmergePolicyCode
- a merge policy code- Returns:
- MergingProcess The information of merging execution
- Throws:
IllegalArgumentException
- When one of the following occurs:-
Given
table
isnull
-
Given
groupIds
isnull
orempty
-
Given
mergePolicyCode
isnull
or empty
-
Given
IllegalStateException
- When one of the following occur:- The business table was not configured for matching or matching is not enabled
-
No, or more than one, merge policy is defined with the given
mergePolicyCode
in the business table's matching configuration.
-
unmerge
void unmerge(com.onwbp.adaptation.AdaptationTable table, com.onwbp.adaptation.PrimaryKey recordPk) throws com.orchestranetworks.addon.mame.common.NotFoundException, com.orchestranetworks.addon.mame.common.InvalidStateException, com.orchestranetworks.service.OperationException Reverts a merge operation on a group. Records will stay as duplicates.- Throws:
com.orchestranetworks.service.OperationException
- When unexpected errors occurcom.orchestranetworks.addon.mame.common.NotFoundException
- When a record with the given `recordPk` cannot be foundcom.orchestranetworks.addon.mame.common.InvalidStateException
- When one of the following occur:- The state of the record with the given `recordPk` is not 'MERGED' or 'GOLDEN'
- Cannot find golden record which the record with the given `recordPk` is targeting
- The record with the given `recordPk` is a single golden
-