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

Java Query类代码示例

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

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



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

示例1: init

import net.java.ao.Query; //导入依赖的package包/类
/**
 * @return should migration continue? is there something for processing?
 * @throws SQLException
 */
private boolean init() throws SQLException
{
    Query query = Query.select().where(ChangesetMapping.ISSUE_KEY + " is not null ");
    query.setLimit(1);
    ChangesetMapping[] founded = activeObjects.find(ChangesetMapping.class, query);

    if (founded.length != 1)
    {
        return false;
    }

    this.entityManager = founded[0].getEntityManager();
    this.tableNameConverter = entityManager.getTableNameConverter();
    this.databaseProvider = entityManager.getProvider();
    this.connection = databaseProvider.getConnection();
    this.connection.setAutoCommit(false);
    this.quote = connection.getMetaData().getIdentifierQuoteString();

    return true;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:25,代码来源:To_12_SplitUpChangesetsMigrator.java


示例2: readCurrentPage

import net.java.ao.Query; //导入依赖的package包/类
private void readCurrentPage()
{
    if (!currentPage.isEmpty())
    {
        return;
    }
    // select 20 newest changesets
    Query query = Query.select().order(ChangesetMapping.DATE + " desc");
    query.limit(20);
    ChangesetMapping[] latestChangesets = activeObjects.find(ChangesetMapping.class, query);
    // filter in those from the future
    for (ChangesetMapping changesetMapping : latestChangesets)
    {
        if (changesetMapping.getDate() != null && changesetMapping.getDate().after(TOMORROW_DATE))
        {
            currentPage.add(changesetMapping);
        }
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:To_13_RemoveFutureChangesets.java


示例3: getAll

import net.java.ao.Query; //导入依赖的package包/类
@Override
public List<Repository> getAll(final boolean includeDeleted)
{
    Query select = Query.select();
    if (!includeDeleted)
    {
        select = select.where(RepositoryMapping.DELETED + " = ? ", Boolean.FALSE);
    }
    select.order(RepositoryMapping.NAME);

    final RepositoryMapping[] repos = activeObjects.find(RepositoryMapping.class, select);

    final Collection<Repository> repositories = transformRepositories(Arrays.asList(repos));

    return new ArrayList<Repository>(repositories);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:RepositoryDaoImpl.java


示例4: getAllByType

import net.java.ao.Query; //导入依赖的package包/类
@Override
public List<Repository> getAllByType(final String dvcsType, final boolean includeDeleted)
{
    Query select = Query.select()
            .alias(OrganizationMapping.class, "org")
            .alias(RepositoryMapping.class, "repo")
            .join(OrganizationMapping.class, "repo." + RepositoryMapping.ORGANIZATION_ID + " = org.ID");

    if (!includeDeleted)
    {
        select.where("org." + OrganizationMapping.DVCS_TYPE + " = ? AND repo." + RepositoryMapping.DELETED + " = ? ", dvcsType, Boolean.FALSE);
    }
    else
    {
        select.where("org." + OrganizationMapping.DVCS_TYPE + " = ?", dvcsType);
    }

    final RepositoryMapping[] repos = activeObjects.find(RepositoryMapping.class, select);

    final Collection<Repository> repositories = transformRepositories(Arrays.asList(repos));

    return new ArrayList<Repository>(repositories);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:RepositoryDaoImpl.java


示例5: getByMessageId

import net.java.ao.Query; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public MessageQueueItemMapping[] getByMessageId(int id)
{
    Query query = new QueryTemplate(queryHelper)
    {

        @Override
        protected void build()
        {
            alias(MessageQueueItemMapping.class, "queueItem");
            where(eq(column(MessageQueueItemMapping.class, MessageQueueItemMapping.MESSAGE), parameter("messageId")));
        }

    }.toQuery(Collections.<String, Object> singletonMap("messageId", id));
    return activeObjects.find(MessageQueueItemMapping.class, query);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:MessageQueueItemDaoImpl.java


示例6: getByQueueAndMessage

import net.java.ao.Query; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public MessageQueueItemMapping getByQueueAndMessage(String queue, int messageId)
{
    Query query = new QueryTemplate(queryHelper)
    {

        @Override
        protected void build()
        {
            alias(MessageQueueItemMapping.class, "messageQueue");
            where(and( //
                    eq(column(MessageQueueItemMapping.class, MessageQueueItemMapping.QUEUE), parameter("queue")), //
                    eq(column(MessageQueueItemMapping.class, MessageQueueItemMapping.MESSAGE), parameter("messageId")) //
            ));
        }
    }.toQuery(MapBuilder.<String, Object> build("queue", queue, "messageId", messageId));

    MessageQueueItemMapping[] founded = activeObjects.find(MessageQueueItemMapping.class, query);
    return founded.length == 1 ? founded[0] : null;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:MessageQueueItemDaoImpl.java


示例7: associateIssuesToChangeset

import net.java.ao.Query; //导入依赖的package包/类
private void associateIssuesToChangeset(ChangesetMapping changesetMapping, Set<String> extractedIssues)
{
    // remove all assoc issues-changeset
    Query query = Query.select().where(IssueToChangesetMapping.CHANGESET_ID + " = ? ", changesetMapping);
    ActiveObjectsUtils.delete(activeObjects, IssueToChangesetMapping.class, query);

    // insert all
    for (String extractedIssue : extractedIssues)
    {
        final Map<String, Object> map = new MapRemovingNullCharacterFromStringValues();
        map.put(IssueToChangesetMapping.ISSUE_KEY, extractedIssue);
        map.put(IssueToChangesetMapping.PROJECT_KEY, parseProjectKey(extractedIssue));
        map.put(IssueToChangesetMapping.CHANGESET_ID, changesetMapping.getID());
        activeObjects.create(IssueToChangesetMapping.class, map);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:ChangesetDaoImpl.java


示例8: getByNode

import net.java.ao.Query; //导入依赖的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


示例9: getByRepository

import net.java.ao.Query; //导入依赖的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


示例10: getChangesetMappingsByIssueKey

import net.java.ao.Query; //导入依赖的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


示例11: getLatestChangesets

import net.java.ao.Query; //导入依赖的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


示例12: findReferencedProjects

import net.java.ao.Query; //导入依赖的package包/类
public Set<String> findReferencedProjects(int repositoryId)
{
    Query query = Query.select(IssueToChangesetMapping.PROJECT_KEY).distinct()
            .alias(ProjectKey.class, "pk")
            .alias(ChangesetMapping.class, "chm")
            .alias(RepositoryToChangesetMapping.class, "rtchm")
            .join(ChangesetMapping.class, "chm.ID = pk." + IssueToChangesetMapping.CHANGESET_ID)
            .join(RepositoryToChangesetMapping.class, "chm.ID = rtchm." + RepositoryToChangesetMapping.CHANGESET_ID)
            .where("rtchm." + RepositoryToChangesetMapping.REPOSITORY_ID + " = ?", repositoryId)
            .order(IssueToChangesetMapping.PROJECT_KEY);


    final Set<String> projectKeys = new HashSet<String>();
    activeObjects.stream(ProjectKey.class, query, new EntityStreamCallback<ProjectKey, String>()
    {
        @Override
        public void onRowRead(ProjectKey mapping)
        {
            projectKeys.add(mapping.getProjectKey());
        }
    });

    return projectKeys;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:25,代码来源:ChangesetDaoImpl.java


示例13: findEmails

import net.java.ao.Query; //导入依赖的package包/类
public Set<String> findEmails(int repositoryId, String author)
{
    Query query = Query.select(ChangesetMapping.AUTHOR_EMAIL).distinct()
            .from(ChangesetMapping.class)
            .alias(ChangesetMapping.class, "chm")
            .alias(RepositoryToChangesetMapping.class, "rtchm")
            .join(RepositoryToChangesetMapping.class, "chm.ID = rtchm." + RepositoryToChangesetMapping.CHANGESET_ID)
            .where("rtchm." + RepositoryToChangesetMapping.REPOSITORY_ID + " = ? and chm." + ChangesetMapping.AUTHOR + " = ? ", repositoryId, author).limit(1);

    final Set<String> emails = new HashSet<String>();

    activeObjects.stream(AuthorEmail.class, query, new EntityStreamCallback<AuthorEmail, String>()
    {
        @Override
        public void onRowRead(AuthorEmail mapping)
        {
            emails.add(mapping.getAuthorEmail());
        }
    });

    return emails;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:23,代码来源:ChangesetDaoImpl.java


示例14: removeBranchHead

import net.java.ao.Query; //导入依赖的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


示例15: unlinkCommits

import net.java.ao.Query; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void unlinkCommits(Repository domain, RepositoryPullRequestMapping request, Iterable<? extends RepositoryCommitMapping> commits)
{
    Iterable<Integer> commitIds = Iterables.transform(commits, new Function<RepositoryCommitMapping, Integer>()
    {
        @Override
        public Integer apply(final RepositoryCommitMapping repositoryCommitMapping)
        {
            return repositoryCommitMapping.getID();
        }
    });

    final String baseWhereClause = ActiveObjectsUtils.renderListOperator(RepositoryPullRequestToCommitMapping.COMMIT, "IN", "OR", commitIds);

    Query query = Query.select().where(RepositoryPullRequestToCommitMapping.REQUEST_ID + " = ? AND "
            + baseWhereClause, ObjectArrays.concat(request.getID(), Iterables.toArray(commitIds, Object.class)));
    ActiveObjectsUtils.delete(activeObjects, RepositoryPullRequestToCommitMapping.class, query);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:RepositoryPullRequestDaoImpl.java


示例16: getIssueKeys

import net.java.ao.Query; //导入依赖的package包/类
@Override
public Set<String> getIssueKeys(int repositoryId, int pullRequestId)
{
    Query query = Query
            .select()
            .from(RepositoryPullRequestIssueKeyMapping.class)
            .where(RepositoryDomainMapping.DOMAIN + " = ? AND " + RepositoryPullRequestIssueKeyMapping.PULL_REQUEST_ID + " = ? ",
                    repositoryId, pullRequestId);

    RepositoryPullRequestIssueKeyMapping[] mappings = activeObjects.find(RepositoryPullRequestIssueKeyMapping.class, query);
    Set<String> issueKeys = Sets.newHashSet();
    for (RepositoryPullRequestIssueKeyMapping mapping : mappings)
    {
        issueKeys.add(mapping.getIssueKey());
    }
    return issueKeys;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:18,代码来源:RepositoryPullRequestDaoImpl.java


示例17: getByIssueKeys

import net.java.ao.Query; //导入依赖的package包/类
@Override
public List<RepositoryPullRequestMapping> getByIssueKeys(final Iterable<String> issueKeys)
{
    Collection<Integer> prIds = findRelatedPullRequests(issueKeys);
    if (prIds.isEmpty())
    {
        return Lists.newArrayList();
    }
    final String whereClause = ActiveObjectsUtils.renderListOperator("pr.ID", "IN", "OR", prIds).toString();
    final Object [] params = ObjectArrays.concat(new Object[]{Boolean.FALSE, Boolean.TRUE}, prIds.toArray(), Object.class);
    
    Query select = Query.select()
            .alias(RepositoryMapping.class, "repo")
            .alias(RepositoryPullRequestMapping.class, "pr")
            .join(RepositoryMapping.class, "repo.ID = pr." + RepositoryPullRequestMapping.TO_REPO_ID)
            .where("repo." + RepositoryMapping.DELETED + " = ? AND repo." + RepositoryMapping.LINKED + " = ? AND " + whereClause, params);
    return Arrays.asList(activeObjects.find(RepositoryPullRequestMapping.class, select));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:19,代码来源:RepositoryPullRequestDaoImpl.java


示例18: getCommitByNode

import net.java.ao.Query; //导入依赖的package包/类
@Override
public RepositoryCommitMapping getCommitByNode(Repository domain, int pullRequestId, String node)
{
    Query query = Query
            .select()
            .alias(RepositoryCommitMapping.class, "cm")
            .alias(RepositoryPullRequestToCommitMapping.class, "pr2cm")
            .alias(RepositoryPullRequestMapping.class, "PR")
            .join(RepositoryPullRequestToCommitMapping.class,
                    "cm.ID = pr2cm." + RepositoryPullRequestToCommitMapping.COMMIT)
            .join(RepositoryPullRequestMapping.class,
                    "pr2cm." + RepositoryPullRequestToCommitMapping.REQUEST_ID + " = PR.ID")
            .where("cm." + RepositoryDomainMapping.DOMAIN + " = ? AND PR.ID"
                    + " = ? AND cm." + RepositoryCommitMapping.NODE
                    + " = ?", domain.getId(), pullRequestId, node);

    RepositoryCommitMapping[] found = activeObjects.find(RepositoryCommitMapping.class, query);
    return found.length == 1 ? found[0] : null;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:RepositoryPullRequestDaoImpl.java


示例19: fetch

import net.java.ao.Query; //导入依赖的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


示例20: getMessagesForConsumingCount

import net.java.ao.Query; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int getMessagesForConsumingCount(String tag)
{
    Query query = new QueryTemplate(queryHelper)
    {

        @Override
        protected void build()
        {
            alias(MessageMapping.class, "messageMapping");
            alias(MessageTagMapping.class, "messageTag");
            alias(MessageQueueItemMapping.class, "messageQueueItem");

            join(MessageTagMapping.class, column(MessageMapping.class, ID), MessageTagMapping.MESSAGE);
            join(MessageQueueItemMapping.class, column(MessageMapping.class, ID), MessageQueueItemMapping.MESSAGE);

            where(and( //
                    eq(column(MessageTagMapping.class, MessageTagMapping.TAG), parameter("tag")), //
                    in(column(MessageQueueItemMapping.class, MessageQueueItemMapping.STATE), parameter("state")) //
            ));
        }

    }.toQuery(MapBuilder.<String, Object> build("tag", tag, "state", new MessageState[] { MessageState.PENDING, MessageState.RUNNING, MessageState.SLEEPING }));
    return activeObjects.count(MessageMapping.class, query);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:29,代码来源:MessageDaoImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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