Search in sources :

Example 16 with BaseMapping

use of io.atlasmap.v2.BaseMapping in project atlasmap by atlasmap.

the class JavaJsonFlatMappingTest method generateJsonJavaFlatMapping.

protected AtlasMapping generateJsonJavaFlatMapping() {
    AtlasMapping atlasMapping = AtlasModelFactory.createAtlasMapping();
    atlasMapping.setName("JsonJavaFlatMapping");
    atlasMapping.getDataSource().add(generateDataSource("atlas:java?className=io.atlasmap.java.test.SourceFlatPrimitiveClass", DataSourceType.SOURCE));
    atlasMapping.getDataSource().add(generateDataSource("atlas:json", DataSourceType.TARGET));
    List<BaseMapping> mappings = atlasMapping.getMappings().getMapping();
    // Add fieldMappings
    for (String fieldName : FLAT_FIELDS) {
        Mapping mfm = AtlasModelFactory.createMapping(MappingType.MAP);
        mfm.getInputField().add(generateJavaField("/" + fieldName));
        mfm.getOutputField().add(generateJsonField("/" + fieldName));
        mappings.add(mfm);
    }
    return atlasMapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping)

Aggregations

BaseMapping (io.atlasmap.v2.BaseMapping)16 Mapping (io.atlasmap.v2.Mapping)14 AtlasMapping (io.atlasmap.v2.AtlasMapping)13 Field (io.atlasmap.v2.Field)6 Mappings (io.atlasmap.v2.Mappings)4 Test (org.junit.Test)4 Collection (io.atlasmap.v2.Collection)3 AtlasException (io.atlasmap.api.AtlasException)2 JavaField (io.atlasmap.java.v2.JavaField)2 AtlasModule (io.atlasmap.spi.AtlasModule)2 ConstantField (io.atlasmap.v2.ConstantField)2 AtlasContext (io.atlasmap.api.AtlasContext)1 AtlasSession (io.atlasmap.api.AtlasSession)1 AtlasValidationException (io.atlasmap.api.AtlasValidationException)1 DefaultAtlasContextFactory (io.atlasmap.core.DefaultAtlasContextFactory)1 DocumentJavaFieldWriter (io.atlasmap.java.core.DocumentJavaFieldWriter)1 ClassInspectionService (io.atlasmap.java.inspect.ClassInspectionService)1 DateTimeClass (io.atlasmap.java.test.DateTimeClass)1 JavaClass (io.atlasmap.java.v2.JavaClass)1 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)1