/** * Returns the name of the global id lookup table (that allows the lookup of features / geometries by id). * * @return the name of the lookup table, can be <code>null</code> (no global lookup table, only per feature type) */ public String getIdLookupTable() { if ( blobMapping == null ) { return null; } return blobMapping.getTable().toString(); }
private List<StringBuffer> getGeometryCreate( GeometryMapping mapping, DBField dbField, TableName table ) { List<StringBuffer> ddls = new ArrayList<StringBuffer>(); String schema = table.getSchema() == null ? "" : table.getSchema(); String column = dbField.getColumn(); String srid = mapping.getSrid(); double[] dom = mapping.getCRS().getValidDomain(); StringBuffer sql = new StringBuffer(); sql.append( "INSERT INTO user_sdo_geom_metadata(TABLE_NAME,COLUMN_NAME,DIMINFO,SRID) VALUES (" + "'" + table.toString().toUpperCase() + "','" + column.toUpperCase() + "',SDO_DIM_ARRAY(" + "SDO_DIM_ELEMENT('X', " + dom[0] + ", " + dom[2] + ", 0.00000005), SDO_DIM_ELEMENT('Y', " + dom[1] + ", " + dom[3] + ", 0.00000005)), null)" ); ddls.add( sql ); sql = new StringBuffer(); sql.append( "CREATE INDEX " + table.getTable().toUpperCase() + "_" + column.toUpperCase() + " ON " + table.toString().toUpperCase() + "(" + column.toUpperCase() + ") INDEXTYPE IS MDSYS.SPATIAL_INDEX" ); ddls.add( sql ); return ddls; }
private void writeJoinedTable( XMLStreamWriter writer, TableJoin jc ) throws XMLStreamException { writer.writeStartElement( CONFIG_NS, "Join" ); if ( jc.getToTable() != null ) { writer.writeAttribute( "table", jc.getToTable().toString() ); } writer.writeAttribute( "fromColumns", StringUtils.concat( jc.getFromColumns(), "," ) ); writer.writeAttribute( "toColumns", StringUtils.concat( jc.getToColumns(), "," ) ); if ( jc.getOrderColumns() != null && !jc.getOrderColumns().isEmpty() ) { writer.writeAttribute( "orderColumns", StringUtils.concat( jc.getOrderColumns(), "," ) ); } if ( jc.isNumberedOrder() ) { writer.writeAttribute( "numbered", "true" ); } writer.writeEndElement(); }
private void followJoins( List<TableJoin> joinedTables ) { if ( joinedTables != null ) { for ( TableJoin joinedTable : joinedTables ) { String fromTable = currentTable; String fromTableAlias = currentTableAlias; String toTable = joinedTable.getToTable().toString(); String toTableAlias = aliasManager.generateNew(); List<String> fromColumns = new ArrayList<String>( joinedTable.getFromColumns().size() ); for ( SQLIdentifier fromColumn : joinedTable.getFromColumns() ) { fromColumns.add( fromColumn.toString() ); } List<String> toColumns = new ArrayList<String>( joinedTable.getToColumns().size() ); for ( SQLIdentifier toColumn : joinedTable.getToColumns() ) { toColumns.add( toColumn.toString() ); } Join appliedJoin = new Join( fromTable, fromTableAlias, fromColumns, toTable, toTableAlias, toColumns ); joins.add( appliedJoin ); currentTable = toTable; currentTableAlias = toTableAlias; } } } }
tableNameToColumns.put( new TableName( qTable.toString() ), columnNameToMD ); } finally { JDBCUtils.close( rs );
writer.writeAttribute( "table", ftMapping.getFtTable().toString() );
currentTable = ftMapping.getFtTable().toString(); currentTableAlias = aliasManager.getRootTableAlias(); map( ftMapping.getMappings(), steps );
tableNameToColumns.put( new TableName( qTable.toString() ), columnNameToMD ); } finally { JDBCUtils.close( rs );
private void map( FeatureMapping mapping, List<MappableStep> remaining ) throws UnmappableException { // followJoins( mapping.getJoinedTable() ); if ( remaining.size() < 2 ) { throw new UnmappableException( "Not enough steps." ); } MappableStep ftStep = remaining.get( 0 ); if ( !( ftStep instanceof ElementStep ) ) { throw new UnmappableException( "Must provide a feature type name." ); } QName ftName = ( (ElementStep) ftStep ).getNodeName(); FeatureTypeMapping ftMapping = schema.getFtMapping( ftName ); if ( ftMapping == null ) { throw new UnmappableException( "Feature type '" + ftName + " is not mapped to a table." ); } String fromTable = currentTable; String fromTableAlias = currentTableAlias; // TODO what do do with Href mappings here? Needs proper reference resolving code for mapping here... String fromColumn = mapping.getJoinedTable().get( 0 ).getFromColumns().get( 0 ).toString(); String toTable = ftMapping.getFtTable().toString(); String toTableAlias = aliasManager.generateNew(); String toColumn = ftMapping.getFidMapping().getColumn(); Join appliedJoin = new Join( fromTable, fromTableAlias, Collections.singletonList( fromColumn ), toTable, toTableAlias, Collections.singletonList( toColumn ) ); joins.add( appliedJoin ); currentTable = toTable; currentTableAlias = toTableAlias; map( ftMapping.getMappings(), remaining.subList( 1, remaining.size() ) ); }
if ( joinConfig != null ) { jc = buildJoinTable( table, joinConfig ); DBField dbField = new DBField( jc.get( 0 ).getToTable().toString(), jc.get( 0 ).getToColumns().get( 0 ).toString() ); valueTable = new TableName( dbField.getTable(), dbField.getSchema() );