use of org.apache.olingo.commons.api.edm.EdmElement 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());
}
Aggregations