@Override public List<UUID> getEntryIds() { return jdbc.query("SELECT " + ENTRY_ID + " FROM " + ENTRY, uuidMapper); }
/** * Finds all the catalog parts with the specified foreign key. * * @param fk the foreign key (meta pk) of the part to find * @return a set of the parts found, possibly empty * @throws DataAccessException on database errors */ protected Set<CatalogObjectPart<String>> findParts(long fk) throws DataAccessException { return new HashSet<CatalogObjectPart<String>>( jdbc.query("SELECT * FROM "+tablePrefix+PARTS_TABLE_NAME+" WHERE "+PART_FK+"=?", partRowMapper, fk) ); }
public List<AggregatingView> getDefinedViews(RelationInfo relationInfo, long foreignKey) { String sql = "SELECT * FROM " + VIEWS_TABLE + " WHERE " + VFIELD_RELATION + " = ?"; List<AggregatingView> views = jdbc.query(sql, VIEW_MAPPER, foreignKey); for (AggregatingView view : views) view.setRelationInfo(relationInfo); return views; }
public String dbUuid() { return _jdbc().query(_lookup("db_uuid"), //$NON-NLS-1$ new RowMapper<String>() { public String mapRow(ResultSet arg0, int arg1) throws SQLException { String s = arg0.getString("value"); //$NON-NLS-1$ return s; } }).get(0); }
public Set<String> currentUserNames() { List<String> names = _jdbc().query(_lookup("current_user_names"), //$NON-NLS-1$ new RowMapper<String>() { public String mapRow(ResultSet arg0, int arg1) throws SQLException { return arg0.getString(1); // Bleck } }); return new HashSet<String>(names); }
private void to107() throws ProblemsException { List<String> tabNames = jdbc.query("SELECT " + JDBCDefinitionsSource.FIELD_NAME + ", " + JDBCDefinitionsSource.FIELD_VERSION + " FROM " + JDBCDefinitionsSource.RELATIONS_TABLE, new ParameterizedRowMapper<String>() { public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(JDBCDefinitionsSource.FIELD_VERSION) + '_' + rs.getString(JDBCDefinitionsSource.FIELD_NAME); } }); for (String tabName : tabNames) { String delPrefix = "del_"; jdbc.getJdbcOperations().execute("ALTER TABLE " + delPrefix + tabName + " ADD COLUMN " + JDBCBrowser.FIELD_ORIGTICK + " BIGINT"); } }
private void to107() throws ProblemsException { List<String> tabNames = jdbc.query("SELECT " + JDBCDefinitionsSource.FIELD_NAME + ", " + JDBCDefinitionsSource.FIELD_VERSION + " FROM " + JDBCDefinitionsSource.RELATIONS_TABLE, new ParameterizedRowMapper<String>() { public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(JDBCDefinitionsSource.FIELD_VERSION) + '_' + rs.getString(JDBCDefinitionsSource.FIELD_NAME); } }); for (String tabName : tabNames) { String delPrefix = "del_"; jdbc.getJdbcOperations().execute("ALTER TABLE " + delPrefix + tabName + " ADD COLUMN " + JDBCBrowser.FIELD_ORIGTICK + " BIGINT"); } }
public List<Long> filterFileIdsByRepo(String uuid, List<Long> fileIds) { final Map<String, Object> arguments = ImmutableMap.of("repo", uuid, "ids", fileIds); try { return _jdbc().query(_lookup("find_files_in_repo"), new IdRowMapper(), arguments); } catch (EmptyResultDataAccessException e) { return Collections.emptyList(); } }
public List<String> getJobNames() { return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES), new ParameterizedRowMapper<String>() { public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); } }); }
public List<Long> findRepoPixels(String uuid, String dirname, String basename){ return _jdbc().query(_lookup("find_repo_pixels"), //$NON-NLS-1$ new RowMapper<Long>() { public Long mapRow(ResultSet arg0, int arg1) throws SQLException { return arg0.getLong(1); } }, uuid, dirname, basename); }
public JobExecution getLastJobExecution(JobInstance jobInstance) { Long id = jobInstance.getId(); List<JobExecution> executions = getJdbcTemplate().query(getQuery(GET_LAST_EXECUTION), new JobExecutionRowMapper(jobInstance), id, id); Assert.state(executions.size() <= 1, "There must be at most one latest job execution"); if (executions.isEmpty()) { return null; } else { return executions.get(0); } }
@Override public void refreshEventLogFromUpdatedAnnotations() { _jdbc().query(_lookup("event_log.refresh"), new RowMapper<Object>() { @Override public Object mapRow(ResultSet arg0, int arg1) { return null; }}); }
public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) { List<StepExecution> executions = getJdbcTemplate().query(getQuery(GET_STEP_EXECUTION), new StepExecutionRowMapper(jobExecution), jobExecution.getId(), stepExecutionId); Assert.state(executions.size() <= 1, "There can be at most one step execution with given name for single job execution"); if (executions.isEmpty()) { return null; } else { return executions.get(0); } }
public List<Long> findRepoFiles(String uuid, String dirname) { try { return _jdbc().query(_lookup("find_repo_files"), new IdRowMapper(), uuid, dirname); } catch (EmptyResultDataAccessException e) { return Collections.emptyList(); } }
public Collection<String> getUserEmailsByGroup(long groupId) { try { return _jdbc().query(_lookup("user_emails_by_group"), //$NON-NLS-1$ new StringRowMapper(), groupId); } catch (EmptyResultDataAccessException e) { return Collections.emptyList(); } }
public List<Long> fileIdsInDb(String uuid, Set<String> mimetypes) { String query = _lookup("file_id_in_db"); //$NON-NLS-1$ Map<String, Object> params = new HashMap<String, Object>(); params.put("repo", uuid); query += addMimetypes(mimetypes, params); return _jdbc().query(query, new IdRowMapper(), params); }
public ExecutionContext getExecutionContext(JobExecution jobExecution) { Long executionId = jobExecution.getId(); Assert.notNull(executionId, "ExecutionId must not be null."); List<ExecutionContext> results = getJdbcTemplate().query(getQuery(FIND_JOB_EXECUTION_CONTEXT), new ExecutionContextRowMapper(), executionId); if (results.size() > 0) { return results.get(0); } else { return new ExecutionContext(); } }
public ExecutionContext getExecutionContext(StepExecution stepExecution) { Long executionId = stepExecution.getId(); Assert.notNull(executionId, "ExecutionId must not be null."); List<ExecutionContext> results = getJdbcTemplate().query(getQuery(FIND_STEP_EXECUTION_CONTEXT), new ExecutionContextRowMapper(), executionId); if (results.size() > 0) { return results.get(0); } else { return new ExecutionContext(); } }
@Override public List<Long> getLdapExperimenters() { return _jdbc().query( _lookup("get_ldap_experimenters"), new IdRowMapper()); //$NON-NLS-1$ }
public List<JobExecution> findJobExecutions(final JobInstance job) { Assert.notNull(job, "Job cannot be null."); Assert.notNull(job.getId(), "Job Id cannot be null."); return getJdbcTemplate().query(getQuery(FIND_JOB_EXECUTIONS), new JobExecutionRowMapper(job), job.getId()); }