Package com.orchestranetworks.addon.adix


package com.orchestranetworks.addon.adix

Classes and interfaces to call Adix import and export.


Example of an Adix import

        ImportDataAccessSpec dataAccessSpec=new ImportDataAccessSpec(dataset,currentTable,locale,session);

        AdixImportSpec importSpec = new AdixImportSpec();
        File importedFile = new File(importedFilePath);
        importSpec.setDataAccessSpec(dataAccessSpec);
        importSpec.setImportedFile(importedFile);
        importSpec.setImportPreference(importPreferenceName);
        importSpec.setImportType(ImportType.CSV);       

        AdixImportResult importResult = AdixFactory.getAdixImport().execute(importSpec);

Example of an Adix export

        ExportDataAccessSpec dataAccessSpec = new ExportDataAccessSpec(dataset,currentTable,locale,session);
        AdixExportSpec exportSpec = new AdixExportSpec();
        exportSpec.setDataAccessSpec(dataAccessSpec);
        exportSpec.setExportPreference(exportPreferenceName);
        exportSpec.setImportPreference(importPreferenceName);
        exportSpec.setExportType(ExportType.EXCEL_FOR_SINGLE_TABLE);

        AdixExportResult exportResult = AdixFactory.getAdixExport().execute(exportSpec);

Example of an Adix export using data filter

        List<ExportTableFilter> exportTableFilters = new ArrayList<ExportTableFilter>();
        ExportTableFilter tableFilter = new ExportTableFilter();
        tableFilter.setTablePath(tablePath);
        tableFilter.setPredicate(predicate);
        tableFilter.setSchemaNodes(schemaNodes);
        exportTableFilters.add(tableFilter);
        
        ExportDataAccessSpec dataAccessSpec = new ExportDataAccessSpec(currentTable,exportTableFilters,session);
        AdixExportSpec exportSpec = new AdixExportSpec();
        exportSpec.setDataAccessSpec(dataAccessSpec);
        exportSpec.setExportPreference(exportPreferenceName);
        exportSpec.setImportPreference(importPreferenceName);
        exportSpec.setExportType(ExportType.EXCEL_FOR_SINGLE_TABLE);

        AdixExportResult exportResult = AdixFactory.getAdixExport().execute(exportSpec);

Example of creating a transformer class

Firstly, create a transformer class.

For example:

        public final class TransformerExample implements Transformer
        {
                public Object getValueOnExport(TransformContextForExport context)
                {
                        return context.getValueInTable();
                }

                public Object getValueOnImport(TransformContextForImport context)
                {
                        return context.getValueInSpreadsheet();
                }
        }

Next, declare the transformer definition.

        TransformerDefinition transformerDefinition = new TransformerDefinition(
                TransformerExample.class,
                UserMessage.createInfo("Transformer example"),
                UserMessage.createInfo("Transformer example"));

Finally, register this transformer.

        TransformerCatalog.add(transformerDefinition,repository);