Search in sources :

Example 1 with RelationMetaModel

use of org.geotoolkit.db.reverse.RelationMetaModel in project geotoolkit by Geomatys.

the class SQLQueryBuilder method encodeSelectColumnNames.

protected void encodeSelectColumnNames(StringBuilder sql, FeatureType featureType, Hints hints) {
    for (PropertyType att : featureType.getProperties(true)) {
        if (att instanceof DBRelationOperation) {
            final RelationMetaModel relation = ((DBRelationOperation) att).getRelation();
            final String str = att.getName().tip().toString();
            if (relation.isImported()) {
                dialect.encodeColumnName(sql, str);
            } else {
                // key is exported, it means the database field is in the other table.
                continue;
            }
        } else if (att instanceof Operation || att instanceof FeatureAssociationRole || AttributeConvention.contains(att.getName())) {
            continue;
        } else if (AttributeConvention.isGeometryAttribute(att)) {
            // encode as geometry
            encodeGeometryColumn((AttributeType) att, sql, hints);
            // alias it to be the name of the original geometry
            dialect.encodeColumnAlias(sql, att.getName().tip().toString());
        } else {
            dialect.encodeColumnName(sql, att.getName().tip().toString());
        }
        sql.append(',');
    }
    sql.setLength(sql.length() - 1);
}
Also used : RelationMetaModel(org.geotoolkit.db.reverse.RelationMetaModel) DBRelationOperation(org.geotoolkit.db.DBRelationOperation) PropertyType(org.opengis.feature.PropertyType) Operation(org.opengis.feature.Operation) DBRelationOperation(org.geotoolkit.db.DBRelationOperation) FeatureAssociationRole(org.opengis.feature.FeatureAssociationRole)

Aggregations

DBRelationOperation (org.geotoolkit.db.DBRelationOperation)1 RelationMetaModel (org.geotoolkit.db.reverse.RelationMetaModel)1 FeatureAssociationRole (org.opengis.feature.FeatureAssociationRole)1 Operation (org.opengis.feature.Operation)1 PropertyType (org.opengis.feature.PropertyType)1