Package com.atlassian.jira.entity
Class EntityEngineImpl
java.lang.Object
com.atlassian.jira.entity.EntityEngineImpl
- All Implemented Interfaces:
EntityEngine
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.entity.EntityEngine
EntityEngine.SelectFromContext<E>, EntityEngine.WhereContext<E>, EntityEngine.WhereEqualAndContext<E>, EntityEngine.WhereEqualContext<E>, EntityEngine.WhereInContext<E> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E> EcreateValue(EntityFactory<E> entityFactory, E value) Creates a new Entity and auto populates the ID if no ID is explicitly set.<E> voidcreateValueWithoutId(EntityFactory<E> entityFactory, E value) Creates a new Entity without trying to automatically populate the ID column.intdelete(Delete.DeleteWhereContext deleteContext) Allows you to execute an SQL DELETE using a fluent interface.intexecute(Update.WhereContext updateContext) Allows you to execute an UPDATE statement using a fluent interface.<E> intremoveValue(EntityFactory<E> entityFactory, Long id) Remove the given entity from the DB.<E> SelectQuery.ExecutionContext<E>run(SelectQuery<E> selectQuery) selectFrom(EntityFactory<E> entity) Starts a dialog to run a SELECT query against EntityEngine.<E> voidupdateValue(EntityFactory<E> entityFactory, E newValue)
-
Constructor Details
-
EntityEngineImpl
-
-
Method Details
-
createValue
Description copied from interface:EntityEngineCreates a new Entity and auto populates the ID if no ID is explicitly set.Use this for entities that include an ID column (most of them).
- Specified by:
createValuein interfaceEntityEngine- Type Parameters:
E- entity type- Parameters:
entityFactory- the EntityFactoryvalue- the entity to be created.- Returns:
- the newly created value (with the newly populated ID in it).
- See Also:
-
createValueWithoutId
Description copied from interface:EntityEngineCreates a new Entity without trying to automatically populate the ID column.Use this for entities that don't have a numeric ID column.
- Specified by:
createValueWithoutIdin interfaceEntityEngine- Type Parameters:
E- entity type- Parameters:
entityFactory- the EntityFactoryvalue- the entity to be created.- See Also:
-
updateValue
- Specified by:
updateValuein interfaceEntityEngine
-
execute
Description copied from interface:EntityEngineAllows you to execute an UPDATE statement using a fluent interface.See the
Updateclass for an example.- Specified by:
executein interfaceEntityEngine- Parameters:
updateContext- build up a fluent UPDATE statement here. Should start withUpdate.into(- Returns:
- the number of entities / DB rows deleted.
-
delete
Description copied from interface:EntityEngineAllows you to execute an SQL DELETE using a fluent interface.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) );- Specified by:
deletein interfaceEntityEngine- Parameters:
deleteContext- build up a fluent DELETE statement here. Should start withDelete.from(- Returns:
- the number of entities / DB rows deleted.
-
run
- Specified by:
runin interfaceEntityEngine
-
removeValue
Description copied from interface:EntityEngineRemove the given entity from the DB.- Specified by:
removeValuein interfaceEntityEngine- Parameters:
entityFactory- represents the entity type (ie TABLE)id- the id of the row to delete.- Returns:
- number of rows effected by this operation
-
selectFrom
Description copied from interface:EntityEngineStarts a dialog to run a SELECT query against 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:List
remoteIssueLinks = entityEngine.selectFrom(Entity.REMOTE_ISSUE_LINK) .whereEqual("issueid", issueId) .andEqual("app", app) .orderBy("type"); - Specified by:
selectFromin interfaceEntityEngine- Type Parameters:
E- Entity Data Object type.- Parameters:
entity- that can convert GenericValues into Entity data objects. SeeEntityfor existing factories.- Returns:
- The context that begins a fluent dialog to run a SELECT query.
- See Also:
-