當前位置: 首頁>>代碼示例>>Java>>正文


Java JdbcOperations.update方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ligoj,項目名稱:plugin-bt-jira,代碼行數:27,代碼來源:JiraUpdateDao.java

示例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();
}
 
開發者ID:ligoj,項目名稱:plugin-bt-jira,代碼行數:19,代碼來源:JiraUpdateDao.java

示例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());
}
 
開發者ID:ligoj,項目名稱:plugin-bt-jira,代碼行數:27,代碼來源:JiraUpdateDao.java

示例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;
}
 
開發者ID:ligoj,項目名稱:plugin-bt-jira,代碼行數:18,代碼來源:JiraUpdateDao.java

示例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);
	}
}
 
開發者ID:ligoj,項目名稱:plugin-bt-jira,代碼行數:12,代碼來源:JiraUpdateDao.java

示例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;
}
 
開發者ID:ligoj,項目名稱:plugin-bt-jira,代碼行數:15,代碼來源:JiraUpdateDao.java


注:本文中的org.springframework.jdbc.core.JdbcOperations.update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。