本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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;
}
示例5: EntityContext
import net.java.ao.Entity; //导入依赖的package包/类
public EntityContext(Entity entity)
{
this.entity = entity;
this.captor = ArgumentCaptor.forClass(Entity.class);
}
示例6: getEntity
import net.java.ao.Entity; //导入依赖的package包/类
public Entity getEntity()
{
return entity;
}
示例7: getCaptor
import net.java.ao.Entity; //导入依赖的package包/类
public ArgumentCaptor<Entity> getCaptor()
{
return captor;
}
示例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);
}
示例9: execute
import net.java.ao.Entity; //导入依赖的package包/类
/**
* @param changeset
*/
void execute(Entity changeset);