use of org.apache.olingo.commons.api.edm.EdmComplexType in project teiid by teiid.
the class ComplexDocumentNode method addAllColumns.
@Override
protected void addAllColumns(boolean onlyPK) {
for (final Column column : procedure.getResultSet().getColumns()) {
if (column.isSelectable()) {
EdmReturnType returnType = procedureReturn.getReturnType();
EdmComplexType complexType = (EdmComplexType) returnType.getType();
EdmPropertyImpl edmProperty = (EdmPropertyImpl) complexType.getProperty(column.getName());
addProjectedColumn(new ElementSymbol(column.getName(), getGroupSymbol()), edmProperty.getType(), edmProperty, edmProperty.isCollection());
}
}
}
use of org.apache.olingo.commons.api.edm.EdmComplexType in project teiid by teiid.
the class OperationResponseImpl method getComplexProperty.
private ComplexValue getComplexProperty(ResultSet rs) throws SQLException {
HashMap<Integer, Property> properties = new HashMap<Integer, Property>();
for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
Object value = rs.getObject(i + 1);
String propName = rs.getMetaData().getColumnLabel(i + 1);
EdmElement element = ((EdmComplexType) this.procedureReturn.getReturnType().getType()).getProperty(propName);
if (!(element instanceof EdmProperty) && !((EdmProperty) element).isPrimitive()) {
throw new SQLException(new TeiidNotImplementedException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16024)));
}
EdmPropertyImpl edmProperty = (EdmPropertyImpl) element;
Property property;
try {
property = EntityCollectionResponse.buildPropery(propName, (SingletonPrimitiveType) edmProperty.getType(), edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isCollection(), value);
properties.put(i, property);
} catch (IOException e) {
throw new SQLException(e);
} catch (TeiidProcessingException e) {
throw new SQLException(e);
}
}
// filter those columns out.
return createComplex("result", properties.values());
}
use of org.apache.olingo.commons.api.edm.EdmComplexType in project teiid by teiid.
the class ComplexDocumentNode method addProjectedColumn.
@Override
protected void addProjectedColumn(final String columnName, final Expression expr) {
EdmReturnType returnType = procedureReturn.getReturnType();
EdmComplexType complexType = (EdmComplexType) returnType.getType();
EdmPropertyImpl edmProperty = (EdmPropertyImpl) complexType.getProperty(columnName);
addProjectedColumn(expr, edmProperty.getType(), edmProperty, edmProperty.isCollection());
}
Aggregations