• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActiveObjects类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ActiveObjects类属于com.atlassian.activeobjects.external包,在下文中一共展示了ActiveObjects类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@Override
public void upgrade(ModelVersion currentVersion, ActiveObjects activeObjects)
{
    log.debug("upgrade [ " + getModelVersion() + " ]");
    activeObjects.migrate(ProjectMapping.class, IssueMapping.class);
    List<Project> projects = projectManager.getProjectObjects();
    for (Project project : projects)
    {
        String projectKey = project.getKey();
        log.debug(" === migrating repositories for project [{}] === ", projectKey);

        List<String> repositoriesUrls = getRepositories(projectKey);
        for (String repositoryUrl : repositoriesUrls)
        {
            log.debug("migrating repository [{}]", repositoryUrl);
            ProjectMapping pm = migrateRepository(activeObjects, projectKey, repositoryUrl);
            migrateIssueMappings(activeObjects, projectKey, repositoryUrl, pm);
        }
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:21,代码来源:To_06_GithubRepositories.java


示例2: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@Override
public void upgrade(ModelVersion currentVersion, ActiveObjects activeObjects)
{
    log.info("upgrade [ " + getModelVersion() + " ]: started");

    try
    {
        activeObjects.migrate(OrganizationMapping.class, RepositoryMapping.class, ChangesetMapping.class,
                IssueToChangesetMapping.class, RepositoryToChangesetMapping.class, BranchHeadMapping.class);
    
        for (ChangesetMapping changesetMapping : getChangesetsFromFuture(activeObjects))
        {
            setChangesetDate(activeObjects, DATE_IN_THE_PAST, changesetMapping);
        }

        log.info("upgrade [ " + getModelVersion() + " ]: finished");
    } catch(RuntimeException e)
    {
        log.warn("Cleaning of future dates did not finished correctly. This will not affect the behavior, only the changesets from the future will be still there. To fix them run full synchronization.", e);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:To_13_RemoveFutureChangesets.java


示例3: setChangesetDate

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的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


示例4: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
   public void upgrade(ModelVersion currentVersion, ActiveObjects activeObjects)
   {
       log.debug("upgrade [ " + getModelVersion() + " ]");
       
       activeObjects.migrate(ProjectMapping.class, IssueMapping.class, OrganizationMapping.class, RepositoryMapping.class, ChangesetMapping.class);
       
       // BBC-236 this upgrade used to fail midway leaving some inconsistent data in new tables. 
       // We are starting migration again and need to delete those data.
       deleteAllExistingTableContent(activeObjects, ChangesetMapping.class);
       deleteAllExistingTableContent(activeObjects, OrganizationMapping.class);
       deleteAllExistingTableContent(activeObjects, RepositoryMapping.class);
       
       // old repositoryId to new repositoryId
       Map<Integer,Integer> old2New = Maps.newHashMap();
       
       migrateOrganisationsAndRepositories(activeObjects, old2New);
       migrateChangesets(activeObjects,old2New);
   }
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:21,代码来源:To_08_ActiveObjectsV3Migrator.java


示例5: migrateOrganisationsAndRepositories

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
private void migrateOrganisationsAndRepositories(ActiveObjects activeObjects, Map<Integer, Integer> old2New)
{
    ProjectMapping[] ProjectMappings = activeObjects.find(ProjectMapping.class);
    for (ProjectMapping projectMapping : ProjectMappings)
    {
        try 
        {
            // add organisation
            Map<String, Object> organisationData = createOrganisationMap(projectMapping);
            OrganizationMapping organisationMapping = insertOrganisation(organisationData, activeObjects);
            
            // add repository 
            Map<String,Object> repositoryData = createRepositoryMap(organisationMapping.getID(), projectMapping);
            RepositoryMapping repositoryMapping = insertRepository(repositoryData, activeObjects);
            
            // remember new repository ID
            old2New.put(projectMapping.getID(), repositoryMapping.getID());
        } catch (Exception e)
        {
            log.error("Error during DVCS data migration: "+ e.getMessage(), e);
        }
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:To_08_ActiveObjectsV3Migrator.java


示例6: getProjectJamTimestamp

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
public static Long getProjectJamTimestamp(Project project) {
  AOWrapper aoWrapper = ComponentAccessor.getOSGiComponentInstanceOfType(AOWrapper.class);
  ActiveObjects activeObjects = aoWrapper.getActiveObjects();

  JamPluginTimestamp[] mappings = activeObjects.find(JamPluginTimestamp.class, "PROJECT_ID = ?", project.getId());
  if ( mappings.length > 0) {
    return mappings[0].getJamTimestamp();
  }

  Long now = System.currentTimeMillis();
  activeObjects.create(
      JamPluginTimestamp.class,
      new DBParam("JAM_TIMESTAMP", now),
      new DBParam("PROJECT_ID", project.getId())
  );

  return now;
}
 
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:19,代码来源:JamClient.java


示例7: getByRepository

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
public static DisapprovalConfiguration getByRepository(final ActiveObjects ao, final Repository repo)
    throws SQLException {
    DisapprovalConfiguration[] configs =
        ao.find(DisapprovalConfiguration.class, Query.select().where("REPO_ID = ?", repo.getId()));
    if (configs.length == 0) {
        DisapprovalConfiguration dpc =
            ao.create(DisapprovalConfiguration.class, new DBParam("REPO_ID", repo.getId()));
        dpc.save();
        configs = ao.find(DisapprovalConfiguration.class, Query.select().where("REPO_ID = ?", repo.getId()));
        if (configs.length == 0) {
            throw new IllegalStateException("Failed to create a DisapprovalConfiguration for unknown reason");
        }
        return configs[0];
    }
    return configs[0];
}
 
开发者ID:palantir,项目名称:stash-disapproval-plugin,代码行数:17,代码来源:DisapprovalConfigurationImpl.java


示例8: setPullRequestDisapproval

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
public static void setPullRequestDisapproval(ActiveObjects ao, PullRequest pr, String username,
    boolean isDisapproved) throws SQLException {
    Repository repo = pr.getToRef().getRepository();
    PullRequestDisapproval[] disapprovals =
        ao.find(PullRequestDisapproval.class,
            Query.select().where("REPO_ID = ? and PR_ID = ?", repo.getId(), pr.getId()));
    if (disapprovals.length == 0) {
        PullRequestDisapproval prd =
            ao.create(PullRequestDisapproval.class, new DBParam("REPO_ID", repo.getId()),
                new DBParam("PR_ID", pr.getId()), new DBParam("USERNAME", username));
        prd.setDisapproved(isDisapproved);
        prd.save();
        return;
    }
    disapprovals[0].setDisapprovedBy(username);
    disapprovals[0].setDisapproved(isDisapproved);
    disapprovals[0].save();
}
 
开发者ID:palantir,项目名称:stash-disapproval-plugin,代码行数:19,代码来源:PullRequestDisapprovalImpl.java


示例9: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void upgrade(ModelVersion currentVersion, ActiveObjects ao) {
    if (!currentVersion.isSame(ModelVersion.valueOf("1"))) {
        throw new IllegalStateException("ConfigurationV2UpgradeTask can only upgrade from version 1");
    }
    // Migrate the old table to base the info off it.
    ao.migrate(RepositoryConfiguration.class);
    // Migrate the new table so we can populate it
    ao.migrate(JobTypeStatusMapping.class);

    for (RepositoryConfiguration rc : ao.find(RepositoryConfiguration.class)) {
        for (JobType jt : ImmutableList.of(JobType.PUBLISH, JobType.VERIFY_COMMIT, JobType.VERIFY_PR)) {
            ao.create(JobTypeStatusMapping.class,
                new DBParam("REPO_CONFIG_ID", rc.getID()),
                new DBParam("IS_ENABLED", true),
                new DBParam("JOB_TYPE_RAW", jt.name()));
        }
    }
}
 
开发者ID:palantir,项目名称:stashbot,代码行数:21,代码来源:ConfigurationV2UpgradeTask.java


示例10: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void upgrade(ModelVersion currentVersion, ActiveObjects activeObjects)
{
    logger.debug("upgrade [ " + currentVersion + " ]");
    
    activeObjects.migrate(ProjectMapping.class, IssueMapping.class);
    
    ProjectMapping[] projectMappings = activeObjects.find(ProjectMapping.class);
    for (ProjectMapping projectMapping : projectMappings)
    {
        projectMapping.setRepositoryType("bitbucket");
        projectMapping.save();
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:16,代码来源:To_05_RepositoryTypeMigrator.java


示例11: migrateIssueMappings

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
private void migrateIssueMappings(ActiveObjects activeObjects, String projectKey, String repositoryUrl, ProjectMapping pm)
{
    ArrayList<String> issueIds = (ArrayList<String>)pluginSettingsFactory.createSettingsForKey(projectKey).get("githubIssueIDs" + repositoryUrl);
    if (issueIds != null)
    {
        for (String issueId : issueIds)
        {
            ArrayList<String> commitArray = (ArrayList<String>) pluginSettingsFactory.createSettingsForKey(projectKey).get(
                "githubIssueCommitArray" + issueId);
            if (commitArray != null)
            {
                for (String commit : commitArray)
                {
                    String node = extractNode(commit);
                    log.debug("migrating commit mapping node:[{}], issueId:[{}]", node, issueId);

                    final Map<String, Object> map = Maps.newHashMap();
                    map.put("REPOSITORY_ID", pm.getID());
                    map.put("NODE", node);
                    map.put("ISSUE_ID", issueId);
                    activeObjects.create(IssueMapping.class, map);
                }
            }

        }
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:28,代码来源:To_06_GithubRepositories.java


示例12: migrateRepository

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
private ProjectMapping migrateRepository(ActiveObjects activeObjects, String projectKey, String repositoryUrl)
{
    String fixedUrl = fixUrl(repositoryUrl);
    String access_token = (String) pluginSettingsFactory.createSettingsForKey(projectKey).get("githubRepositoryAccessToken" + repositoryUrl);

    final Map<String, Object> map = Maps.newHashMap();
    map.put("REPOSITORY_URL", fixedUrl);
    map.put("PROJECT_KEY", projectKey);
    map.put("REPOSITORY_TYPE", "github");
    map.put("ACCESS_TOKEN", access_token);
    return activeObjects.create(ProjectMapping.class, map);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:13,代码来源:To_06_GithubRepositories.java


示例13: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
   public void upgrade(ModelVersion currentVersion, ActiveObjects activeObjects)
   {
       log.debug("upgrade [ " + getModelVersion() + " ]");

       activeObjects.migrate(OrganizationMapping.class, RepositoryMapping.class, ChangesetMapping.class);

       populateLastChangesetNodeColumn(activeObjects);
   }
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:11,代码来源:To_10_LastChangesetNodeMigrator.java


示例14: populateLastChangesetNodeColumn

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
private void populateLastChangesetNodeColumn(ActiveObjects activeObjects)
{
    for (RepositoryMapping repository : activeObjects.find(RepositoryMapping.class))
    {
        Date repositoryLastCommitDate = repository.getLastCommitDate();

        if (repositoryLastCommitDate != null) // when the repo is empty
        {
ChangesetMapping[] lastChangesetOrEmptyArray = activeObjects.find(ChangesetMapping.class,
                    Query.select().where(ChangesetMapping.REPOSITORY_ID + " = ?", repository.getID())
                                  .order(ChangesetMapping.DATE + " DESC")
                                  .limit(1));

            // should never happen as empty repo should not have set LAST_COMMIT_DATE
            if (lastChangesetOrEmptyArray.length != 0)
            {
                repository.setLastChangesetNode(lastChangesetOrEmptyArray[0].getRawNode());
                repository.save();
            }
            else
            {
                log.error("Repository '{}' within organization id '{}' has set LAST_COMMIT_DATE, but there are 0 "
                        + "changesets associated with this repository !",
                        repository.getName(), repository.getOrganizationId());
            }
        }
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:29,代码来源:To_10_LastChangesetNodeMigrator.java


示例15: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
/**
    * BBC-479 Add key/secret to the organization
    * @param currentVersion
    * @param activeObjects
    */
@Override
   public void upgrade(ModelVersion currentVersion, final ActiveObjects activeObjects)
   {
    log.info("AO Upgrade task  [ " + getModelVersion() + " ] Adding OAuth key/secret to each bitbucket organization.");

    // start with migrating OAuthData to new place in plugin settings
    new To_11_UpgradeOAuthDetails(settings).doMigrate();

    // now add key and secret to database for bitbucket accounts
       addKeyAndSecretToBBAccounts(activeObjects);
   }
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:To_11_AddKeyAndSecretToBBAccounts.java


示例16: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@Override
public void upgrade(final ModelVersion currentVersion, final ActiveObjects activeObjects)
{
    log.info("upgrade [ " + getModelVersion() + " ]");
    activeObjects.migrate(RepositoryMapping.class);
    RepositoryMapping[] repositoryMappings = activeObjects.find(RepositoryMapping.class);
    for (RepositoryMapping repositoryMapping : repositoryMappings)
    {
        initialiseSyncAuthorisation(activeObjects, repositoryMapping);
    }
    log.info("upgrade [ " + getModelVersion() + " ]: finished");
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:13,代码来源:To_15_LinkUpdateAuthorisedInitialise.java


示例17: upgrade

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void upgrade(ModelVersion currentVersion, ActiveObjects activeObjects)
{
    log.debug("upgrade [ " + getModelVersion() + " ]");

    activeObjects.migrate(OrganizationMapping.class, RepositoryMapping.class, ChangesetMapping.class);

}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:10,代码来源:To_09_SmartCommitsColumnsMigrator.java


示例18: findUniqueChangesetAfterRestart

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
/**
 * It is responsible to find unique changeset after restart. It means to find changeset, which was already proceed for current node.
 * 
 * @param activeObjects
 * @param currentNode
 * @return founded unique changeset
 */
private ChangesetResult findUniqueChangesetAfterRestart(final ActiveObjects activeObjects, String currentNode)
{
    ChangesetMapping[] founded = activeObjects.find(
            ChangesetMapping.class,
            Query.select().where(
                    ChangesetMapping.ISSUE_KEY + " is null AND ( " + ChangesetMapping.RAW_NODE + " = ? OR " + ChangesetMapping.NODE
                            + " = ? )", currentNode, currentNode));

    if (founded.length == 1)
    {
        ChangesetMapping result = founded[0];
        return new ChangesetResult( //
                result.getID(), //
                result.getRawNode(), //
                result.getNode(), //
                result.getRepositoryId(), //
                result.getProjectKey(), //
                result.getIssueKey() //
        );

    } else if (founded.length == 0)
    {
        return null;

    } else
    {
        throw new RuntimeException("It should never happened - there are multiple proceed changesets with the same raw node: "
                + currentNode);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:38,代码来源:To_12_SplitUpChangesetsMigrator.java


示例19: getChangesetsFromFuture

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
private Iterable<ChangesetMapping> getChangesetsFromFuture(final ActiveObjects activeObjects)
{
    return new Iterable<ChangesetMapping>()
    {
        @Override
        public Iterator<ChangesetMapping> iterator()
        {
            return new ChangesetsFromFutureIterator(activeObjects);
        }
    };
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:12,代码来源:To_13_RemoveFutureChangesets.java


示例20: insertOrganisation

import com.atlassian.activeobjects.external.ActiveObjects; //导入依赖的package包/类
private OrganizationMapping insertOrganisation(Map<String, Object> organisationMap, ActiveObjects activeObjects)
{
    String hostUrl = (String) organisationMap.get(OrganizationMapping.HOST_URL);
    String name = (String) organisationMap.get(OrganizationMapping.NAME);
    
    OrganizationMapping[] existing = activeObjects.find(OrganizationMapping.class, 
        OrganizationMapping.HOST_URL+" = ? and " + OrganizationMapping.NAME + " = ?", hostUrl, name);
    
    if (existing.length>0)
    {
        return existing[0];
    }
    log.debug("Adding new organisation: " + organisationMap);
    return activeObjects.create(OrganizationMapping.class, organisationMap);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:16,代码来源:To_08_ActiveObjectsV3Migrator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RMAppAttemptEventType类代码示例发布时间:2022-05-22
下一篇:
Java RpcClientFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap