Package com.orchestranetworks.addon.dex.common.generation

Classes and interfaces used to generate tables, fields and mappings for the XML and SQL import, export and transfer data services.


Generating EBX® tables

                Set<Path> sourceTablePaths = new LinkedHashSet<Path>();
                sourceTablePaths.add(Path.parse("/root/Libraries"));
                sourceTablePaths.add(Path.parse("/root/Courses"));
                EBXTableGeneration genTable = TableGenerationFactory.getEBXTableGeneration();
                TableGenerationResult<EBXField, EBXTable> genTableResult = genTable.generateTables(sourceDataset, sourceTablePaths, session);

When tables are declared in the {addon.label} configuration, you can create EBX® tables by using EBXTableHelper.

                        
                EBXTableHelperSpec tableHelperSpec = new EBXTableHelperSpec(applicationLogicalName,currentDataset,session);
                EBXTableHelper tableHelper = TableHelperFactory.getEBXTableHelper();
                List<EBXTable> ebxTables = tableHelper.getTables(tableHelperSpec);                    

Generating an XML table

                Set<Path> sourceTablePaths = new LinkedHashSet<Path>();
                sourceTablePaths.add(Path.parse("/root/Libraries"));
                TableGenerationResult<XMLField, XMLTable> genTableResult = TableGenerationFactory
                        .getXMLTableGeneration()
                        .generateTables(currentDataset, sourceTablePaths, session);

When tables are declared in the {addon.label} configuration, you can create XML tables by using XMLTableHelper.

                        
                XMLTableHelperSpec tableHelperSpec = new XMLTableHelperSpec(applicationLogicalName, true, session);
                XMLTableHelper tableHelper = TableHelperFactory.getXMLTableHelper();
                List<XMLTable> xmlTables = tableHelper.getTables(tableHelperSpec);            

Generating an SQL table

When using the Import SQL service:

                Set<String> sqlTableNames = new LinkedHashSet<String>();
                sqlTableNames.add("LIBRARIES");
                SQLTableGeneration sqlTableGen = TableGenerationFactory.getSQLTableGeneration();
                TableGenerationResult<SQLField, SQLTable> genTableResult = sqlTableGen
                        .generateTables(
                                sqlImportConfig.getSQLDataSourceName(),
                                sqlImportConfig.getSchemaName(),
                                null,
                                sqlTableNames,
                                ServiceType.SQL_IMPORT);

When using the Export SQL service:

                Set<String> sqlTableNames = new LinkedHashSet<String>();
                sqlTableNames.add("LIBRARIES");
                SQLTableGeneration sqlTableGen = TableGenerationFactory.getSQLTableGeneration();
                TableGenerationResult<SQLField, SQLTable> genTableResult = sqlTableGen
                        .generateTables(
                                sqlExportConfig.getSQLDataSourceName(),
                                sqlExportConfig.getSchemaName(),
                                null,
                                sqlTableNames,
                                ServiceType.SQL_EXPORT);

When tables are declared in the {addon.label} configuration, you can create SQL tables by using SQLTableHelper.

                        
                SQLTableHelperSpec tableHelperSpec = new SQLTableHelperSpec(applicationLogicalName, session);
                SQLTableHelper tableHelper = TableHelperFactory.getSQLTableHelper();
                List<SQLTable> sqlTables = tableHelper.getTables(tableHelperSpec);                                    

Generating a CSV table

        
                Set<Path> sourceTablePaths = new LinkedHashSet<Path>();
                sourceTablePaths.add(Path.parse("/root/Libraries"));
                CSVTableGeneration tableGeneration = TableGenerationFactory.getCSVTableGeneration();
                TableGenerationResult<CSVField, CSVTable> result = tableGeneration
                        .generateTables(currentDataset, sourceTablePaths, session);

When tables are declared in the {addon.label} configuration, you can create CSV table by using CSVTableHelper.

                
                CSVTableHelperSpec tableHelperSpec = new CSVTableHelperSpec(applicationLogicalName, session);
                CSVTableHelper tableHelper = TableHelperFactory.getCSVTableHelper();
                List<CSVTable> csvTables = tableHelper.getTables(tableHelperSpec);
                        

Generating the spreadsheet tables

        
                Set<Path> sourceTablePaths = new LinkedHashSet<Path>();
                sourceTablePaths.add(Path.parse("/root/Libraries"));
                SpreadsheetTableGeneration tableGeneration = TableGenerationFactory.getSpreadsheetTableGeneration();
                TableGenerationResult<SpreadsheetField, SpreadsheetTable> result = tableGeneration
                        .generateTables(currentDataset,sourceTablePaths,session);

When tables are declared in the {addon.label} configuration, you can create spreadsheet table by using SpreadsheetTableHelper.

                
                SpreadsheetTableHelperSpec tableHelperSpec = new SpreadsheetTableHelperSpec(applicationLogicalName, session);
                SpreadsheetTableHelper tableHelper = TableHelperFactory.getSpreadsheetTableHelper();
                List<SpreadsheetTable> tables = tableHelper.getTables(tableHelperSpec);                       

Generating an application mapping for data transfer

                ApplicationMapping<EBXField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForTransferHelper().getApplicationMapping(transferConfig);

When table and field mappings are declared in the {addon.label} configuration, create application mapping by using TransferConfigurationSpec with ApplicationMappingForTransferHelper. See the examples below:

  • The following example shows data transfer between tables based on the same data model:

                    Set<Path> sourceTablePaths = new HashSet<Path>();
                    sourceTablePaths.add(Path.parse("/root/Libraries"));
                    sourceTablePaths.add(Path.parse("/root/Courses"));
                    ApplicationMapping<EBXField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                            .getApplicationMappingForTransferHelper().getApplicationMapping(
                                    transferConfig,
                                    sourceApplication,
                                    targetApplication,
                                    sourceTablePaths);
    
  • The following example shows data transfer between tables based on different data models:

                    Map<Path, Path> tableMappingPaths = new HashMap<Path, Path>();
                    tableMappingPaths.put(Path.parse("/root/Libraries"), Path.parse("/root/LibrariesTarget"));
                    tableMappingPaths.put(Path.parse("/root/Courses"), Path.parse("/root/CoursesTarget"));
                    for (Map.Entry<Path, Path> entry : tableMappingPaths.entrySet())
                    {
                            EBXTable srcEBXTable = new EBXTable(
                                    transferConfig.getCurrentDataset().getTable(entry.getKey()));
                            EBXTable tarEBXTable = new EBXTable(
                                    transferConfig.getTargetDataset().getTable(entry.getValue()));
                            tableMappingList.add(new TableMapping<EBXField, EBXField>(srcEBXTable, tarEBXTable));
                    }
                    ApplicationMapping<EBXField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                            .getApplicationMappingForTransferHelper().getApplicationMapping(
                                    transferConfig,
                                    sourceApplication,
                                    targetApplication,
                                    tableMappingList);
    

Generating an application mapping for the Import XML service

When table and field mappings are declared in the {addon.label} configuration:

                ApplicationMapping<XMLField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForXMLImportHelper().getApplicationMapping(
                                xmlImportConfig,
                                sourceApplication,
                                targetApplication,
                                tableMappingList);

Additionally, you can use ImportXMLConfigurationSpec to create the mapping when using Import XML with default mode:

                ApplicationMapping<XMLField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForXMLImportHelper().getApplicationMapping(xmlImportConfig);

If table and field mappings are declared in the {addon.label} configuration, the application mapping can be created by using ApplicationMappingForXMLImportHelper:

                Set<Path> targetEBXTablePaths = new HashSet<Path>();
                targetEBXTablePaths.add(Path.parse("/root/Libraries"));
                ApplicationMapping<XMLField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForXMLImportHelper().getApplicationMapping(
                                xmlImportConfig,
                                sourceApplication,
                                targetApplication,
                                targetEBXTablePaths);

Generating the application mapping for the Export XML service

When table and field mappings are declared in the {addon.label} configuration:

                ApplicationMapping<EBXField, XMLField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForXMLExportHelper().getApplicationMapping(
                                xmlExportConfig,
                                sourceApplication,
                                targetApplication,
                                tableMappingList);

Additionally, you can use ExportXMLConfigurationSpec to create the mapping when using Export XML with default mode:

                ApplicationMapping<EBXField, XMLField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForXMLExportHelper().getApplicationMapping(xmlExportConfig);

If table and field mappings are declared in the {addon.label} configuration, the application mapping can be created by using ApplicationMappingForXMLExportHelper:

                Set<Path> sourceEBXTablePaths = new HashSet<Path>();
                sourceEBXTablePaths.add(Path.parse("/root/Libraries"));
                ApplicationMapping<EBXField, XMLField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForXMLExportHelper().getApplicationMapping(
                                xmlExportConfig,
                                sourceApplication,
                                targetApplication,
                                sourceEBXTablePaths);

Generating an application mapping for the Import SQL service

                ApplicationMapping<SQLField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForSQLImportHelper().getApplicationMapping(sqlImportConfig);

Generating an application mapping for the Export SQL service

                ApplicationMapping<EBXField, SQLField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForSQLExportHelper().getApplicationMapping(sqlExportConfig);

Generating an application mapping for the Import CSV service

                ApplicationMapping<CSVField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForCSVImportHelper().getApplicationMapping(csvImportConfigSpec);

If table and field mappings are declared in the {addon.label} configuration, the application mapping can be created by using CSVImportApplicationMappingHelper:

                Set<Path> sourceEBXTablePaths = new HashSet<Path>();
                sourceEBXTablePaths.add(Path.parse("/root/Libraries"));
                
                ApplicationMapping<CSVField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForCSVImportHelper().getApplicationMapping(
                                csvImportConfigSpec,
                                sourceApplication,
                                targetApplication,
                                sourceEBXTablePaths);

Generating an application mapping for the Export CSV service

                ApplicationMapping<EBXField, CSVField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForCSVExportHelper().getApplicationMapping(csvExportConfigSpec);

If table and field mappings are declared in the {addon.label} configuration, the application mapping can be created by using CSVExportApplicationMappingHelper:

                Set<Path> sourceEBXTablePaths = new HashSet<Path>();
                sourceEBXTablePaths.add(Path.parse("/root/Libraries"));
                
                ApplicationMapping<EBXField, CSVField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForCSVExportHelper().getApplicationMapping(
                                csvExportConfigSpec,
                                sourceApplication,
                                targetApplication,
                                sourceEBXTablePaths);

Generating an application mapping for the Import Excel service

                ApplicationMapping<SpreadsheetField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForSpreadsheetImportHelper().getApplicationMapping(excelImportConfigSpec);

If table and field mappings are declared in the {addon.label} configuration, the application mapping can be created by using SpreadsheetImportApplicationMappingHelper:

                Set<Path> sourceEBXTablePaths = new HashSet<Path>();
                sourceEBXTablePaths.add(Path.parse("/root/Libraries"));
                
                ApplicationMapping<SpreadsheetField, EBXField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForSpreadsheetImportHelper().getApplicationMapping(
                                excelImportConfigSpec,
                                sourceApplication,
                                targetApplication,
                                sourceEBXTablePaths);

Generating an application mapping for the Export Excel service

                ApplicationMapping<EBXField, SpreadsheetField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForSpreadsheetExportHelper().getApplicationMapping(excelExportConfigSpec);

If table and field mappings are declared in the {addon.label} configuration, the application mapping can be created by using SpreadsheetExportApplicationMappingHelper:

                Set<Path> sourceEBXTablePaths = new HashSet<Path>();
                sourceEBXTablePaths.add(Path.parse("/root/Libraries"));
                
                ApplicationMapping<EBXField, SpreadsheetField> applicationMapping = ApplicationMappingHelperFactory
                        .getApplicationMappingForSpreadsheetExportHelper().getApplicationMapping(
                                excelExportConfigSpec,
                                sourceApplication,
                                targetApplication,
                                sourceEBXTablePaths);