com.atlassian.jira.appconsistency.db
Class LockedDatabaseOfBizDelegator

java.lang.Object
  extended by com.atlassian.jira.appconsistency.db.LockedDatabaseOfBizDelegator
All Implemented Interfaces:
OfBizDelegator

public class LockedDatabaseOfBizDelegator
extends Object
implements OfBizDelegator

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


Field Summary
 
Fields inherited from interface com.atlassian.jira.ofbiz.OfBizDelegator
ISSUE_LINK, ISSUE_LINK_TYPE, PROJECT_COMPONENT, VERSION
 
Constructor Summary
LockedDatabaseOfBizDelegator()
           
 
Method Summary
 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)
          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 bulkUpdateByPrimaryKey(String entityName, Map updateValues, List keys)
          This can be used to perform an update on the entityName of all the rows identified by the keys with the values stored in the updateValues.
 org.ofbiz.core.entity.GenericValue createValue(String entity, Map params)
          Creates a new GenericValue, and persists it.
 List<org.ofbiz.core.entity.GenericValue> findAll(String s)
           
 List<org.ofbiz.core.entity.GenericValue> findAll(String s, List sortOrder)
           
 List<org.ofbiz.core.entity.GenericValue> findByAnd(String s, List expressions)
           
 List<org.ofbiz.core.entity.GenericValue> findByAnd(String s, Map map)
          Finds GenericValue records by all of the specified fields (ie: combined using AND).
 List<org.ofbiz.core.entity.GenericValue> findByAnd(String s, Map map, List orderClause)
           
 List<org.ofbiz.core.entity.GenericValue> findByCondition(String entityName, org.ofbiz.core.entity.EntityCondition entityCondition, Collection fieldsToSelect)
          Finds GenericValues by the conditions specified in the EntityCondition object with no specified order.
 List<org.ofbiz.core.entity.GenericValue> findByCondition(String entityName, org.ofbiz.core.entity.EntityCondition entityCondition, Collection fieldsToSelect, List orderBy)
          Finds GenericValues by the conditions specified in the EntityCondition object.
 List<org.ofbiz.core.entity.GenericValue> findByField(String entityName, String fieldName, Object fieldValue)
          Finds GenericValue records by the specified field value.
 List<org.ofbiz.core.entity.GenericValue> findByField(String entityName, String fieldName, Object fieldValue, String orderBy)
          Finds GenericValue records by the specified field value.
 List<org.ofbiz.core.entity.GenericValue> findByLike(String s, Map map)
           
 List<org.ofbiz.core.entity.GenericValue> findByLike(String s, Map map, List orderBy)
           
 List<org.ofbiz.core.entity.GenericValue> findByOr(String entityName, List expressions, List orderBy)
           
 org.ofbiz.core.entity.GenericValue findByPrimaryKey(String s, Long id)
          Find a Generic Entity by its single numeric Primary Key.
 org.ofbiz.core.entity.GenericValue findByPrimaryKey(String s, Map map)
          Find a Generic Entity by its Primary Key.
 OfBizListIterator findListIteratorByCondition(String entityType, org.ofbiz.core.entity.EntityCondition condition)
           
 OfBizListIterator findListIteratorByCondition(String entityName, org.ofbiz.core.entity.EntityCondition whereEntityCondition, org.ofbiz.core.entity.EntityCondition havingEntityCondition, Collection fieldsToSelect, List orderBy, org.ofbiz.core.entity.EntityFindOptions entityFindOptions)
           
 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.
 org.ofbiz.core.entity.model.ModelReader getModelReader()
          Returns a model reader that can be used to retrieve all the different entitynames configured in the entitymodel.
 List<org.ofbiz.core.entity.GenericValue> getRelated(String relationName, org.ofbiz.core.entity.GenericValue gv)
           
 org.ofbiz.core.entity.GenericValue makeValue(String entity)
          Creates an Entity in the form of a GenericValue without persisting it.
 org.ofbiz.core.entity.GenericValue makeValue(String entityName, Map<String,Object> fields)
          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)
          This can be used to remove rows for a given entity based on entityName and where entityId
 int removeValue(org.ofbiz.core.entity.GenericValue value)
           
 void store(org.ofbiz.core.entity.GenericValue gv)
           
 void storeAll(List genericValues)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockedDatabaseOfBizDelegator

public LockedDatabaseOfBizDelegator()
Method Detail

findByField

public List<org.ofbiz.core.entity.GenericValue> findByField(String entityName,
                                                            String fieldName,
                                                            Object fieldValue)
Description copied from interface: OfBizDelegator
Finds GenericValue records by the specified field value.

Specified by:
findByField in interface OfBizDelegator
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

findByField

public List<org.ofbiz.core.entity.GenericValue> findByField(String entityName,
                                                            String fieldName,
                                                            Object fieldValue,
                                                            String orderBy)
Description copied from interface: OfBizDelegator
Finds GenericValue records by the specified field value.

Specified by:
findByField in interface OfBizDelegator
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

bulkUpdateByAnd

public int bulkUpdateByAnd(String entityName,
                           Map updateValues,
                           Map criteria)
Description copied from interface: OfBizDelegator
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.

Specified by:
bulkUpdateByAnd in interface OfBizDelegator
Parameters:
entityName - identifies the table to perform the update on.
updateValues - is a map where the key is the fieldName and the value is the value to update the column to.
criteria - map of field to value mapping that will be used to generate the where clause of the update SQL statement. Multiple entries in the map are joined using the AND operator.
Returns:
the number of rows updated

bulkUpdateByPrimaryKey

public int bulkUpdateByPrimaryKey(String entityName,
                                  Map updateValues,
                                  List keys)
Description copied from interface: OfBizDelegator
This can be used to perform an update on the entityName of all the rows identified by the keys with the values stored in the updateValues.

Specified by:
bulkUpdateByPrimaryKey in interface OfBizDelegator
Parameters:
entityName - identifies the table to perform the update on.
updateValues - is a map where the key is the fieldName and the value is the value to update the column to.
keys - is a list of Long values that represent the primary keys of the the where clause.
Returns:
the number of rows updated

createValue

public org.ofbiz.core.entity.GenericValue createValue(String entity,
                                                      Map params)
                                               throws DataAccessException
Description copied from interface: OfBizDelegator
Creates a new GenericValue, and persists it. If there is no "id" in the field values, one is created using the entity sequence.

Specified by:
createValue in interface OfBizDelegator
Parameters:
entity - the entity name.
params - field values
Returns:
The new GenericValue.
Throws:
DataAccessException - if an error occurs in the Database layer
See Also:
OfBizDelegator.makeValue(String)

findAll

public List<org.ofbiz.core.entity.GenericValue> findAll(String s)
                                                 throws DataAccessException
Specified by:
findAll in interface OfBizDelegator
Throws:
DataAccessException

findAll

public List<org.ofbiz.core.entity.GenericValue> findAll(String s,
                                                        List sortOrder)
                                                 throws DataAccessException
Specified by:
findAll in interface OfBizDelegator
Throws:
DataAccessException

findByAnd

public List<org.ofbiz.core.entity.GenericValue> findByAnd(String s,
                                                          List expressions)
                                                   throws DataAccessException
Specified by:
findByAnd in interface OfBizDelegator
Throws:
DataAccessException

findByAnd

public List<org.ofbiz.core.entity.GenericValue> findByAnd(String s,
                                                          Map map)
                                                   throws DataAccessException
Description copied from interface: OfBizDelegator
Finds GenericValue records by all of the specified fields (ie: combined using AND).

Specified by:
findByAnd in interface OfBizDelegator
Parameters:
s - The Name of the Entity as defined in the entity XML file
map - The fields of the named entity to query by with their corresponding values
Returns:
List of GenericValue instances that match the query
Throws:
DataAccessException - If an error occurs in the persistence layer.

findByAnd

public List<org.ofbiz.core.entity.GenericValue> findByAnd(String s,
                                                          Map map,
                                                          List orderClause)
                                                   throws DataAccessException
Specified by:
findByAnd in interface OfBizDelegator
Throws:
DataAccessException

findByLike

public List<org.ofbiz.core.entity.GenericValue> findByLike(String s,
                                                           Map map)
                                                    throws DataAccessException
Specified by:
findByLike in interface OfBizDelegator
Throws:
DataAccessException

findByLike

public List<org.ofbiz.core.entity.GenericValue> findByLike(String s,
                                                           Map map,
                                                           List orderBy)
                                                    throws DataAccessException
Specified by:
findByLike in interface OfBizDelegator
Throws:
DataAccessException

findByOr

public List<org.ofbiz.core.entity.GenericValue> findByOr(String entityName,
                                                         List expressions,
                                                         List orderBy)
                                                  throws DataAccessException
Specified by:
findByOr in interface OfBizDelegator
Throws:
DataAccessException

findByPrimaryKey

public org.ofbiz.core.entity.GenericValue findByPrimaryKey(String s,
                                                           Long id)
Description copied from interface: OfBizDelegator
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.

Specified by:
findByPrimaryKey in interface OfBizDelegator
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
See Also:
OfBizDelegator.findByPrimaryKey(String, java.util.Map)

findByPrimaryKey

public org.ofbiz.core.entity.GenericValue findByPrimaryKey(String s,
                                                           Map map)
Description copied from interface: OfBizDelegator
Find a Generic Entity by its Primary Key.

Specified by:
findByPrimaryKey in interface OfBizDelegator
Parameters:
s - The Name of the Entity as defined in the entity XML file
map - The field/value pairs of the primary key (in JIRA, mostly just a single field "id")
Returns:
The GenericValue corresponding to the primary key
See Also:
OfBizDelegator.findByPrimaryKey(String, Long)

findListIteratorByCondition

public OfBizListIterator findListIteratorByCondition(String entityName,
                                                     org.ofbiz.core.entity.EntityCondition whereEntityCondition,
                                                     org.ofbiz.core.entity.EntityCondition havingEntityCondition,
                                                     Collection fieldsToSelect,
                                                     List orderBy,
                                                     org.ofbiz.core.entity.EntityFindOptions entityFindOptions)
Specified by:
findListIteratorByCondition in interface OfBizDelegator

findListIteratorByCondition

public OfBizListIterator findListIteratorByCondition(String entityType,
                                                     org.ofbiz.core.entity.EntityCondition condition)
Specified by:
findListIteratorByCondition in interface OfBizDelegator

getCount

public long getCount(String entityName)
              throws DataAccessException
Description copied from interface: OfBizDelegator
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.

Specified by:
getCount in interface OfBizDelegator
Parameters:
entityName - entity name
Returns:
count
Throws:
DataAccessException - if data access problems occur

getRelated

public List<org.ofbiz.core.entity.GenericValue> getRelated(String relationName,
                                                           org.ofbiz.core.entity.GenericValue gv)
Specified by:
getRelated in interface OfBizDelegator

removeAll

public void removeAll(List genericValues)
               throws DataAccessException
Specified by:
removeAll in interface OfBizDelegator
Throws:
DataAccessException

removeByAnd

public int removeByAnd(String s,
                       Map map)
                throws DataAccessException
Specified by:
removeByAnd in interface OfBizDelegator
Throws:
DataAccessException

removeById

public int removeById(String entityName,
                      Long id)
Description copied from interface: OfBizDelegator
Remove the given entity from the DB.

Specified by:
removeById in interface OfBizDelegator
Parameters:
entityName - the entity type (ie TABLE)
id - the id of the row to delete.
Returns:
number of rows effected by this operation

removeValue

public int removeValue(org.ofbiz.core.entity.GenericValue value)
                throws DataAccessException
Specified by:
removeValue in interface OfBizDelegator
Throws:
DataAccessException

makeValue

public org.ofbiz.core.entity.GenericValue makeValue(String entity)
Description copied from interface: OfBizDelegator
Creates an Entity in the form of a GenericValue without persisting it.

Specified by:
makeValue in interface OfBizDelegator
Parameters:
entity - the entity name.
Returns:
The new GenericValue.
See Also:
OfBizDelegator.makeValue(String, java.util.Map), OfBizDelegator.createValue(String, java.util.Map)

makeValue

public org.ofbiz.core.entity.GenericValue makeValue(String entityName,
                                                    Map<String,Object> fields)
Description copied from interface: OfBizDelegator
Creates an Entity in the form of a GenericValue without persisting it.

Specified by:
makeValue in interface OfBizDelegator
Parameters:
entityName - the entity name.
fields - initial field values
Returns:
The new GenericValue.
See Also:
OfBizDelegator.makeValue(String), OfBizDelegator.createValue(String, java.util.Map)

store

public void store(org.ofbiz.core.entity.GenericValue gv)
           throws DataAccessException
Specified by:
store in interface OfBizDelegator
Throws:
DataAccessException

storeAll

public void storeAll(List genericValues)
              throws DataAccessException
Specified by:
storeAll in interface OfBizDelegator
Throws:
DataAccessException

removeByOr

public int removeByOr(String entityName,
                      String entityId,
                      List ids)
Description copied from interface: OfBizDelegator
This can be used to remove rows for a given entity based on entityName and where entityId
Specified by:
removeByOr in interface OfBizDelegator
Parameters:
entityName - identifies the table to perform the remove on.
entityId - the Ofbiz fieldName to be used for the identifier, eg WHERE fieldName IN (...). Must be the same case as that found in entitymodel.xml.
ids - a list of entity IDs of the rows to be removed
Returns:
number of rows removed

findByCondition

public List<org.ofbiz.core.entity.GenericValue> findByCondition(String entityName,
                                                                org.ofbiz.core.entity.EntityCondition entityCondition,
                                                                Collection fieldsToSelect)
Description copied from interface: OfBizDelegator
Finds GenericValues by the conditions specified in the EntityCondition object with no specified order.

Convenience method for calling OfBizDelegator.findByCondition(String, EntityCondition, Collection, List) with an empty orderBy list.

Specified by:
findByCondition in interface OfBizDelegator
Parameters:
entityName - The Name of the Entity as defined in the entity model XML file
entityCondition - The EntityCondition object that specifies how to constrain this query
fieldsToSelect - The fields of the named entity to get from the database; if empty or null all fields will be retreived
Returns:
List of GenericValue objects representing the search results

findByCondition

public List<org.ofbiz.core.entity.GenericValue> findByCondition(String entityName,
                                                                org.ofbiz.core.entity.EntityCondition entityCondition,
                                                                Collection fieldsToSelect,
                                                                List orderBy)
Description copied from interface: OfBizDelegator
Finds GenericValues by the conditions specified in the EntityCondition object.

Specified by:
findByCondition in interface OfBizDelegator
Parameters:
entityName - The Name of the Entity as defined in the entity model XML file
entityCondition - The EntityCondition object that specifies how to constrain this query
fieldsToSelect - The fields of the named entity to get from the database; if empty or null all fields will be retreived
orderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
Returns:
List of GenericValue objects representing the search results

bulkCopyColumnValuesByAnd

public int bulkCopyColumnValuesByAnd(String entityName,
                                     Map updateColumns,
                                     Map criteria)
Description copied from interface: OfBizDelegator
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.

Specified by:
bulkCopyColumnValuesByAnd in interface OfBizDelegator
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

getModelReader

public org.ofbiz.core.entity.model.ModelReader getModelReader()
Description copied from interface: OfBizDelegator
Returns a model reader that can be used to retrieve all the different entitynames configured in the entitymodel.

Specified by:
getModelReader in interface OfBizDelegator
Returns:
a ModelReader

refreshSequencer

public void refreshSequencer()
Description copied from interface: OfBizDelegator
Refreshes the sequencer that is used to retrieve unique IDs in the database.

Specified by:
refreshSequencer in interface OfBizDelegator


Copyright © 2002-2012 Atlassian. All Rights Reserved.