public interface EntityEngine
These methods are considered a higher level alternative to the OfBizDelegator and provide two main advantages:
Modifier and Type | Interface and Description |
---|---|
static interface |
EntityEngine.SelectFromContext<E> |
static interface |
EntityEngine.WhereContext<E> |
static interface |
EntityEngine.WhereEqualAndContext<E> |
static interface |
EntityEngine.WhereEqualContext<E> |
static interface |
EntityEngine.WhereInContext<E> |
Modifier and Type | Method and Description |
---|---|
<E> E |
createValue(EntityFactory<E> entityFactory,
E newValue)
Creates a new Entity and auto populates the ID if no ID is explicitly set.
|
<E> void |
createValueWithoutId(EntityFactory<E> entityFactory,
E newValue)
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> entityFactory)
Starts a dialog to run a SELECT query against EntityEngine.
|
<E> void |
updateValue(EntityFactory<E> entityFactory,
E newValue) |
<E> EntityEngine.SelectFromContext<E> selectFrom(EntityFactory<E> entityFactory)
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");
<E> E createValue(EntityFactory<E> entityFactory, E newValue)
E
- entity typeentityFactory
- the EntityFactorynewValue
- the entity to be created.createValueWithoutId(EntityFactory, Object)
<E> void createValueWithoutId(EntityFactory<E> entityFactory, E newValue)
E
- entity typeentityFactory
- the EntityFactorynewValue
- the entity to be created.createValue(EntityFactory, Object)
<E> void updateValue(EntityFactory<E> entityFactory, E newValue)
<E> int removeValue(EntityFactory<E> entityFactory, Long id)
entityFactory
- represents the entity type (ie TABLE)id
- the id of the row to delete.int execute(Update.WhereContext updateContext)
See the Update
class for an example.
updateContext
- build up a fluent UPDATE statement here. Should start with Update.into(
int delete(Delete.DeleteWhereContext deleteContext)
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) );
deleteContext
- build up a fluent DELETE statement here. Should start with Delete.from(
<E> SelectQuery.ExecutionContext<E> run(SelectQuery<E> selectQuery)
Copyright © 2002-2015 Atlassian. All Rights Reserved.