Package com.orchestranetworks.addon.dex


package com.orchestranetworks.addon.dex

Classes and interfaces to call the {addon.label} import, export and transfer.


Example of executing the import, export and transfer data services

                DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                dataExchangeSpec.setApplicationMapping(applicationMapping);
                dataExchangeSpec.setConfigurationSpec(configurationSpec);
                DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);

If you use the com.orchestranetworks.addon.dataexchange.DataExchangeSpec specification it must be converted as follows:

                DataExchangeSpec newSpec = DataExchangeHelperFactory.getDataExchangeHelper()
                        .transform(oldSpec);

Executing the Transfer data service

The following example demonstrates how to execute the transfer data service

  1. Define the application mapping:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.EBX);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.EBX);
                    
                    ApplicationMapping<EBXField, EBXField> applicationMapping = new ApplicationMapping<EBXField, EBXField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specification:

                    TransferConfigurationSpec transferConfig = new TransferConfigurationSpec(
                            sourceDataset,
                            sourceEBXTables,
                            targetDataset,
                            session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(transferConfig);
                    DataExchangeResult.Transfer result = (Transfer) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Import XML service

The following example shows you how to execute the Import XML service.

  1. Define the application mapping as follows:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.XML);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.EBX);
                    
                    ApplicationMapping<XMLField, EBXField> applicationMapping = new ApplicationMapping<XMLField, EBXField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

                    XMLImportConfigurationSpec importXMLConfigSpec = new XMLImportConfigurationSpec(
                            currentTable,
                            srcXMLTable,
                            session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(importXMLConfigSpec);
                    DataExchangeResult.XMLImport result = (XMLImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Export XML service

  1. Define the application mapping as follows:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.EBX);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.XML);
                    
                    ApplicationMapping<EBXField, XMLField> applicationMapping = new ApplicationMapping<EBXField, XMLField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

                    XMLExportConfigurationSpec exportXMLConfigSpec = new XMLExportConfigurationSpec(
                            currentTable,
                            session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(exportXMLConfigSpec);
                    DataExchangeResult.XMLExport result = (XMLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Import SQL service

The following describes how to execute the Import SQL service.

  1. Define the application mapping as shown below:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.DEFAULT_SQL);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.EBX);
                    
                    ApplicationMapping<SQLField, EBXField> applicationMapping = new ApplicationMapping<SQLField, EBXField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

                    SQLImportConfigurationSpec importSQLConfigSpec = new SQLImportConfigurationSpec(
                            currentTable,
                            sqlDataSourceName,
                            sqlTableOrView,
                            session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(importSQLConfigSpec);
                    DataExchangeResult.SQLImport result = (SQLImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Export SQL service

The following shows how to execute the Export SQL service:

  1. Define the application mapping as follows:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.EBX);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.DEFAULT_SQL);
                    
                    ApplicationMapping<EBXField, SQLField> applicationMapping = new ApplicationMapping<EBXField, SQLField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

                    SQLExportConfigurationSpec exportSQLConfigSpec = new SQLExportConfigurationSpec(currentTable,sqlDataSourceName,session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(exportSQLConfigSpec);
                    DataExchangeResult.SQLExport result = (SQLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Import CSV service

The following steps show how to execute the Import CSV service:

  1. Define the application mapping as follows:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.CSV);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.EBX);
                    
                    ApplicationMapping<CSVField, EBXField> applicationMapping = new ApplicationMapping<CSVField, EBXField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specification:

                    CSVImportConfigurationSpec importCSVSpec = new CSVImportConfigurationSpec(currentTable, csvTable, session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(importCSVSpec);
                    DataExchangeResult.CSVImport result = (CSVImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Export CSV service

The following steps show how to execute the Export CSV service:

  1. Define the application mapping:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.EBX);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.CSV);
                    
                    ApplicationMapping<EBXField, CSVField> applicationMapping = new ApplicationMapping<EBXField, CSVField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

                    CSVExportConfigurationSpec exportCSVSpec = new CSVExportConfigurationSpec(
                            currentTable,
                            tableFilter,
                            session);
    
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(exportCSVSpec);
                    DataExchangeResult.CSVExport result = (CSVExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:

Executing the Import Excel service

The following steps show how to execute the Import Excel service:

  1. Define the application mapping as follows:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.EXCEL);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.EBX);
                    
                    ApplicationMapping<SpreadsheetField, EBXField> applicationMapping = new ApplicationMapping<SpreadsheetField, EBXField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

    • When importing a single table:

                      SpreadsheetImportConfigurationSpec importSpreadsheetConfig = new SpreadsheetImportConfigurationSpec(
                              currentTable,
                              spreadsheetTable,
                              session);
      
    • When importing multiple tables:

                      SpreadsheetImportConfigurationSpec importSpreadsheetConfig = new SpreadsheetImportConfigurationSpec(
                              currentDataset,
                              spreadsheetTables,
                              session);
      
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(importSpreadsheetConfig);
                    DataExchangeResult.SpreadsheetImport result = (SpreadsheetImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:


Executing the Export Excel service

The following steps show how to execute the Export Excel service:

  1. Define the application mapping:

                    CommonApplication sourceApplication = new CommonApplication(
                            sourceLogicalName,
                            ApplicationType.EBX);
                    CommonApplication targetApplication = new CommonApplication(
                            targetLogicalName,
                            ApplicationType.EXCEL);
                    
                    ApplicationMapping<EBXField, SpreadsheetField> applicationMapping = new ApplicationMapping<EBXField, SpreadsheetField>(
                            sourceApplication,
                            targetApplication);
    
  2. Define the configuration specifications:

    • Exporting a single table:

                      SpreadsheetExportConfigurationSpec exportSpreadsheetConfigurationSpec = new SpreadsheetExportConfigurationSpec(
                              ebxTable,
                              tableFilter,
                              session);
      
    • Exporting multiple tables:

                      SpreadsheetExportConfigurationSpec exportSpreadsheetConfigurationSpec = new SpreadsheetExportConfigurationSpec(
                              dataset,
                              ebxTables,
                              tableFilters,
                              session);
      
  3. Define the {addon.label} specification:

                    DataExchangeSpec dataExchangeSpec = new DataExchangeSpec();
                    dataExchangeSpec.setApplicationMapping(applicationMapping);
                    dataExchangeSpec.setConfigurationSpec(exportSpreadsheetConfigurationSpec);
                    DataExchangeResult.SpreadsheetExport result = (SpreadsheetExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Please refer to:


Executing the XML Import service in the {addon.label} dataset

The following example shows how to import a {addon.label} configuration from an XML file.

                Session session;
                String importedFilePath;
                ImportMode importMode;
                ImportDataExchangeConfigurationSpec configurationSpec = new ImportDataExchangeConfigurationSpec();
                File importedFile = new File(importedFilePath);
                configurationSpec.setImportedFile(importedFile);
                configurationSpec.setSession(session);
                configurationSpec.setImportMode(importMode);
                
                DataExchangeResult.XMLImport importResult = DataExchangeServiceFactory.getDataExchangeConfigurationService().doImport(configurationSpec);       

To import {addon.label} add-on configuration from an XML file, please set the specified preference owner and import scope as outlined below:

                // Sets the import scope
                configurationSpec.setImportScopes(importScopes);
                // Sets the preference owner
                configurationSpec.setProfile(profile);  

Executing the XML Export service in the {addon.label} dataset

The following example shows how to export a {addon.label} configuration to an XML file.

                Session session;
                String exportedFilePath;
                ExportDataExchangeConfigurationSpec configurationSpec = new ExportDataExchangeConfigurationSpec();
                configurationSpec.setSession(session);
                File exportedFile=new File(exportedFilePath);
                configurationSpec.setExportedFile(exportedFile);
                configurationSpec.setXMLIndented(false);
                configurationSpec.setXMLCommentOmitted(true);
                
                DataExchangeResult.XMLExport exportResult = DataExchangeServiceFactory.getDataExchangeConfigurationService().doExport(configurationSpec);

To export {addon.label} configuration data to an XML file, please set a PrimaryKey collection that identifies records in the Application interface preference table in the {addon.label} dataset as shown below:

                Set<PrimaryKey> preferenceRecords;
                configurationSpec.setPreferenceRecords(preferenceRecords);

Executing the Export Excel service with an automatically generated application mapping

The following example shows how to execute the Export Excel service with an automatically generated application mapping:

                Adaptation dataset;
                Session session;
                
                Adaptation oneRecord;
                List<Adaptation> listOfRecords;
                AdaptationTable adaptationTable;
                AdaptationTable adaptationTableWithFilter;
                TableFilter tableFilter;
                
                DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.EXCEL, session)
                        .setTableContent(oneRecord)
                        .setTableContent(listOfRecords)
                        .setTableContent(adaptationTable)
                        .setTableContent(adaptationTableWithFilter, tableFilter)
                        .build();
                
                DataExchangeResult.SpreadsheetExport exportResult = (SpreadsheetExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);

Executing the Export CSV service with an automatically generated application mapping

The following example shows how to execute the Export CSV service with an automatically generated application mapping:

  1. Exporting a single record:

                    Adaptation dataset;
                    Session session;
                    Adaptation oneRecord;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.CSV, session)
                            .setTableContent(oneRecord)
                            .build();
                    
                    DataExchangeResult.CSVExport exportResult = (CSVExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    
  2. Exporting a list of records:

                    Adaptation dataset;
                    Session session;
                    List<Adaptation> listOfRecords;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.CSV, session)
                            .setTableContent(listOfRecords)
                            .build();
                    
                    DataExchangeResult.CSVExport exportResult = (CSVExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    
  3. Exporting a table:

                    Adaptation dataset;
                    Session session;
                    AdaptationTable adaptationTable;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.CSV, session)
                            .setTableContent(adaptationTable)
                            .build();
                    
                    DataExchangeResult.CSVExport exportResult = (CSVExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    
  4. Exporting a table with filter:

                    Adaptation dataset;
                    Session session;
                    AdaptationTable adaptationTableWithFilter;
                    TableFilter tableFilter;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.CSV, session)
                            .setTableContent(adaptationTableWithFilter, tableFilter)
                            .build();
                    
                    DataExchangeResult.CSVExport exportResult = (CSVExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Executing the Export XML service with an automatically generated application mapping

The following example shows how to execute the Export XML service with an automatically generated application mapping:

  1. Exporting a single record:

                    Adaptation dataset;
                    Session session;
                    Adaptation oneRecord;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.XML, session)
                            .setTableContent(oneRecord)
                            .build();
                    
                    DataExchangeResult.XMLExport exportResult = (XMLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    
  2. Exporting a list of records:

                    Adaptation dataset;
                    Session session;
                    List<Adaptation> listOfRecords;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.XML, session)
                            .setTableContent(listOfRecords)
                            .build();
                    
                    DataExchangeResult.XMLExport exportResult = (XMLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    
  3. Exporting a table:

                    Adaptation dataset;
                    Session session;
                    AdaptationTable adaptationTable;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.XML, session)
                            .setTableContent(adaptationTable)
                            .build();
                    
                    DataExchangeResult.XMLExport exportResult = (XMLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    
  4. Exporting a table with filter:

                    Adaptation dataset;
                    Session session;
                    AdaptationTable adaptationTableWithFilter;
                    TableFilter tableFilter;
                    
                    DataExchangeExportTableSpec dataExchangeSpec = new DataExchangeExportTableSpecBuilder(dataset, ApplicationType.XML, session)
                            .setTableContent(adaptationTableWithFilter, tableFilter)
                            .build();
                    
                    DataExchangeResult.XMLExport exportResult = (XMLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
    

Creating a com.orchestranetworks.addon.dex.DataExchangeSpec based on the configuration declared in the {addon.label} dataset.

The following example shows how to create a com.orchestranetworks.addon.dex.DataExchangeSpec based on the configuration declared in the {addon.label} dataset for Excel/CSV export and import:

  1. Create a com.orchestranetworks.addon.dex.DataExchangeSpec by using the specified name declared in the Application interface preference table in the {addon.label} dataset for Excel export:

    When exporting a single table:

                    AdaptationTable table;
                    String preferenceName;
                    Session session;
                    SpreadsheetExportDataExchangeHelperContext context = new SpreadsheetExportDataExchangeHelperContext(
                                    preferenceName,
                                    table,
                                    session);
                    DataExchangeSpec dataExchangeSpec = DataExchangeHelperFactory.getDataExchangeHelper().getDataExchangeSpec(context);
    
                    DataExchangeResult.SpreadsheetExport dataExchangeResult = (SpreadsheetExport) DataExchangeServiceFactory
                                    .getDataExchangeService().execute(dataExchangeSpec);
    

    When exporting multiple tables:

                    Adaptation dataset;
                    String preferenceName;
                    Session session;
                    SpreadsheetExportDataExchangeHelperContext context = new SpreadsheetExportDataExchangeHelperContext(
                                    preferenceName,
                                    dataset,
                                    session);
                    DataExchangeSpec dataExchangeSpec = DataExchangeHelperFactory.getDataExchangeHelper().getDataExchangeSpec(context);
    
                    DataExchangeResult.SpreadsheetExport dataExchangeResult = (SpreadsheetExport) DataExchangeServiceFactory
                                    .getDataExchangeService().execute(dataExchangeSpec);
    
  2. To create a com.orchestranetworks.addon.dex.DataExchangeSpec by using the specified name declared in the Application interface preference table in the {addon.label} dataset for Excel import:

    When importing a single table:

                    String preferenceName;
                    AdaptationTable table;
                    Session session;
                    File importedFile;
                    SpreadsheetImportDataExchangeHelperContext context = new SpreadsheetImportDataExchangeHelperContext(
                                    preferenceName,
                                    table,
                                    session);
                    context.setImportedFile(importedFile);
                    DataExchangeSpec dataExchangeSpec = DataExchangeHelperFactory.getDataExchangeHelper().getDataExchangeSpec(context);
    
                    DataExchangeResult.SpreadsheetImport dataExchangeResult = (SpreadsheetImport) DataExchangeServiceFactory
                                    .getDataExchangeService().execute(dataExchangeSpec);
    

    When importing multiple tables:

                    String preferenceName;
                    Adaptation dataset;
                    Session session;
                    File importedFile;
                    SpreadsheetImportDataExchangeHelperContext context = new SpreadsheetImportDataExchangeHelperContext(
                                    preferenceName,
                                    dataset,
                                    session);
                    context.setImportedFile(importedFile);
                    DataExchangeSpec dataExchangeSpec = DataExchangeHelperFactory.getDataExchangeHelper().getDataExchangeSpec(context);
    
                    DataExchangeResult.SpreadsheetImport dataExchangeResult = (SpreadsheetImport) DataExchangeServiceFactory
                                    .getDataExchangeService().execute(dataExchangeSpec);
    
  3. To create a com.orchestranetworks.addon.dex.DataExchangeSpec by using the specified name declared in the Application interface preference table in the {addon.label} dataset for CSV export:

                    AdaptationTable table;
                    String preferenceName;
                    Session session;
                    CSVExportDataExchangeHelperContext context = new CSVExportDataExchangeHelperContext(
                                    preferenceName,
                                    table,
                                    session);
                    DataExchangeSpec dataExchangeSpec = DataExchangeHelperFactory.getDataExchangeHelper().getDataExchangeSpec(context);
    
                    DataExchangeResult.CSVExport dataExchangeResult = (CSVExport) DataExchangeServiceFactory
                                    .getDataExchangeService().execute(dataExchangeSpec);
    
  4. To create a com.orchestranetworks.addon.dex.DataExchangeSpec by using the specified name declared in the Application interface preference table in the {addon.label} dataset for CSV import:

                    String preferenceName;
                    AdaptationTable table;
                    Session session;
                    File importedFile;
                    CSVImportDataExchangeHelperContext context = new CSVImportDataExchangeHelperContext(
                                    preferenceName,
                                    table,
                                    session);
                    context.setImportedFile(importedFile);
                    DataExchangeSpec dataExchangeSpec = DataExchangeHelperFactory.getDataExchangeHelper().getDataExchangeSpec(context);
    
                    DataExchangeResult.CSVImport dataExchangeResult = (CSVImport) DataExchangeServiceFactory
                                    .getDataExchangeService().execute(dataExchangeSpec);