本文整理汇总了Java中org.springframework.jdbc.core.JdbcOperations.update方法的典型用法代码示例。如果您正苦于以下问题:Java JdbcOperations.update方法的具体用法?Java JdbcOperations.update怎么用?Java JdbcOperations.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jdbc.core.JdbcOperations
的用法示例。
在下文中一共展示了JdbcOperations.update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addVersions
import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
* Add the given versions to the given project
*
* @param dataSource
* The data source of JIRA database.
* @param jira
* the JIRA project identifier.
* @param versions
* the version names to add
* @return the {@link Map} where value is the created version identifier.
*/
public Map<String, Integer> addVersions(final DataSource dataSource, final int jira,
final Collection<String> versions) {
final Map<String, Integer> result = new HashMap<>();
final JdbcOperations jdbcTemplate = new JdbcTemplate(dataSource);
int nextId = prepareForNextId(dataSource, VERSION_NODE, versions.size());
int nextSequence = getNextVersionSequence(jira, jdbcTemplate);
for (final String version : versions) {
jdbcTemplate.update("INSERT INTO projectversion (ID,PROJECT,vname,SEQUENCE) values(?,?,?,?)", nextId, jira,
version, nextSequence);
result.put(version, nextId);
nextId++;
nextSequence++;
}
return result;
}
示例2: getCurrentSequence
import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
* Return current sequence.
*/
protected int getCurrentSequence(final String sequenceName, final JdbcOperations jdbcTemplate) {
final Long currentSequence;
final List<Long> sequence = jdbcTemplate
.queryForList("SELECT SEQ_ID FROM SEQUENCE_VALUE_ITEM WHERE SEQ_NAME = ?", Long.class, sequenceName);
if (sequence.isEmpty()) {
// New sequence, start from an arbitrary sequence to be sure JIRA
// does not fill it
currentSequence = 10000L;
jdbcTemplate.update("INSERT INTO SEQUENCE_VALUE_ITEM (SEQ_NAME,SEQ_ID) values(?,?)", sequenceName,
currentSequence);
} else {
currentSequence = sequence.get(0);
}
return currentSequence.intValue();
}
示例3: addIssue
import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
* Add an issue, workflow entry, corresponding step of current status and link author to this issue (user activity
* dashboard)
*/
private void addIssue(final int jira, final JdbcOperations jdbcTemplate, final int nextId, final int nextCurrentStepId, final int nextWfEntryId,
final JiraIssueRow issueRow, final Workflow workflow) {
final INamableBean<Integer> workflowStep = workflow.getStatusToSteps().get(issueRow.getStatusText());
// Insert workflow activity
jdbcTemplate.update("INSERT INTO OS_WFENTRY (ID,NAME,STATE) values(?,?,?)", nextWfEntryId, workflow.getName(), 1);
jdbcTemplate.update("INSERT INTO OS_CURRENTSTEP (ID,ENTRY_ID,STEP_ID,ACTION_ID,START_DATE,STATUS) values(?,?,?,?,?,?)", nextCurrentStepId,
nextWfEntryId, workflowStep.getId(), 0, issueRow.getCreated(), workflowStep.getName());
// Insert issue
jdbcTemplate.update(
"INSERT INTO jiraissue"
+ " (ID,issuenum,WATCHES,VOTES,PROJECT,REPORTER,ASSIGNEE,CREATOR,issuetype,SUMMARY,DESCRIPTION,PRIORITY,RESOLUTION,RESOLUTIONDATE,"
+ "issuestatus,CREATED,UPDATED,WORKFLOW_ID,DUEDATE) values(?,?,1,0,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
nextId, issueRow.getIssueNum(), jira, issueRow.getReporter(), issueRow.getAssignee(), issueRow.getAuthor(), issueRow.getType(),
issueRow.getSummary(), issueRow.getDescription(), issueRow.getPriority(), issueRow.getResolution(), issueRow.getResolutionDate(),
issueRow.getStatus(), issueRow.getCreated(), issueRow.getUpdated(), nextWfEntryId, issueRow.getDueDate());
// Add user relation
jdbcTemplate.update("INSERT INTO userassociation (SOURCE_NAME,SINK_NODE_ID,SINK_NODE_ENTITY,ASSOCIATION_TYPE,CREATED) values(?,?,?,?,?)",
issueRow.getAuthor(), nextId, "Issue", "WatchIssue", issueRow.getUpdated());
}
示例4: addLabels
import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
* Add labels to given issue.
*/
private int addLabels(final JdbcOperations jdbcTemplate, final int nextId, final JiraIssueRow issue) {
int nextIdl = nextId;
// Remove previous labels
jdbcTemplate.update(
"DELETE FROM label WHERE ISSUE = ? AND LABEL NOT IN (" + jiraDao.newIn(issue.getLabels()) + ")",
ArrayUtils.addAll(new Object[] { issue.getId() }, issue.getLabels().toArray()));
// Add missing labels
for (final String label : issue.getLabels()) {
jdbcTemplate.update("INSERT INTO label(ID,ISSUE,LABEL) values(?,?,?)", nextIdl, issue.getId(), label);
nextIdl++;
}
return nextIdl;
}
示例5: associatedItems
import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
* Associate an issue to a set of items;
*/
private void associatedItems(final JdbcOperations jdbcTemplate, final int issueId, final Collection<Integer> items,
final String nodetype, final String associationType) {
for (final Integer item : items) {
jdbcTemplate
.update("INSERT INTO nodeassociation (SOURCE_NODE_ID,SOURCE_NODE_ENTITY,SINK_NODE_ID,SINK_NODE_ENTITY,ASSOCIATION_TYPE)"
+ " values(?,?,?,?,?)", issueId, ISSUE_NODE, item, nodetype, associationType);
}
}
示例6: associateCustomFieldValue
import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
* Associate a single custom field values to a given issue.
*/
private int associateCustomFieldValue(final JdbcOperations jdbcTemplate, final int issueId, final int nextId,
final int cfId, final String column, final Iterable<Object> values) {
int nextIdl = nextId;
// Persist single/multiple values
for (final Object value : values) {
jdbcTemplate.update("INSERT INTO customfieldvalue (ID,ISSUE,CUSTOMFIELD," + column + ") values(?,?,?,?)",
nextIdl, issueId, cfId, value);
nextIdl++;
}
return nextIdl;
}