本文整理汇总了Java中com.atlassian.sal.api.transaction.TransactionCallback类的典型用法代码示例。如果您正苦于以下问题:Java TransactionCallback类的具体用法?Java TransactionCallback怎么用?Java TransactionCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionCallback类属于com.atlassian.sal.api.transaction包,在下文中一共展示了TransactionCallback类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getHubJiraTicketErrors
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
@Path("/hubJiraTicketErrors")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getHubJiraTicketErrors(@Context final HttpServletRequest request) {
final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
final Response response = checkUserPermissions(request, settings);
if (response != null) {
return response;
}
final Object obj = transactionTemplate.execute(new TransactionCallback() {
@Override
public Object doInTransaction() {
final TicketCreationErrorSerializable creationError = new TicketCreationErrorSerializable();
final List<TicketCreationError> ticketErrors = JiraSettingsService.expireOldErrors(settings);
if (ticketErrors != null) {
Collections.sort(ticketErrors);
creationError.setHubJiraTicketErrors(ticketErrors);
logger.debug("Errors to UI : " + creationError.getHubJiraTicketErrors().size());
}
return creationError;
}
});
return Response.ok(obj).build();
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:27,代码来源:HubJiraConfigController.java
示例2: setChangesetDate
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
private void setChangesetDate(ActiveObjects activeObjects, Date dateInThePast, final ChangesetMapping changesetMapping)
{
activeObjects.executeInTransaction(new TransactionCallback<ChangesetMapping>()
{
@Override
public ChangesetMapping doInTransaction()
{
log.warn("Changeset [{}] has date set in the future [{}]. Setting date to [{}].", new Object[] {
changesetMapping.getNode(), changesetMapping.getDate(), DATE_IN_THE_PAST });
changesetMapping.setDate(DATE_IN_THE_PAST);
changesetMapping.setSmartcommitAvailable(false); // ignore smart commits
changesetMapping.save();
return changesetMapping;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:To_13_RemoveFutureChangesets.java
示例3: create
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public GitHubEventMapping create(final Map<String, Object> gitHubEvent)
{
GitHubEventMapping createdMapping = activeObjects.executeInTransaction(new TransactionCallback<GitHubEventMapping>()
{
@Override
public GitHubEventMapping doInTransaction()
{
return activeObjects.create(GitHubEventMapping.class, gitHubEvent);
}
});
final int repositoryId = createdMapping.getRepository().getID();
final String gitHubId = createdMapping.getGitHubId();
GitHubEventMapping[] retrievedMappings = findAllById(repositoryId, gitHubId);
if (retrievedMappings.length > 1)
{
String stack = ExceptionUtils.getStackTrace(new Throwable());
final String warningMessage = "Just created a GitHubEventMapping for repository {} and gitHubId {} and there now more than one in the database. This is the calling stack:\n";
log.warn(warningMessage, new Object[] { repositoryId, gitHubId, stack });
}
return createdMapping;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:29,代码来源:GitHubEventDAOImpl.java
示例4: markAsSavePoint
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void markAsSavePoint(final GitHubEventMapping gitHubEvent)
{
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
gitHubEvent.setSavePoint(true);
gitHubEvent.save();
return null;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GitHubEventDAOImpl.java
示例5: associateNewKey
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
private void associateNewKey(final String key, final int repositoryId)
{
activeObjects.executeInTransaction(new TransactionCallback<RepositoryToProjectMapping>()
{
@Override
public RepositoryToProjectMapping doInTransaction()
{
final Map<String, Object> map = new MapRemovingNullCharacterFromStringValues();
map.put(RepositoryToProjectMapping.PROJECT_KEY, key);
map.put(RepositoryToProjectMapping.REPOSITORY_ID, repositoryId);
RepositoryToProjectMapping mapping = activeObjects.create(RepositoryToProjectMapping.class, map);
mapping.save();
return mapping;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:RepositoryDaoImpl.java
示例6: get
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
@Override
public Repository get(final int repositoryId)
{
RepositoryMapping repositoryMapping = activeObjects.executeInTransaction(new TransactionCallback<RepositoryMapping>()
{
@Override
public RepositoryMapping doInTransaction()
{
return activeObjects.get(RepositoryMapping.class, repositoryId);
}
});
if (repositoryMapping == null)
{
log.warn("Repository with id {} was not found.", repositoryId);
return null;
}
else
{
return transform(repositoryMapping);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:23,代码来源:RepositoryDaoImpl.java
示例7: doTxQuietly
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
private <RET> RET doTxQuietly(final Callable<RET> callable) {
return
ao.executeInTransaction(new TransactionCallback<RET>()
{
@Override
public RET doInTransaction()
{
try
{
return callable.call();
} catch (Throwable e)
{
log.warn("Problem during sync audit log. " + e.getMessage());
if (log.isDebugEnabled())
{
log.debug("Sync audit log.", e);
}
return null;
}
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:23,代码来源:SyncAuditLogDaoImpl.java
示例8: save
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void save(final MessageQueueItemMapping messageQueueItem)
{
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
messageQueueItem.save();
return null;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:19,代码来源:MessageQueueItemDaoImpl.java
示例9: delete
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void delete(final MessageQueueItemMapping messageQueueItem)
{
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
activeObjects.delete(messageQueueItem);
return null;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:19,代码来源:MessageQueueItemDaoImpl.java
示例10: update
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public Changeset update(final Changeset changeset)
{
activeObjects.executeInTransaction(new TransactionCallback<ChangesetMapping>()
{
@Override
public ChangesetMapping doInTransaction()
{
ChangesetMapping chm = getChangesetMapping(changeset);
if (chm != null)
{
fillProperties(changeset, chm);
chm.save();
}
else
{
log.warn("Changest with node {} is not exists.", changeset.getNode());
}
return chm;
}
});
return changeset;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:ChangesetDaoImpl.java
示例11: migrateFilesData
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public Changeset migrateFilesData(final Changeset changeset, final String dvcsType)
{
activeObjects.executeInTransaction(new TransactionCallback<ChangesetMapping>()
{
@Override
public ChangesetMapping doInTransaction()
{
ChangesetMapping chm = getChangesetMapping(changeset);
if (chm != null)
{
transformer.migrateChangesetFileData(chm, dvcsType, changeset);
}
else
{
log.warn("Changest with node {} is not exists.", changeset.getNode());
}
return chm;
}
});
return changeset;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:ChangesetDaoImpl.java
示例12: getByNode
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public Changeset getByNode(final int repositoryId, final String changesetNode)
{
final ChangesetMapping changesetMapping = activeObjects.executeInTransaction(new TransactionCallback<ChangesetMapping>()
{
@Override
public ChangesetMapping doInTransaction()
{
Query query = Query.select()
.from(ChangesetMapping.class)
.alias(ChangesetMapping.class, "chm")
.alias(RepositoryToChangesetMapping.class, "rtchm")
.join(RepositoryToChangesetMapping.class, "chm.ID = rtchm." + RepositoryToChangesetMapping.CHANGESET_ID)
.where("chm." + ChangesetMapping.NODE + " = ? AND rtchm." + RepositoryToChangesetMapping.REPOSITORY_ID + " = ? ", changesetNode, repositoryId);
ChangesetMapping[] mappings = activeObjects.find(ChangesetMapping.class, query);
return mappings.length != 0 ? mappings[0] : null;
}
});
final Changeset changeset = transform(changesetMapping, repositoryId);
return changeset;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:25,代码来源:ChangesetDaoImpl.java
示例13: getByRepository
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public List<Changeset> getByRepository(final int repositoryId)
{
final List<ChangesetMapping> changesetMappings = activeObjects.executeInTransaction(new TransactionCallback<List<ChangesetMapping>>()
{
@Override
public List<ChangesetMapping> doInTransaction()
{
ChangesetMapping[] mappings = activeObjects.find(ChangesetMapping.class,
Query.select()
.alias(ChangesetMapping.class, "CHANGESET")
.alias(RepositoryToChangesetMapping.class, "REPO")
.join(RepositoryToChangesetMapping.class, "CHANGESET.ID = REPO." + RepositoryToChangesetMapping.CHANGESET_ID)
.where("REPO.ID = ?", repositoryId));
return Arrays.asList(mappings);
}
});
return transform(changesetMappings);
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:21,代码来源:ChangesetDaoImpl.java
示例14: getChangesetMappingsByIssueKey
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
private List<ChangesetMapping> getChangesetMappingsByIssueKey(Iterable<String> issueKeys, final boolean newestFirst)
{
final GlobalFilter gf = new GlobalFilter();
gf.setInIssues(issueKeys);
final SqlAndParams baseWhereClause = new GlobalFilterQueryWhereClauseBuilder(gf).build();
final List<ChangesetMapping> changesetMappings = activeObjects.executeInTransaction(new TransactionCallback<List<ChangesetMapping>>()
{
@Override
public List<ChangesetMapping> doInTransaction()
{
ChangesetMapping[] mappings = activeObjects.find(ChangesetMapping.class,
Query.select()
.alias(ChangesetMapping.class, "CHANGESET")
.alias(IssueToChangesetMapping.class, "ISSUE")
.join(IssueToChangesetMapping.class, "CHANGESET.ID = ISSUE." + IssueToChangesetMapping.CHANGESET_ID)
.where(baseWhereClause.getSql(), baseWhereClause.getParams())
.order(ChangesetMapping.DATE + (newestFirst ? " DESC" : " ASC"))
.limit(MAXIMUM_ENTITIES_PER_ISSUE_KEY));
return Arrays.asList(mappings);
}
});
return changesetMappings;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:26,代码来源:ChangesetDaoImpl.java
示例15: getLatestChangesets
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public List<Changeset> getLatestChangesets(final int maxResults, final GlobalFilter gf)
{
if (maxResults <= 0)
{
return Collections.emptyList();
}
final List<ChangesetMapping> changesetMappings = activeObjects.executeInTransaction(new TransactionCallback<List<ChangesetMapping>>()
{
@Override
public List<ChangesetMapping> doInTransaction()
{
SqlAndParams baseWhereClause = new GlobalFilterQueryWhereClauseBuilder(gf).build();
Query query = Query.select()
.alias(ChangesetMapping.class, "CHANGESET")
.alias(IssueToChangesetMapping.class, "ISSUE")
.join(IssueToChangesetMapping.class, "CHANGESET.ID = ISSUE." + IssueToChangesetMapping.CHANGESET_ID)
.where(baseWhereClause.getSql(), baseWhereClause.getParams()).limit(maxResults).order(ChangesetMapping.DATE + " DESC");
ChangesetMapping[] mappings = activeObjects.find(ChangesetMapping.class, query);
return Arrays.asList(mappings);
}
});
return transform(changesetMappings);
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:25,代码来源:ChangesetDaoImpl.java
示例16: createBranch
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public void createBranch(final int repositoryId, final Branch branch, final Set<String> issueKeys)
{
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
log.debug("adding branch {} for repository with id = [ {} ]", new Object[] { branch, repositoryId });
final Map<String, Object> map = new MapRemovingNullCharacterFromStringValues();
map.put(BranchMapping.REPOSITORY_ID, repositoryId);
map.put(BranchMapping.NAME, ActiveObjectsUtils.stripToLimit(branch.getName(), 255));
BranchMapping branchMapping = activeObjects.create(BranchMapping.class, map);
associateBranchToIssue(branchMapping, issueKeys);
return null;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:19,代码来源:BranchDaoImpl.java
示例17: createBranchHead
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public void createBranchHead(final int repositoryId, final BranchHead branchHead)
{
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
log.debug("adding branch head {} for repository with id = [ {} ]", new Object[] { branchHead, repositoryId });
final Map<String, Object> map = new MapRemovingNullCharacterFromStringValues();
map.put(BranchHeadMapping.REPOSITORY_ID, repositoryId);
map.put(BranchHeadMapping.BRANCH_NAME, ActiveObjectsUtils.stripToLimit(branchHead.getName(), 255));
map.put(BranchHeadMapping.HEAD, branchHead.getHead());
activeObjects.create(BranchHeadMapping.class, map);
return null;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:19,代码来源:BranchDaoImpl.java
示例18: removeBranchHead
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
public void removeBranchHead(final int repositoryId, final BranchHead branch)
{
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
log.debug("deleting branch head {} for repository with id = [ {} ]", new Object[] { branch, repositoryId });
Query query = Query.select().where(BranchHeadMapping.REPOSITORY_ID + " = ? AND "
+ BranchHeadMapping.BRANCH_NAME + " = ? AND "
+ BranchHeadMapping.HEAD + " = ?", repositoryId, branch.getName(), branch.getHead());
ActiveObjectsUtils.delete(activeObjects, BranchHeadMapping.class, query);
return null;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:BranchDaoImpl.java
示例19: updatePullRequestInfo
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
@Override
public RepositoryPullRequestMapping updatePullRequestInfo(int localId, RepositoryPullRequestMapping pullRequestMapping)
{
final RepositoryPullRequestMapping request = findRequestById(localId);
request.setName(ActiveObjectsUtils.stripToLimit(pullRequestMapping.getName(), 255));
request.setSourceBranch(pullRequestMapping.getSourceBranch());
request.setDestinationBranch(pullRequestMapping.getDestinationBranch());
request.setLastStatus(pullRequestMapping.getLastStatus());
request.setSourceRepo(pullRequestMapping.getSourceRepo());
request.setUpdatedOn(pullRequestMapping.getUpdatedOn());
request.setCommentCount(pullRequestMapping.getCommentCount());
request.setExecutedBy(pullRequestMapping.getExecutedBy());
activeObjects.executeInTransaction(new TransactionCallback<Void>()
{
@Override
public Void doInTransaction()
{
request.save();
return null;
}
});
return request;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:26,代码来源:RepositoryPullRequestDaoImpl.java
示例20: fetch
import com.atlassian.sal.api.transaction.TransactionCallback; //导入依赖的package包/类
@Override
public List<Organization> fetch()
{
final List<OrganizationMapping> organizationMappings = activeObjects
.executeInTransaction(new TransactionCallback<List<OrganizationMapping>>()
{
@Override
public List<OrganizationMapping> doInTransaction()
{
return Lists.newArrayList(activeObjects.find(OrganizationMapping.class, Query.select().order(OrganizationMapping.NAME)));
}
});
return transformCollection(organizationMappings);
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:OrganizationAOFacadeImpl.java
注:本文中的com.atlassian.sal.api.transaction.TransactionCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论