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
.
-
Use a
TableMapping
to map source and target fields. -
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 inTableMapping
. - 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.
-
Get integration results using
DataIntegrationExecutionResults
.
Example code for CSV export use case:
-
Create an instance of
EBXSourceTable
:EBXSourceTableSpec ebxSourceTableSpec = EBXSourceTableSpec .newBuilder(adaptationTable, session) .setIncludeComputedValuesOption(false) .build(); EBXSourceTable ebxSourceTable = EBXSourceTable.newInstance(ebxSourceTableSpec);
-
Create an instance of
CSVTargetTable
:CSVTargetTableSpec csvTargetTableSpec = CSVTargetTableSpec.newBuilder(outputFile) .setFirstRowHeader(true) .setFieldLabels(ebxSourceTable.getLabels()) .build(); CSVTargetTable csvTargetTable = CSVTargetTable.newInstance(csvTargetTableSpec);
-
Create an instance of
TableMapping
withFieldMatcher
: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());
-
Create an instance of
DataIntegrationSpec
:MappingSpec mappingSpec = MappingSpec.of(tableMapping); DataIntegrationSpec dataIntegrationSpec = new DataIntegrationSpec(session, mappingSpec);
-
Execute the
DataIntegrationSpec
and get results:DataIntegrationExecutionResults exportResults = DataIntegrationExecutor.getInstance().execute(dataIntegrationSpec);
Example code for Excel import use case:
-
Create an instance of
ExcelSourceTable
:ExcelSourceTableSpec excelSourceTableSpec = ExcelSourceTableSpec .newBuilder(fileToImport) .setColumnHeaderIncluded(true) .setStartRow(1) .setStartColumn(1) .setSheetName("Employee") .build(); ExcelSourceTable excelSourceTable = ExcelSourceTable.newInstance(excelSourceTableSpec);
-
Create an instance of
EBXTargetTable
:EBXTargetTableSpec targetTableSpec = EBXTargetTableSpec .newBuilder(adaptationTable, session) .setWriteMode(EBXWriteMode.UPDATE_OR_INSERT) .setNullOrEmptyPrimaryKeyAllowed(false) .build(); EBXTargetTable ebxTargetTable = EBXTargetTable.newInstance(targetTableSpec);
-
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)); }
-
Create an instance of
DataIntegrationSpec
:MappingSpec mappingSpec = MappingSpec.of(tableMapping); DataIntegrationSpec dataIntegrationSpec = new DataIntegrationSpec(session, mappingSpec);
-
Execute the
DataIntegrationSpec
and get results:DataIntegrationExecutionResults importResults = DataIntegrationExecutor.getInstance().execute(dataIntegrationSpec);
Example code for data transfer use case:
-
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);
-
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);
-
Create an instance of
TableMapping
withFieldMatcher
: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());
-
Create an instance of
DataIntegrationSpec
:MappingSpec mappingSpec = MappingSpec.of(tableMapping); DataIntegrationSpec dataIntegrationSpec = new DataIntegrationSpec(session, mappingSpec);
-
Execute the
DataIntegrationSpec
and get results:DataIntegrationExecutionResults transferResults = DataIntegrationExecutor.getInstance().execute(dataIntegrationSpec);
Example code for execution with a user defined template:
-
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);
-
Execute the
CSVExportTemplateSpec
and get results:DataIntegrationExecutionResults exportResults = DataIntegrationExecutor.getInstance().execute(templateSpec);
Please refer to package com.orchestranetworks.addon.dint.template
for more examples.
-
ClassDescriptionGlobal options for formatting and parsing various data types.Represents an error with user-friendly message happened during a data integration task.Contains all results of a data integration execution.Executes a data integration task.Global specification for a data integration task.Result for a
TableMapping
after performing a data integration execution.