Package com.orchestranetworks.addon.dex
Classes and interfaces to call the EBX Data Exchange Add-on 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
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);
-
Define the configuration specification:
TransferConfigurationSpec transferConfig = new TransferConfigurationSpec( sourceDataset, sourceEBXTables, targetDataset, session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(transferConfig); DataExchangeResult.Transfer result = (Transfer) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the transfer data service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the transfer data service.
Executing the Import XML service
The following example shows you how to execute the Import XML service.
-
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);
-
Define the configuration specifications:
XMLImportConfigurationSpec importXMLConfigSpec = new XMLImportConfigurationSpec( currentTable, srcXMLTable, session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(importXMLConfigSpec); DataExchangeResult.XMLImport result = (XMLImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Import XML service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Import XML service.
Executing the Export XML service
-
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);
-
Define the configuration specifications:
XMLExportConfigurationSpec exportXMLConfigSpec = new XMLExportConfigurationSpec( currentTable, session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(exportXMLConfigSpec); DataExchangeResult.XMLExport result = (XMLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Export XML service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Export XML service.
Executing the Import SQL service
The following describes how to execute the Import SQL service.
-
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);
-
Define the configuration specifications:
SQLImportConfigurationSpec importSQLConfigSpec = new SQLImportConfigurationSpec( currentTable, sqlDataSourceName, sqlTableOrView, session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(importSQLConfigSpec); DataExchangeResult.SQLImport result = (SQLImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Import SQL service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Import SQL service.
Executing the Export SQL service
The following shows how to execute the Export SQL service:
-
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);
-
Define the configuration specifications:
SQLExportConfigurationSpec exportSQLConfigSpec = new SQLExportConfigurationSpec(currentTable,sqlDataSourceName,session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(exportSQLConfigSpec); DataExchangeResult.SQLExport result = (SQLExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Export SQL service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Export SQL service.
Executing the Import CSV service
The following steps show how to execute the Import CSV service:
-
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);
-
Define the configuration specification:
CSVImportConfigurationSpec importCSVSpec = new CSVImportConfigurationSpec(currentTable, csvTable, session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(importCSVSpec); DataExchangeResult.CSVImport result = (CSVImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Import CSV service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Import CSV service.
Executing the Export CSV service
The following steps show how to execute the Export CSV service:
-
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);
-
Define the configuration specifications:
CSVExportConfigurationSpec exportCSVSpec = new CSVExportConfigurationSpec( currentTable, tableFilter, session);
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(exportCSVSpec); DataExchangeResult.CSVExport result = (CSVExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Export CSV service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Export CSV service.
Executing the Import Excel service
The following steps show how to execute the Import Excel service:
-
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);
-
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);
-
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(importSpreadsheetConfig); DataExchangeResult.SpreadsheetImport result = (SpreadsheetImport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Import Excel service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Import Excel service.
Executing the Export Excel service
The following steps show how to execute the Export Excel service:
-
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);
-
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);
-
-
Define the EBX Data Exchange Add-on specification:
DataExchangeSpec dataExchangeSpec = new DataExchangeSpec(); dataExchangeSpec.setApplicationMapping(applicationMapping); dataExchangeSpec.setConfigurationSpec(exportSpreadsheetConfigurationSpec); DataExchangeResult.SpreadsheetExport result = (SpreadsheetExport) DataExchangeServiceFactory.getDataExchangeService().execute(dataExchangeSpec);
Please refer to:
- The
com.orchestranetworks.addon.dex.configuration
package for examples of creating a configuration specification for the Export Excel service. - The
com.orchestranetworks.addon.dex.mapping
package for examples of creating an application mapping for the Export Excel service.
Executing the XML Import service in the EBX Data Exchange Add-on dataset
The following example shows how to import a EBX Data Exchange Add-on 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 EBX Data Exchange Add-on 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 EBX Data Exchange Add-on dataset
The following example shows how to export a EBX Data Exchange Add-on 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 EBX Data Exchange Add-on configuration data to an XML file, please set a PrimaryKey
collection that identifies records in the Application interface preference table in the EBX Data Exchange Add-on 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:
-
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);
-
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);
-
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);
-
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:
-
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);
-
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);
-
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);
-
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 EBX Data Exchange Add-on dataset.
The following example shows how to create a com.orchestranetworks.addon.dex.DataExchangeSpec
based on the configuration declared in the EBX Data Exchange Add-on dataset for Excel/CSV export and import:
-
Create a
com.orchestranetworks.addon.dex.DataExchangeSpec
by using the specified name declared in the Application interface preference table in the EBX Data Exchange Add-on 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);
-
To create a
com.orchestranetworks.addon.dex.DataExchangeSpec
by using the specified name declared in the Application interface preference table in the EBX Data Exchange Add-on 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);
-
To create a
com.orchestranetworks.addon.dex.DataExchangeSpec
by using the specified name declared in the Application interface preference table in the EBX Data Exchange Add-on 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);
-
To create a
com.orchestranetworks.addon.dex.DataExchangeSpec
by using the specified name declared in the Application interface preference table in the EBX Data Exchange Add-on 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);
-
ClassDescriptionProvides the context to get the
DataExchangeSpec
for exporting CSV from the configuration declared in the EBX Data Exchange Add-on dataset.Provides the context to get theDataExchangeSpec
for importing CSV from the configuration declared in the EBX Data Exchange Add-on dataset.Provides the methods to execute EBX Data Exchange Add-on configuration import and export.Represents a EBX Data Exchange Add-on specification for the export table which stores the (DataExchangeSpec
) EBX Data Exchange Add-on specification and the optional records, or optional predicate of each table.Provides the methods to build the EBX Data Exchange Add-on specification for the export table by usingApplicationMappingHelper
APIs to automatically generate an application mapping.Provides the methods to transform old specifications to new specifications.Provides the context to get theDataExchangeSpec
from the configuration declared in the EBX Data Exchange Add-on dataset.Creates instances ofDataExchangeHelper
.Provides a method for executing data import, export and transfer.Creates instances ofDataExchangeService
.Represents a EBX Data Exchange Add-on specification which stores the (ConfigurationSpec
) configuration specification and the (ApplicationMapping
) mapping specification.Provides the context to get theDataExchangeSpec
for exporting Excel from the configuration declared in the EBX Data Exchange Add-on dataset.Provides the context to get theDataExchangeSpec
for importing Excel from the configuration declared in the EBX Data Exchange Add-on dataset.