当前位置: 首页>>代码示例>>Java>>正文


Java TransactionCallback类代码示例

本文整理汇总了Java中com.atlassian.sal.api.transaction.TransactionCallback的典型用法代码示例。如果您正苦于以下问题:Java TransactionCallback类的具体用法?Java TransactionCallback怎么用?Java TransactionCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransactionCallback类属于com.atlassian.sal.api.transaction包,在下文中一共展示了TransactionCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的com.atlassian.sal.api.transaction.TransactionCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。