public class

LockedDatabaseOfBizDelegator

extends Object
implements OfBizDelegator
java.lang.Object
   ↳ com.atlassian.jira.appconsistency.db.LockedDatabaseOfBizDelegator

Class Overview

Copyright All Rights Reserved. Created: christo 15/09/2006 12:19:02

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.ofbiz.OfBizDelegator
Public Constructors
LockedDatabaseOfBizDelegator()
Public Methods
int bulkCopyColumnValuesByAnd(String entityName, Map updateColumns, Map criteria)
This can be used to perform an update on the entityName of all the rows identified by AND criteria of the fields specified by the criteria map.
int bulkUpdateByAnd(String entityName, Map updateValues, Map criteria)
int bulkUpdateByPrimaryKey(String entityName, Map updateValues, List keys)
GenericValue createValue(String entity, Map params)
List<GenericValue> findAll(String s)
List<GenericValue> findAll(String s, List sortOrder)
List<GenericValue> findByAnd(String s, Map map)
List<GenericValue> findByAnd(String s, List expressions)
List<GenericValue> findByAnd(String s, Map map, List orderClause)
List<GenericValue> findByCondition(String entityName, EntityCondition entityCondition, Collection fieldsToSelect, List orderBy)
List<GenericValue> findByCondition(String entityName, EntityCondition entityCondition, Collection fieldsToSelect)
List<GenericValue> findByField(String entityName, String fieldName, Object fieldValue, String orderBy)
Finds GenericValue records by the specified field value.
List<GenericValue> findByField(String entityName, String fieldName, Object fieldValue)
Finds GenericValue records by the specified field value.
GenericValue findById(String entityName, Long id)
Find a Generic Entity by its numeric ID.
List<GenericValue> findByLike(String s, Map map, List orderBy)
List<GenericValue> findByLike(String s, Map map)
List<GenericValue> findByOr(String entityName, List expressions, List orderBy)
GenericValue findByPrimaryKey(String s, Long id)
Find a Generic Entity by its single numeric Primary Key.
GenericValue findByPrimaryKey(String s, Map map)
OfBizListIterator findListIteratorByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection fieldsToSelect, List orderBy, EntityFindOptions entityFindOptions)
OfBizListIterator findListIteratorByCondition(String entityType, EntityCondition condition)
Returns a new OfBizListIterator.
long getCount(String entityName)
Ensure that there is a view-entity defined in entitymodel.xml (and entitygroup.xml) for the entity you are calling this method with, and that the view-entity is named correctly! The view-entity must be named the name of the normal entity with 'Count' appended.
ModelReader getModelReader()
Returns a model reader that can be used to retrieve all the different entitynames configured in the entitymodel.
List<GenericValue> getRelated(String relationName, GenericValue gv)
GenericValue makeValue(String entityName, Map<StringObject> fields)
Creates an Entity in the form of a GenericValue without persisting it.
GenericValue makeValue(String entity)
Creates an Entity in the form of a GenericValue without persisting it.
void refreshSequencer()
Refreshes the sequencer that is used to retrieve unique IDs in the database.
void removeAll(List genericValues)
int removeByAnd(String s, Map map)
int removeById(String entityName, Long id)
Remove the given entity from the DB.
int removeByOr(String entityName, String entityId, List ids)
boolean removeRelated(String relationName, GenericValue schemeGv)
Remove all the entities related to the passed generic value via the passed relationship name.
int removeValue(GenericValue value)
void store(GenericValue gv)
void storeAll(List genericValues)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.ofbiz.OfBizDelegator

Public Constructors

public LockedDatabaseOfBizDelegator ()

Public Methods

public int bulkCopyColumnValuesByAnd (String entityName, Map updateColumns, Map criteria)

This can be used to perform an update on the entityName of all the rows identified by AND criteria of the fields specified by the criteria map.

Parameters
entityName table na,e
updateColumns map of update to - update from columns
criteria map of column names and their values that will create WHERE clause
Returns
  • the number of rows updated

public int bulkUpdateByAnd (String entityName, Map updateValues, Map criteria)

public int bulkUpdateByPrimaryKey (String entityName, Map updateValues, List keys)

public GenericValue createValue (String entity, Map params)

public List<GenericValue> findAll (String s)

public List<GenericValue> findAll (String s, List sortOrder)

public List<GenericValue> findByAnd (String s, Map map)

public List<GenericValue> findByAnd (String s, List expressions)

public List<GenericValue> findByAnd (String s, Map map, List orderClause)

public List<GenericValue> findByCondition (String entityName, EntityCondition entityCondition, Collection fieldsToSelect, List orderBy)

public List<GenericValue> findByCondition (String entityName, EntityCondition entityCondition, Collection fieldsToSelect)

public List<GenericValue> findByField (String entityName, String fieldName, Object fieldValue, String orderBy)

Finds GenericValue records by the specified field value.

Parameters
entityName The Name of the Entity as defined in the entity XML file
fieldName The field to do filtering by.
fieldValue The desired value for the filtering field.
orderBy Single field to order by.
Returns
  • List of GenericValue instances that match the query

public List<GenericValue> findByField (String entityName, String fieldName, Object fieldValue)

Finds GenericValue records by the specified field value.

Parameters
entityName The Name of the Entity as defined in the entity XML file
fieldName The field to do filtering by.
fieldValue The desired value for the filtering field.
Returns
  • List of GenericValue instances that match the query

public GenericValue findById (String entityName, Long id)

Find a Generic Entity by its numeric ID.

This method is a synonym for findByPrimaryKey(String, Long)

Parameters
entityName The Name of the Entity as defined in the entity XML file
id The numeric "id" field value that is the primary key of this entity.
Returns
  • The GenericValue corresponding to the ID

public List<GenericValue> findByLike (String s, Map map, List orderBy)

public List<GenericValue> findByLike (String s, Map map)

public List<GenericValue> findByOr (String entityName, List expressions, List orderBy)

public GenericValue findByPrimaryKey (String s, Long id)

Find a Generic Entity by its single numeric Primary Key.

This method is a convenience for entities with a numeric primary key on single field called "id". This is the case for most JIRA entities.

Parameters
s The Name of the Entity as defined in the entity XML file
id The numeric "id" field value that is the primary key of this entity.
Returns
  • The GenericValue corresponding to the primary key

public GenericValue findByPrimaryKey (String s, Map map)

public OfBizListIterator findListIteratorByCondition (String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection fieldsToSelect, List orderBy, EntityFindOptions entityFindOptions)

public OfBizListIterator findListIteratorByCondition (String entityType, EntityCondition condition)

Returns a new OfBizListIterator.

IMPORTANT: the returned iterator needs to be propery closed in a finally block to avoid connection leaks.

public long getCount (String entityName)

Ensure that there is a view-entity defined in entitymodel.xml (and entitygroup.xml) for the entity you are calling this method with, and that the view-entity is named correctly! The view-entity must be named the name of the normal entity with 'Count' appended. For example for the 'Issue' entity the view-entity must be called 'IssueCount'. Otherwise an exception will be thrown.

Parameters
entityName entity name
Returns
  • count

public ModelReader getModelReader ()

Returns a model reader that can be used to retrieve all the different entitynames configured in the entitymodel.

Returns
  • a ModelReader

public List<GenericValue> getRelated (String relationName, GenericValue gv)

public GenericValue makeValue (String entityName, Map<StringObject> fields)

Creates an Entity in the form of a GenericValue without persisting it.

Parameters
entityName the entity name.
fields initial field values
Returns
  • The new GenericValue.

public GenericValue makeValue (String entity)

Creates an Entity in the form of a GenericValue without persisting it.

Parameters
entity the entity name.
Returns
  • The new GenericValue.

public void refreshSequencer ()

Refreshes the sequencer that is used to retrieve unique IDs in the database.

public void removeAll (List genericValues)

public int removeByAnd (String s, Map map)

public int removeById (String entityName, Long id)

Remove the given entity from the DB.

Parameters
entityName the entity type (ie TABLE)
id the id of the row to delete.
Returns
  • number of rows effected by this operation

public int removeByOr (String entityName, String entityId, List ids)

public boolean removeRelated (String relationName, GenericValue schemeGv)

Remove all the entities related to the passed generic value via the passed relationship name.

Parameters
relationName the name of the relationship.
schemeGv the gv at the start of the relationship.
Returns
  • true the database was changed, false otherwise.

public int removeValue (GenericValue value)

public void store (GenericValue gv)

public void storeAll (List genericValues)