Package com.orchestranetworks.addon.dint.template
Examples to create a specification for a user defined template:
-
Example code for CSV export:
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);
-
Example code for CSV import:
Create an instance of
CSVImportTemplateSpec
:CSVImportTemplateSpec templateSpec = new CSVImportTemplateSpec( "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page. inputFile, session);
-
Example code for Excel export:
Create an instance of
ExcelExportTemplateSpec
:ExcelExportTemplateSpec templateSpec = new ExcelExportTemplateSpec( "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page. outputFile, session);
-
Example code for Excel import:
Create an instance of
ExcelImportTemplateSpec
:ExcelImportTemplateSpec templateSpec = new ExcelImportTemplateSpec( "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page. inputFile, session);
-
Example code for SQL export:
Create an instance of
SQLExportTemplateSpec
:SQLExportTemplateSpec templateSpec = new SQLExportTemplateSpec( "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page. session);
-
Example code for SQL import:
Create an instance of
SQLImportTemplateSpec
:SQLImportTemplateSpec templateSpec = new SQLImportTemplateSpec( "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page. session);
-
Example code for data transfer within EBX:
Create an instance of
EBXTransferTemplateSpec
:EBXTransferTemplateSpec templateSpec = new EBXTransferTemplateSpec( "7c67ed6a-3106-47b0-9bf8-0440e6238657", // this's template UUID, you can get from admin page. session);
Example code to customize a user defined template:
-
In case of data import or data export, it's possible to overwrite the source or the target EBX dataset configured in the template with another, which has the same data model:
templateSpec.setDataset(aDatasetWithSameDataModel);
-
In case of data transfer, it's possible to overwrite the source dataset or the target datasets configured in the template:
templateSpec.setSourceDataset(aDataset);
templateSpec.addTargetDatasets(datasets);
Example code to define the configuration for a user defined template:
-
Example code for identifying a template using its unique name:
Create an instance of
CSVImportTemplateSpec
:CSVImportTemplateSpec templateSpec = new CSVImportTemplateSpec( TemplateConfig.forTable("aUniqueTemplateName", anAdaptationTable) // a template name is unique for each data model inputFile, session);
-
Example code for configuring files for invalid records when executing with a template:
Create an instance of
CSVImportTemplateSpec
:CSVImportTemplateSpec templateSpec = new CSVImportTemplateSpec( TemplateConfig.forTable("aUniqueTemplateName", anAdaptationTable) // a template name is unique for each data model inputFile, session); templateSpec.setInvalidDataFolder(aFolder, "fileNamePrefix_", "_fileNameSuffix.csv");
-
Example code for configuring EBX's procedure when executing with a template:
Create an instance of
CSVImportTemplateSpec
:CSVImportTemplateSpec templateSpec = new CSVImportTemplateSpec( TemplateConfig.forTable("aUniqueTemplateName", anAdaptationTable) // a template name is unique for each data model inputFile, session); templateSpec.configureProcedure(context -> context.setTriggerActivation(false));
-
Example code for overwriting existing mappings in a template:
Create an instance of
CSVImportTemplateSpec
:CSVImportTemplateSpec templateSpec = new CSVImportTemplateSpec( TemplateConfig.forTable("aUniqueTemplateName", anAdaptationTable) // a template name is unique for each data model inputFile, session); TemplateConfig<CSVSourceTable, EBXTargetTable> templateConfig = templateSpec.getTemplateConfig(); // modify the first table mapping templateConfig.modifyTableMapping(TableMappingSelector.atIndex(0), context -> { MappingStepSelector<TransformationMappingStep> crossRefStepSelector = MappingStepSelectorBuilder .fromField(step -> { CSVTable table = context.getSourceTable().getTable(); return table.get("Id").getPath().equals(step.getField().getPath()); }) .nextTransformation(step -> { return CrossReference.getInstance() .getCodeForTemplate() .equals(step.getTransformationDefinition().getCode()); }) .select() .throwErrorIfNotFound("Could not find the cross reference transformation step mapped from the Id source field."); context.modifyStep(crossRefStepSelector, step -> { step.param(CrossReference.DATASPACE, "anotherDataspace"); step.param(CrossReference.DATASET, "anotherDataset"); }); });
Execute the user defined template specification and get results:
DataIntegrationExecutionResults results = DataIntegrationExecutor.getInstance().execute(templateSpec);
-
ClassDescriptionTemplate specification for CSV export.Template specification for CSV import.Template specification for transfer data from a EBX table to another EBX table.Template specification for Excel export.Template specification for Excel import.Allows you to overwrite the dataset configured in an import or export template.Template specification for SQL export.Template specification for SQL import.Configures a user template.Abstract specification for a user template.