use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.STOREDBY in project dhis2-core by dhis2.
the class EventDataValueRowCallbackHandler method getDataValue.
private List<DataValue> getDataValue(ResultSet rs) throws SQLException {
// TODO not sure this is the most efficient way to handle JSONB -> java
List<DataValue> dataValues = new ArrayList<>();
PGobject values = (PGobject) rs.getObject("eventdatavalues");
Map<String, ?> eventDataValuesJson = gson.fromJson(values.getValue(), Map.class);
for (String dataElementUid : eventDataValuesJson.keySet()) {
Map jsonValues = (Map) eventDataValuesJson.get(dataElementUid);
DataValue value = new DataValue(dataElementUid, (String) jsonValues.get("value"));
value.setCreated((String) jsonValues.get("created"));
value.setLastUpdated((String) jsonValues.get("lastUpdated"));
value.setStoredBy((String) jsonValues.get("storedBy"));
value.setProvidedElsewhere((Boolean) jsonValues.get("providedElsewhere"));
dataValues.add(value);
}
return dataValues;
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.STOREDBY in project dhis2-core by dhis2.
the class TrackedEntityAttributeRowCallbackHandler method getAttribute.
private Attribute getAttribute(ResultSet rs) throws SQLException {
Attribute attribute = new Attribute();
attribute.setCreated(DateUtils.getIso8601NoTz(rs.getTimestamp(getColumnName(CREATED))));
attribute.setLastUpdated(DateUtils.getIso8601NoTz(rs.getTimestamp(getColumnName(UPDATED))));
attribute.setDisplayName(rs.getString(getColumnName(ATTR_NAME)));
attribute.setAttribute(rs.getString(getColumnName(ATTR_UID)));
attribute.setValueType(ValueType.fromString(rs.getString(getColumnName(ATTR_VALUE_TYPE))));
attribute.setCode(rs.getString(getColumnName(ATTR_CODE)));
attribute.setValue(rs.getString(getColumnName(VALUE)));
attribute.setStoredBy(rs.getString(getColumnName(STOREDBY)));
attribute.setSkipSynchronization(rs.getBoolean(getColumnName(ATTR_SKIP_SYNC)));
return attribute;
}
Aggregations