private String getDataEntity(Id.Program programId, Data type, String name) throws Exception {
try {
Id.Account account = new Id.Account(programId.getAccountId());
if (type == Data.DATASET) {
DatasetSpecification dsSpec = getDatasetSpec(name);
String typeName = null;
if (dsSpec != null) {
typeName = dsSpec.getType();
}
return GSON.toJson(makeDataSetRecord(name, typeName));
} else if (type == Data.STREAM) {
StreamSpecification spec = store.getStream(account, name);
return spec == null ? "" : GSON.toJson(makeStreamRecord(spec.getName(), spec));