Package com.orchestranetworks.addon.dint


package com.orchestranetworks.addon.dint

Provides classes and interfaces to execute a data integration task.

The main class of this package is DataIntegrationExecutor, which performs a data integration task between a SourceTable and a TargetTable.

  1. Use a TableMapping to map source and target fields.
  2. In case the fields of source and target table are the same structure or label, you can use the provided FieldMatcher. To determine which field in the source table will match with which field in the target table, you have to define in TableMapping.
  3. In case you want to transform data, you can add transformations to field mappings. For more information, refer to the packages related to transformation functions.
  4. Get integration results using DataIntegrationExecutionResults.

Example code for CSV export use case:

  1. Create an instance of EBXSourceTable:

                    EBXSourceTableSpec ebxSourceTableSpec = EBXSourceTableSpec
                            .newBuilder(adaptationTable, session)
                            .setIncludeComputedValuesOption(false)
                            .build();
                    EBXSourceTable ebxSourceTable = EBXSourceTable.newInstance(ebxSourceTableSpec);
                    
  2. Create an instance of CSVTargetTable:

                    CSVTargetTableSpec csvTargetTableSpec = CSVTargetTableSpec.newBuilder(outputFile)
                            .setFirstRowHeader(true)
                            .setFieldLabels(ebxSourceTable.getLabels())
                            .build();
                    CSVTargetTable csvTargetTable = CSVTargetTable.newInstance(csvTargetTableSpec);
                    
  3. Create an instance of TableMapping with FieldMatcher:

                    TableMapping<EBXField, CSVField> tableMapping = TableMapping.of(ebxSourceTable, csvTargetTable);
                    List<EBXField> ebxFields = ebxSourceTable.getTable().getFields();
                    List<CSVField> csvFields = csvTargetTable.getTable().getFields();
                    tableMapping.mapFieldsWithMatcher(ebxFields, csvFields, FieldMatcher.getMatcherByLabelIgnoreCase());
                    
  4. Create an instance of DataIntegrationSpec:

                    MappingSpec mappingSpec = MappingSpec.of(tableMapping);
                    DataIntegrationSpec dataIntegrationSpec = new DataIntegrationSpec(session, mappingSpec);
                    
  5. Execute the DataIntegrationSpec and get results:

                    DataIntegrationExecutionResults exportResults = DataIntegrationExecutor.getInstance().execute(dataIntegrationSpec);
                    

Example code for Excel import use case:

  1. Create an instance of ExcelSourceTable:

                    ExcelSourceTableSpec excelSourceTableSpec = ExcelSourceTableSpec
                            .newBuilder(fileToImport)
                            .setColumnHeaderIncluded(true)
                            .setStartRow(1)
                            .setStartColumn(1)
                            .setSheetName("Employee")
                            .build();
                    ExcelSourceTable excelSourceTable = ExcelSourceTable.newInstance(excelSourceTableSpec);
                    
  2. Create an instance of EBXTargetTable:

                    EBXTargetTableSpec targetTableSpec = EBXTargetTableSpec
                            .newBuilder(adaptationTable, session)
                            .setWriteMode(EBXWriteMode.UPDATE_OR_INSERT)
                            .setNullOrEmptyPrimaryKeyAllowed(false)
                            .build();
                    EBXTargetTable ebxTargetTable = EBXTargetTable.newInstance(targetTableSpec);
                    
  3. Create an instance of TableMapping with mapping manually :

                    TableMapping<ExcelField, EBXField> tableMapping = TableMapping.of(excelSourceTable, ebxTargetTable);
                    List<ExcelField> csvFields = excelSourceTable.getTable().getFields();
                    List<EBXField> ebxFields = ebxTargetTable.getTable().getFields();
                    for (int i = 0; i < ebxFields.size(); i++)
                    {
                            tableMapping.mapFields(csvFields.get(i), ebxFields.get(i));
                    }
                    
  4. Create an instance of DataIntegrationSpec:

                    MappingSpec mappingSpec = MappingSpec.of(tableMapping);
                    DataIntegrationSpec dataIntegrationSpec = new DataIntegrationSpec(session, mappingSpec);
                    
  5. Execute the DataIntegrationSpec and get results:

                    DataIntegrationExecutionResults importResults = DataIntegrationExecutor.getInstance().execute(dataIntegrationSpec);
                    

Example code for data transfer use case:

  1. Create an instance of EBXSourceTable:

                    EBXSourceTableSpec ebxSourceTableSpec = EBXSourceTableSpec
                            .newBuilder(adaptationTable, session)
                            .setForeignKeyHierarchyIncluded(false) // when both sides are EBX, foreign keys should be configured as normal fields, not a hierarchies
                            .build();
                    EBXSourceTable ebxSourceTable = EBXSourceTable.newInstance(ebxSourceTableSpec);
                    
  2. Create an instance of EBXTargetTable:

                    EBXTargetTableSpec targetTableSpec = EBXTargetTableSpec
                            .newBuilder(adaptationTable, session)
                            .setWriteMode(EBXWriteMode.UPDATE_OR_INSERT)
                            .setNullOrEmptyPrimaryKeyAllowed(false)
                            .setForeignKeyHierarchyIncluded(false) // when both sides are EBX, foreign keys should be configured as normal fields, not a hierarchies
                            .build();
                    EBXTargetTable ebxTargetTable = EBXTargetTable.newInstance(targetTableSpec);
                    
  3. Create an instance of TableMapping with FieldMatcher:

                    TableMapping<EBXField, EBXField> tableMapping = TableMapping.of(excelSourceTable, ebxTargetTable);
                    List<EBXField> sourceFields = ebxSourceTable.getTable().getFields();
                    List<EBXField> targetFields = ebxTargetTable.getTable().getFields();
                    tableMapping.mapFieldsWithMatcher(sourceFields, targetFields, FieldMatcher.getMatcherByLabelIgnoreCase());
                    
  4. Create an instance of DataIntegrationSpec:

                    MappingSpec mappingSpec = MappingSpec.of(tableMapping);
                    DataIntegrationSpec dataIntegrationSpec = new DataIntegrationSpec(session, mappingSpec);
                    
  5. Execute the DataIntegrationSpec and get results:

                    DataIntegrationExecutionResults transferResults = DataIntegrationExecutor.getInstance().execute(dataIntegrationSpec);
                    

Example code for execution with a user defined template:

  1. Create an instance of CSVExportTemplateSpec:

                    CSVExportTemplateSpec templateSpec = new CSVExportTemplateSpec(
                            "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page.
                            outputFile,
                            session);
                    
  2. Execute the CSVExportTemplateSpec and get results:

                    DataIntegrationExecutionResults exportResults = DataIntegrationExecutor.getInstance().execute(templateSpec);
                    

Please refer to package com.orchestranetworks.addon.dint.template for more examples.