private void exportKeywords200( DatasetMetadata ftMd ) throws XMLStreamException { if ( ftMd != null ) { List<Pair<List<LanguageString>, CodeType>> keywords = ftMd.getKeywords(); if ( keywords != null && !keywords.isEmpty() ) { writer.writeStartElement( OWS110_NS, "Keywords" ); for ( Pair<List<LanguageString>, CodeType> keywordsPerCodeType : keywords ) { for ( LanguageString keyword : keywordsPerCodeType.getFirst() ) { writer.writeStartElement( OWS110_NS, "Keyword" ); writer.writeCharacters( keyword.getString() ); writer.writeEndElement(); } } writer.writeEndElement(); } } }
private Pair<XSElementDeclaration, Boolean> getTargetElement( Pair<XSElementDeclaration, Boolean> context, QName elName, int num ) { XSTypeDefinition typeDef = context.getFirst().getTypeDefinition(); if ( !( typeDef instanceof XSComplexTypeDefinition ) ) { throw new IllegalArgumentException( "XPath refers to a simple type definition." ); } XSParticle particle = ( (XSComplexTypeDefinition) typeDef ).getParticle(); if ( particle == null ) { throw new IllegalArgumentException( "XPath refers to an empty type definition." ); } return getTargetElementTerm( new Pair<XSTerm, Boolean>( particle.getTerm(), null ), elName, num ); }
private String buildNewFid() throws FeatureStoreException { if ( get( fidMapping.getColumns().get( 0 ).getFirst() ) == null ) { // fid columns not available yet return null; } String newId = fidMapping.getPrefix(); List<Pair<SQLIdentifier, BaseType>> fidColumns = fidMapping.getColumns(); newId += checkFIDParticle( fidColumns.get( 0 ).first ); for ( int i = 1; i < fidColumns.size(); i++ ) { newId += fidMapping.getDelimiter() + checkFIDParticle( fidColumns.get( i ).first ); } return newId; }
writer.writeAttribute( "name", column.getFirst().toString() ); writer.writeAttribute( "type", column.getSecond().getXSTypeName() ); writer.writeEndElement();
private String retrieveTypeOfPrimaryKey( TableName fromTable, SQLIdentifier toColumn, FIDMapping fidMapping ) { if ( fidMapping != null ) { for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { if ( toColumn.equals( column.getFirst() ) ) { return getDBType( column.getSecond() ); } } } // in joins not connected to the main feature type table 'integer' is used by default if ( !fromTable.equals( currentFtTable ) ) { return "integer"; } return "varchar(2000)"; }
private String retrieveTypeOfPrimaryKey( TableName fromTable, SQLIdentifier toColumn, FIDMapping fidMapping ) { if ( fidMapping != null ) { for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { if ( toColumn.equals( column.getFirst() ) ) { return getDBType( column.getSecond() ); } } } // TODO implement this correctly // in joins not connected to the main feature type table 'integer' is used by default if ( !fromTable.equals( currentFtTable ) ) { return "integer"; } return "text"; }
private String retrieveTypeOfPrimaryKey( TableName fromTable, SQLIdentifier toColumn, FIDMapping fidMapping ) { if ( fidMapping != null ) { for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { if ( toColumn.equals( column.getFirst() ) ) { return getDBType( column.getSecond() ); } } } // TODO implement this correctly // in joins not connected to the main feature type table 'integer' is used by default if ( !fromTable.equals( currentFtTable ) ) { return "integer"; } return "varchar(2000)"; }
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() ); }
PrimitiveParticleConverter primitiveConverter = mgr.getDialect().getPrimitiveConverter( idColumn.first.getName(), type ); addPreparedArgument( idColumn.getFirst(), primitiveValue, primitiveConverter );
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() ); }