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

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      MergeProcess merge​(com.onwbp.adaptation.AdaptationTable table, java.math.BigDecimal groupId)
      Deprecated.
      Since 5.3.0.
      MergeProcess mergeGroup​(com.onwbp.adaptation.AdaptationTable table, java.math.BigDecimal groupId)
      Executes a merging process to merge a group of records.
      MergeProcess mergeGroup​(com.onwbp.adaptation.AdaptationTable table, java.math.BigDecimal groupId, java.lang.String mergePolicyCode)
      Executes a merging process to merge a group of records using the specified merge policy.
      MergingProcess mergeGroups​(com.onwbp.adaptation.AdaptationTable table, java.util.Set<java.math.BigDecimal> groupIds)
      Executes the merging process to merge multiple groups of records.
      MergingProcess mergeGroups​(com.onwbp.adaptation.AdaptationTable table, java.util.Set<java.math.BigDecimal> groupIds, java.lang.String mergePolicyCode)
      Executes multiple merging processes to merge multiple groups of records using the specified merge policy.
      MergeProcess mergeRecords​(java.util.List<com.onwbp.adaptation.Adaptation> records)
      Executes a merging process to merge a selection of records.
      MergeProcess mergeRecords​(java.util.List<com.onwbp.adaptation.Adaptation> records, java.lang.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 Detail

      • merge

        @Deprecated
        MergeProcess merge​(com.onwbp.adaptation.AdaptationTable table,
                           java.math.BigDecimal groupId)
                    throws com.orchestranetworks.service.OperationException,
                           com.orchestranetworks.addon.mame.common.InvalidStateException
        Deprecated.
        Since 5.3.0. This method is replaced by mergeGroup(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 table
        groupId - A group id of a group of records
        Returns:
        MergeProcess The information of a merging execution
        Throws:
        com.orchestranetworks.service.OperationException - When unexpected errors occur
        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,
                                java.math.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 property Used 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, use mergeGroup(AdaptationTable, BigDecimal, String) instead.
        Parameters:
        table - An EBX table
        groupId - A group id of a group of records
        Returns:
        MergeProcess The information of a merging execution
        Throws:
        com.orchestranetworks.service.OperationException - When unexpected errors occur
        com.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'
        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,
                                java.math.BigDecimal groupId,
                                java.lang.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 table
        groupId - A group id of a group of records
        mergePolicyCode - 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 to Duplicates and Singletons.
        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​(java.util.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 the Used 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, use mergeRecords(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 occur
        com.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 to Duplicates and Singletons.
        • Number of valid records (Which does not have MERGED or DELETED state) is equal 0
        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​(java.util.List<com.onwbp.adaptation.Adaptation> records,
                                  java.lang.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 records
        mergePolicyCode - 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 to Duplicates and Singletons.
        • Number of valid records (Which does not have MERGED or DELETED state) is equal 0
        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

        MergingProcess mergeGroups​(com.onwbp.adaptation.AdaptationTable table,
                                   java.util.Set<java.math.BigDecimal> groupIds)
        Executes the merging process to merge multiple groups of records. A merge policy should be defined beforehand and this merge policy should have the Used 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 table
        groupIds - set of group ids of groups
        Returns:
        MergingProcess merging execution information
        Throws:
        java.lang.IllegalArgumentException - When one of the following occurs:
        • Given table is null
        • Given groupIds is null or empty
        java.lang.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,
                                   java.util.Set<java.math.BigDecimal> groupIds,
                                   java.lang.String mergePolicyCode)
        Executes multiple merging processes to merge multiple groups of records using the specified merge policy.
        Parameters:
        table - an EBX table
        groupIds - the group's set of group ids
        mergePolicyCode - a merge policy code
        Returns:
        MergingProcess The information of merging execution
        Throws:
        java.lang.IllegalArgumentException - When one of the following occurs:
        • Given table is null
        • Given groupIds is null or empty
        • Given mergePolicyCode is null or empty
        java.lang.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 occur
        com.orchestranetworks.addon.mame.common.NotFoundException - When a record with the given `recordPk` cannot be found
        com.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