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


Java Entity类代码示例

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


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

示例1: delete

import net.java.ao.Entity; //导入依赖的package包/类
public static <T extends Entity> int delete(final ActiveObjects activeObjects, Class<T> entityType, Query query)
{
    long startTime = System.currentTimeMillis();
    log.debug("Deleting type {}", entityType);

    final Set<Integer> ids = new LinkedHashSet<Integer>();
    activeObjects.stream(entityType, query, new EntityStreamCallback<T, Integer>()
    {

        @Override
        public void onRowRead(T t)
        {
            ids.add(t.getID());
        }

    });

    int deleted = 0;
    Iterable<List<Integer>> windows = Iterables.partition(ids, DELETE_WINDOW_SIZE);
    for (List<Integer> window : windows)
    {
        log.debug("Deleting up to {} entities of {} remaining.", DELETE_WINDOW_SIZE, ids.size() - deleted);
        if (DELETE_WITH_SQL)
        {
            activeObjects.deleteWithSQL(entityType, renderListOperator(ID, "IN", "OR", window), window.toArray());
        } else
        {
            activeObjects.delete(activeObjects.find(entityType, renderListOperator(ID, "IN", "OR", window), window.toArray()));
        }
        deleted += window.size();
    }

    log.debug("Type {} deleted in {} ms", entityType, System.currentTimeMillis() - startTime);

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

示例2: call

import net.java.ao.Entity; //导入依赖的package包/类
@Override
public Void call()
{
    try
    {
        long startTime = System.currentTimeMillis();
        log.debug("Running SmartcommitOperation ... ");

        changesetDao.forEachLatestChangesetsAvailableForSmartcommitDo(repository.getId(),
                new String[] {ID, MESSAGE, NODE, AUTHOR_EMAIL, DATE}, // the columns used in the closure below
                new ForEachChangesetClosure()
        {
            @Override
            public void execute(Entity mapping)
            {
                ChangesetMapping changesetMapping = (ChangesetMapping) mapping;
                log.debug("Processing message \n {} \n for smartcommits. Changeset id = {} node = {}.", new Object[]
                        {changesetMapping.getMessage(), changesetMapping.getID(), changesetMapping.getNode()});

                // first mark as processed
                changesetDao.markSmartcommitAvailability(changesetMapping.getID(), false);
                // parse message
                CommitCommands commands = commitMessageParser.parseCommitComment(changesetMapping.getMessage());
                commands.setCommitDate(changesetMapping.getDate());
                commands.setAuthorEmail(changesetMapping.getAuthorEmail());
                // do commands
                if (CollectionUtils.isNotEmpty(commands.getCommands()))
                {
                    final CommandsResults commandsResults = smartcommitsService.doCommands(commands);
                    if (commandsResults.hasErrors())
                    {

                        Changeset changeset = changesetDao.getByNode(repository.getId(), changesetMapping.getNode());
                        if (changeset != null)
                        {
                            final String commitUrl = changesetService.getCommitUrl(repository, changeset);

                            List<SmartCommitError> smartCommitErrors = new ArrayList<SmartCommitError>();
                            for (String error : commandsResults.getAllErrors())
                            {
                                SmartCommitError sce = new SmartCommitError(changeset.getNode(), commitUrl, error);
                                smartCommitErrors.add(sce);
                            }
                            if (progress != null)
                            {
                                progress.setSmartCommitErrors(smartCommitErrors);
                            }
                        }
                    }
                }
            }
        });

        log.debug("Smartcommits for repository {} were processed in {} ms", repository.getId(), System.currentTimeMillis() - startTime);
    }
    catch (Exception e)
    {
        log.warn("Failed to process smartcommit operation. Cause = " + e.getClass() + " : " + e.getMessage());
    }

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

示例3: deleteAllExistingTableContent

import net.java.ao.Entity; //导入依赖的package包/类
private <T extends Entity> void deleteAllExistingTableContent(final ActiveObjects activeObjects, Class<T> entityType)
{
    ActiveObjectsUtils.delete(activeObjects, entityType, Query.select());
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:5,代码来源:To_08_ActiveObjectsV3Migrator.java

示例4: createEntity

import net.java.ao.Entity; //导入依赖的package包/类
private Entity createEntity(int id)
{
    Entity entity = Mockito.mock(Entity.class);
    when(entity.getID()).thenReturn(id);
    return entity;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:7,代码来源:ActiveObjectsUtilsTest.java

示例5: EntityContext

import net.java.ao.Entity; //导入依赖的package包/类
public EntityContext(Entity entity)
{
    this.entity = entity;
    this.captor = ArgumentCaptor.forClass(Entity.class);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:6,代码来源:ActiveObjectsUtilsTest.java

示例6: getEntity

import net.java.ao.Entity; //导入依赖的package包/类
public Entity getEntity()
{
    return entity;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:5,代码来源:ActiveObjectsUtilsTest.java

示例7: getCaptor

import net.java.ao.Entity; //导入依赖的package包/类
public ArgumentCaptor<Entity> getCaptor()
{
    return captor;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:5,代码来源:ActiveObjectsUtilsTest.java

示例8: table

import net.java.ao.Entity; //导入依赖的package包/类
/**
 * Creates name of table for provided entity. The name is also sanitized.
 * 
 * @param entity
 *            for which database entity
 * @return name of table
 */
private String table(Class<? extends Entity> entity)
{
    String tableName = tableNameConverter.getName(entity);
    return databaseProvider.withSchema(tableName);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:13,代码来源:To_12_SplitUpChangesetsMigrator.java

示例9: execute

import net.java.ao.Entity; //导入依赖的package包/类
/**
 * @param changeset
 */
void execute(Entity changeset);
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:5,代码来源:ChangesetDao.java


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