Package com.orchestranetworks.addon.dataexchange.sql


package com.orchestranetworks.addon.dataexchange.sql

Classes and interfaces to define mappings in {addon.label} SQL import and export.


Creating an SQL column mapping in SQL import or export

You must define a SQL column mapping definition before adding it to your code SQLMappingColumnCatalog

For example:

        public final class SampleSQLMappingColumnDefinition implements SQLMappingColumnDefinition
        {
        
                public UserMessage getLabel()
                {
                        return UserMessage.createInfo("Sample SQL mapping column");
                }
        
                public UserMessage getDescription()
                {
                        return UserMessage.createInfo("Sample SQL mapping column");
                }
        
                public SQLMappingColumn getSQLMappingColumn()
                {
                        return new SampleSQLMappingColumnImplementation();
                }
        }

Next, create the implementation definition.

The following example shows how to create mappings between the SQL columns and the schema nodes in EBX®:

        public final class SampleSQLMappingColumnImplementation implements SQLMappingColumn
        {
                public SQLMappingColumnResultList execute(SQLMappingColumnContext sqlMappingColumnContext)
                {
                        SQLMappingColumnResultList mappingColumnResultList = new SQLMappingColumnResultList();
                        // Map the 'column1' column in SQL with the 'field1' schema node in EBX®. 
                        SchemaNode field1 = sqlMappingColumnContext.getSchemaNode(Path.parse("/root/SampleTable/field1"));
                        SQLColumnSpec column1 = sqlMappingColumnContext.getSQLColumnSpec("column1");
                        SQLMappingColumnResult mappingColumn1 = new SQLMappingColumnResult(field1, column1);
                        mappingColumnResultList.add(mappingColumn1);
        
                        // Map the 'column2' column in SQL with the 'field2' schema node in EBX®. 
                        SchemaNode field2 = sqlMappingColumnContext.getSchemaNode(Path.parse("/root/SampleTable/field2"));
                        SQLColumnSpec column2 = sqlMappingColumnContext.getSQLColumnSpec("column2");
                        SQLMappingColumnResult mappingColumn2 = new SQLMappingColumnResult(field2, column2);
                        mappingColumnResultList.add(mappingColumn2);
        
                        return mappingColumnResultList;
                }
        }

Finally, register the SQL column mapping definition in the add-on to make it available in the configuration:

        SQLMappingColumnCatalog.add(new SampleSQLMappingColumnDefinition());

Example of an internal SQL column mapping definition in {addon.label}

Some internal SQL column mapping definitions are available in {addon.label}. Please see the enum SQLMappingColumnDefinition.PredefinedSQLMappingColumnDefinition for more details.

The following example shows how to get a SQL column mapping definition with PredefinedSQLMappingColumnDefinition enum.

        SQLMappingColumnCatalog.getSQLMappingColumnDefinition(PredefinedSQLMappingColumnDefinition.MAP_NAME_WITH_INSENSITIVE);