private CompoundMapping buildMapping( TableName currentTable, Pair<XSElementDeclaration, Boolean> elDecl, ComplexParticleJAXB config ) { ValueReference path = new ValueReference( config.getPath(), nsBindings ); elDecl = schemaWalker.getTargetElement( elDecl, path ); boolean escalateVoid = determineParticleVoidability( elDecl.second, config.getNullEscalation() ); List<TableJoin> joinedTable = buildJoinTable( currentTable, config.getJoin() ); if ( joinedTable != null ) { currentTable = joinedTable.get( joinedTable.size() - 1 ).getToTable(); } List<JAXBElement<? extends AbstractParticleJAXB>> children = config.getAbstractParticle(); List<Mapping> particles = new ArrayList<Mapping>( children.size() ); for ( JAXBElement<? extends AbstractParticleJAXB> child : children ) { Mapping particle = buildMapping( currentTable, elDecl, child.getValue() ); if ( particle != null ) { particles.add( particle ); } } return new CompoundMapping( path, escalateVoid, particles, joinedTable, elDecl.first, config.getCustomConverter() ); }
private Mapping buildMapping( TableName currentTable, Pair<XSElementDeclaration, Boolean> elDecl, PrimitiveParticleJAXB config ) { ValueReference path = new ValueReference( config.getPath(), nsBindings ); Pair<PrimitiveType, Boolean> pt = null; try { pt = schemaWalker.getTargetType( elDecl, path ); } catch ( RuntimeException e ) { throw new RuntimeException( "Error in mapping of table '" + currentTable + "': " + e ); } if ( config.getType() != null ) { PrimitiveType forcedType = new PrimitiveType( getPrimitiveType( config.getType() ) ); LOG.debug( "Overriding schema-derived primitive type '" + pt.getFirst() + "'. Forcing '" + forcedType + "'." ); pt.first = forcedType; } MappingExpression me = parseMappingExpression( config.getMapping() ); List<TableJoin> joinedTable = buildJoinTable( currentTable, config.getJoin() ); LOG.debug( "Targeted primitive type: " + pt ); boolean escalateVoid = determineParticleVoidability( pt.second, config.getNullEscalation() ); return new PrimitiveMapping( path, escalateVoid, me, pt.first, joinedTable, config.getCustomConverter() ); }
private GeometryMapping buildMapping( TableName currentTable, Pair<XSElementDeclaration, Boolean> elDecl, GeometryParticleJAXB config ) { ValueReference path = new ValueReference( config.getPath(), nsBindings ); MappingExpression me = parseMappingExpression( config.getMapping() ); elDecl = schemaWalker.getTargetElement( elDecl, path ); QName ptName = new QName( elDecl.first.getNamespace(), elDecl.getFirst().getName() ); ObjectPropertyType pt = gmlSchema.getGMLSchema().getGMLPropertyDecl( elDecl.first, ptName, 1, 1, null ); GeometryType type = GeometryType.GEOMETRY; if ( pt instanceof GeometryPropertyType ) { type = ( (GeometryPropertyType) pt ).getGeometryType(); } boolean escalateVoid = determineParticleVoidability( elDecl.second, config.getNullEscalation() ); List<TableJoin> joinedTable = buildJoinTable( currentTable, config.getJoin() ); return new GeometryMapping( path, escalateVoid, me, type, geometryParams, joinedTable, config.getCustomConverter() ); }
private FeatureMapping buildMapping( TableName currentTable, Pair<XSElementDeclaration, Boolean> elDecl, FeatureParticleJAXB config ) { ValueReference path = new ValueReference( config.getPath(), nsBindings ); MappingExpression hrefMe = null; if ( config.getHref() != null ) { hrefMe = parseMappingExpression( config.getHref().getMapping() ); } elDecl = schemaWalker.getTargetElement( elDecl, path ); QName ptName = new QName( elDecl.first.getNamespace(), elDecl.first.getName() ); // TODO rework this FeaturePropertyType pt = (FeaturePropertyType) gmlSchema.getGMLSchema().getGMLPropertyDecl( elDecl.first, ptName, 0, 1, null ); boolean escalateVoid = determineParticleVoidability( elDecl.second, config.getNullEscalation() ); List<TableJoin> joinedTable = buildJoinTable( currentTable, config.getJoin() ); return new FeatureMapping( path, escalateVoid, hrefMe, pt.getFTName(), joinedTable, config.getCustomConverter() ); }