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)
EntityEngine
Use this for entities that include an ID column (most of them).
createValue
in interface EntityEngine
E
- entity typeentityFactory
- the EntityFactoryvalue
- the entity to be created.EntityEngine.createValueWithoutId(EntityFactory, Object)
public <E> void createValueWithoutId(EntityFactory<E> entityFactory, E value)
EntityEngine
Use this for entities that don't have a numeric ID column.
createValueWithoutId
in interface EntityEngine
E
- 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 EntityEngine
public int execute(Update.WhereContext updateContext)
EntityEngine
See the Update
class for an example.
execute
in interface EntityEngine
updateContext
- build up a fluent UPDATE statement here. Should start with Update.into(
public int delete(Delete.DeleteWhereContext deleteContext)
EntityEngine
You 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 EntityEngine
deleteContext
- build up a fluent DELETE statement here. Should start with Delete.from(
public <E> SelectQuery.ExecutionContext<E> run(SelectQuery<E> selectQuery)
run
in interface EntityEngine
public <E> int removeValue(EntityFactory<E> entityFactory, Long id)
EntityEngine
removeValue
in interface EntityEngine
entityFactory
- represents the entity type (ie TABLE)id
- the id of the row to delete.public <E> EntityEngine.SelectFromContext<E> selectFrom(EntityFactory<E> entity)
EntityEngine
e.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 EntityEngine
E
- Entity Data Object type.entity
- that can convert GenericValues into Entity data objects. See Entity
for existing factories.Entity
Copyright © 2002-2019 Atlassian. All Rights Reserved.