use of com.dexels.navajo.adapter.sqlmap.RecordMap in project navajo by Dexels.
the class QueryMap method store.
@Override
public void store() throws MappableException, UserException {
// Construct Navajo message.
try {
Message recordSet = NavajoFactory.getInstance().createMessage(outputDoc, "RecordSet", Message.MSG_TYPE_ARRAY);
try {
outputDoc.addMessage(recordSet);
} catch (NavajoException ex) {
throw new UserException(-1, ex.getMessage(), ex);
}
ResultSetMap[] resultSet = getResultSet();
for (int i = 0; i < resultSet.length; i++) {
Message record = NavajoFactory.getInstance().createMessage(outputDoc, "RecordSet", Message.MSG_TYPE_ARRAY_ELEMENT);
recordSet.addElement(record);
RecordMap[] columns = resultSet[i].getRecords();
for (int j = 0; j < columns.length; j++) {
try {
Object value = columns[j].getRecordValue();
String type = (value != null ? MappingUtils.determineNavajoType(value) : "unknown");
Property prop = NavajoFactory.getInstance().createProperty(outputDoc, columns[j].recordName, type, null, 0, "", Property.DIR_IN);
prop.setAnyValue(value);
record.addProperty(prop);
} catch (Exception ex1) {
throw new UserException(-1, ex1.getMessage(), ex1);
}
}
}
} finally {
super.store();
}
}
Aggregations