public class EntityEngineImpl extends Object implements EntityEngine
EntityEngine.SelectFromContext<E>, EntityEngine.WhereContext<E>, EntityEngine.WhereEqualAndContext<E>, EntityEngine.WhereEqualContext<E>, EntityEngine.WhereInContext<E>| Constructor and Description |
|---|
EntityEngineImpl(OfBizDelegator ofBizDelegator) |
| Modifier and Type | Method and Description |
|---|---|
<E> E |
createValue(EntityFactory<E> entityFactory,
E value)
Creates a new Entity and auto populates the ID if no ID is explicitly set.
|
<E> void |
createValueWithoutId(EntityFactory<E> entityFactory,
E value)
Creates a new Entity without trying to automatically populate the ID column.
|
int |
delete(Delete.DeleteWhereContext deleteContext)
Allows you to execute an SQL DELETE using a fluent interface.
|
int |
execute(Update.WhereContext updateContext)
Allows you to execute an UPDATE statement using a fluent interface.
|
<E> int |
removeValue(EntityFactory<E> entityFactory,
Long id)
Remove the given entity from the DB.
|
<E> SelectQuery.ExecutionContext<E> |
run(SelectQuery<E> selectQuery) |
<E> EntityEngine.SelectFromContext<E> |
selectFrom(EntityFactory<E> entity)
Starts a dialog to run a SELECT query against EntityEngine.
|
<E> void |
updateValue(EntityFactory<E> entityFactory,
E newValue) |
public EntityEngineImpl(OfBizDelegator ofBizDelegator)
public <E> E createValue(EntityFactory<E> entityFactory, E value)
EntityEngineUse this for entities that include an ID column (most of them).
createValue in interface EntityEngineE - entity typeentityFactory - the EntityFactoryvalue - the entity to be created.EntityEngine.createValueWithoutId(EntityFactory, Object)public <E> void createValueWithoutId(EntityFactory<E> entityFactory, E value)
EntityEngineUse this for entities that don't have a numeric ID column.
createValueWithoutId in interface EntityEngineE - entity typeentityFactory - the EntityFactoryvalue - the entity to be created.EntityEngine.createValue(EntityFactory, Object)public <E> void updateValue(EntityFactory<E> entityFactory, E newValue)
updateValue in interface EntityEnginepublic int execute(Update.WhereContext updateContext)
EntityEngine
See the Update class for an example.
execute in interface EntityEngineupdateContext - build up a fluent UPDATE statement here. Should start with Update.into(public int delete(Delete.DeleteWhereContext deleteContext)
EntityEngineYou should call this using code that looks like:
entityEngine.delete(Delete.from(Entity.ISSUE_SECURITY_LEVEL).whereIdEquals(securityLevelId));
or:
entityEngine.delete(
Delete.from(Entity.ISSUE_SECURITY_LEVEL)
.whereEqual("scheme", schemeId)
.andEqual("name", name)
);
delete in interface EntityEnginedeleteContext - build up a fluent DELETE statement here. Should start with Delete.from(public <E> SelectQuery.ExecutionContext<E> run(SelectQuery<E> selectQuery)
run in interface EntityEnginepublic <E> int removeValue(EntityFactory<E> entityFactory, Long id)
EntityEngineremoveValue in interface EntityEngineentityFactory - represents the entity type (ie TABLE)id - the id of the row to delete.public <E> EntityEngine.SelectFromContext<E> selectFrom(EntityFactory<E> entity)
EntityEnginee.g. to run "SELECT * FROM remotelink WHERE id = ?" (and return a single entity value) you could write:
RemoteIssueLink link = entityEngine.selectFrom(Entity.REMOTE_ISSUE_LINK)
.whereEqual("id", remoteIssueLinkId)
.singleValue();
e.g. to run "SELECT * FROM remotelink WHERE issueid = ? AND app = ? ORDER BY type" you could write:
ListremoteIssueLinks = entityEngine.selectFrom(Entity.REMOTE_ISSUE_LINK) .whereEqual("issueid", issueId) .andEqual("app", app) .orderBy("type");
selectFrom in interface EntityEngineE - Entity Data Object type.entity - that can convert GenericValues into Entity data objects. See Entity for existing factories.EntityCopyright © 2002-2022 Atlassian. All Rights Reserved.