use of bio.terra.workspace.service.workspace.model.Workspace in project terra-workspace-manager by DataBiosphere.
the class WorkspaceDao method getWorkspaceIfExists.
@ReadTransaction
public Optional<Workspace> getWorkspaceIfExists(UUID id) {
if (id == null) {
throw new MissingRequiredFieldException("Valid workspace id is required");
}
String sql = WORKSPACE_SELECT_SQL + " WHERE workspace_id = :id";
MapSqlParameterSource params = new MapSqlParameterSource().addValue("id", id.toString());
try {
Workspace result = DataAccessUtils.requiredSingleResult(jdbcTemplate.query(sql, params, WORKSPACE_ROW_MAPPER));
logger.info("Retrieved workspace record {}", result);
return Optional.of(result);
} catch (EmptyResultDataAccessException e) {
return Optional.empty();
}
}
Aggregations