com.atlassian.jira.ofbiz
Interface OfBizDelegator

All Known Implementing Classes:
DefaultOfBizDelegator, LockedDatabaseOfBizDelegator

public interface OfBizDelegator

A wrapper around DelegatorInterface that does not throw GenericEntityException.


Field Summary
static java.lang.String ISSUE_LINK
           
static java.lang.String ISSUE_LINK_TYPE
           
static java.lang.String PROJECT_COMPONENT
           
static java.lang.String VERSION
           
 
Method Summary
 int bulkCopyColumnValuesByAnd(java.lang.String entityName, java.util.Map updateColumns, java.util.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(java.lang.String entityName, java.util.Map updateValues, java.util.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(java.lang.String entityName, java.util.Map<java.lang.String,?> updateValues, java.util.List<java.lang.Long> 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(java.lang.String entityName, java.util.Map<java.lang.String,java.lang.Object> fields)
          Creates a new GenericValue, and persists it.
 java.util.List<org.ofbiz.core.entity.GenericValue> findAll(java.lang.String s)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> findAll(java.lang.String s, java.util.List<java.lang.String> orderBy)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> findByAnd(java.lang.String entityName, java.util.List<org.ofbiz.core.entity.EntityCondition> expressions)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> findByAnd(java.lang.String entityName, java.util.Map<java.lang.String,?> fields)
          Finds GenericValue records by all of the specified fields (ie: combined using AND).
 java.util.List<org.ofbiz.core.entity.GenericValue> findByAnd(java.lang.String entityName, java.util.Map<java.lang.String,?> fields, java.util.List<java.lang.String> orderBy)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> findByCondition(java.lang.String entityName, org.ofbiz.core.entity.EntityCondition entityCondition, java.util.Collection<java.lang.String> fieldsToSelect)
          Finds GenericValues by the conditions specified in the EntityCondition object with no specified order.
 java.util.List<org.ofbiz.core.entity.GenericValue> findByCondition(java.lang.String entityName, org.ofbiz.core.entity.EntityCondition entityCondition, java.util.Collection<java.lang.String> fieldsToSelect, java.util.List<java.lang.String> orderBy)
          Finds GenericValues by the conditions specified in the EntityCondition object.
 java.util.List<org.ofbiz.core.entity.GenericValue> findByField(java.lang.String entityName, java.lang.String fieldName, java.lang.Object fieldValue)
          Finds GenericValue records by the specified field value.
 java.util.List<org.ofbiz.core.entity.GenericValue> findByField(java.lang.String entityName, java.lang.String fieldName, java.lang.Object fieldValue, java.lang.String orderBy)
          Finds GenericValue records by the specified field value.
 java.util.List<org.ofbiz.core.entity.GenericValue> findByLike(java.lang.String entityName, java.util.Map<java.lang.String,?> map)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> findByLike(java.lang.String entityName, java.util.Map<java.lang.String,?> map, java.util.List<java.lang.String> orderBy)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> findByOr(java.lang.String entityName, java.util.List<? extends org.ofbiz.core.entity.EntityCondition> expressions, java.util.List<java.lang.String> orderBy)
           
 org.ofbiz.core.entity.GenericValue findByPrimaryKey(java.lang.String entityName, java.lang.Long id)
          Find a Generic Entity by its single numeric Primary Key.
 org.ofbiz.core.entity.GenericValue findByPrimaryKey(java.lang.String entityName, java.util.Map<java.lang.String,?> fields)
          Find a Generic Entity by its Primary Key.
 OfBizListIterator findListIteratorByCondition(java.lang.String entityType, org.ofbiz.core.entity.EntityCondition condition)
           
 OfBizListIterator findListIteratorByCondition(java.lang.String entityName, org.ofbiz.core.entity.EntityCondition whereEntityCondition, org.ofbiz.core.entity.EntityCondition havingEntityCondition, java.util.Collection<java.lang.String> fieldsToSelect, java.util.List<java.lang.String> orderBy, org.ofbiz.core.entity.EntityFindOptions entityFindOptions)
           
 long getCount(java.lang.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.
 java.util.List<org.ofbiz.core.entity.GenericValue> getRelated(java.lang.String relationName, org.ofbiz.core.entity.GenericValue gv)
           
 org.ofbiz.core.entity.GenericValue makeValue(java.lang.String entityName)
          Creates an Entity in the form of a GenericValue without persisting it.
 void removeAll(java.util.List<org.ofbiz.core.entity.GenericValue> genericValues)
           
 int removeByAnd(java.lang.String s, java.util.Map<java.lang.String,?> map)
           
 int removeByOr(java.lang.String entityName, java.lang.String entityId, java.util.List<java.lang.Long> 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(java.util.List<org.ofbiz.core.entity.GenericValue> genericValues)
           
 

Field Detail

VERSION

static final java.lang.String VERSION
See Also:
Constant Field Values

ISSUE_LINK

static final java.lang.String ISSUE_LINK
See Also:
Constant Field Values

ISSUE_LINK_TYPE

static final java.lang.String ISSUE_LINK_TYPE
See Also:
Constant Field Values

PROJECT_COMPONENT

static final java.lang.String PROJECT_COMPONENT
See Also:
Constant Field Values
Method Detail

findByField

java.util.List<org.ofbiz.core.entity.GenericValue> findByField(java.lang.String entityName,
                                                               java.lang.String fieldName,
                                                               java.lang.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
Throws:
DataAccessException - If an error occurs in the persistence layer.

findByField

java.util.List<org.ofbiz.core.entity.GenericValue> findByField(java.lang.String entityName,
                                                               java.lang.String fieldName,
                                                               java.lang.Object fieldValue,
                                                               java.lang.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
Throws:
DataAccessException - If an error occurs in the persistence layer.

findByAnd

java.util.List<org.ofbiz.core.entity.GenericValue> findByAnd(java.lang.String entityName,
                                                             java.util.Map<java.lang.String,?> fields)
                                                             throws DataAccessException
Finds GenericValue records by all of the specified fields (ie: combined using AND).

Parameters:
entityName - The Name of the Entity as defined in the entity XML file
fields - 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

java.util.List<org.ofbiz.core.entity.GenericValue> findByAnd(java.lang.String entityName,
                                                             java.util.Map<java.lang.String,?> fields,
                                                             java.util.List<java.lang.String> orderBy)
                                                             throws DataAccessException
Throws:
DataAccessException

findByAnd

java.util.List<org.ofbiz.core.entity.GenericValue> findByAnd(java.lang.String entityName,
                                                             java.util.List<org.ofbiz.core.entity.EntityCondition> expressions)
                                                             throws DataAccessException
Throws:
DataAccessException

findByOr

java.util.List<org.ofbiz.core.entity.GenericValue> findByOr(java.lang.String entityName,
                                                            java.util.List<? extends org.ofbiz.core.entity.EntityCondition> expressions,
                                                            java.util.List<java.lang.String> orderBy)
                                                            throws DataAccessException
Throws:
DataAccessException

findByLike

java.util.List<org.ofbiz.core.entity.GenericValue> findByLike(java.lang.String entityName,
                                                              java.util.Map<java.lang.String,?> map)
                                                              throws DataAccessException
Throws:
DataAccessException

findByLike

java.util.List<org.ofbiz.core.entity.GenericValue> findByLike(java.lang.String entityName,
                                                              java.util.Map<java.lang.String,?> map,
                                                              java.util.List<java.lang.String> orderBy)
                                                              throws DataAccessException
Throws:
DataAccessException

removeAll

void removeAll(java.util.List<org.ofbiz.core.entity.GenericValue> genericValues)
               throws DataAccessException
Throws:
DataAccessException

removeByAnd

int removeByAnd(java.lang.String s,
                java.util.Map<java.lang.String,?> map)
                throws DataAccessException
Throws:
DataAccessException

removeValue

int removeValue(org.ofbiz.core.entity.GenericValue value)
                throws DataAccessException
Throws:
DataAccessException

storeAll

void storeAll(java.util.List<org.ofbiz.core.entity.GenericValue> genericValues)
              throws DataAccessException
Throws:
DataAccessException

findAll

java.util.List<org.ofbiz.core.entity.GenericValue> findAll(java.lang.String s)
                                                           throws DataAccessException
Throws:
DataAccessException

findAll

java.util.List<org.ofbiz.core.entity.GenericValue> findAll(java.lang.String s,
                                                           java.util.List<java.lang.String> orderBy)
                                                           throws DataAccessException
Throws:
DataAccessException

store

void store(org.ofbiz.core.entity.GenericValue gv)
           throws DataAccessException
Throws:
DataAccessException

createValue

org.ofbiz.core.entity.GenericValue createValue(java.lang.String entityName,
                                               java.util.Map<java.lang.String,java.lang.Object> fields)
                                               throws DataAccessException
Creates a new GenericValue, and persists it. If there is no "id" in the field values, one is created using the entity sequence.

Parameters:
entityName - the entity name.
fields - field values
Returns:
The new GenericValue.
Throws:
DataAccessException - if an error occurs in the Database layer
See Also:
makeValue(String)

makeValue

org.ofbiz.core.entity.GenericValue makeValue(java.lang.String entityName)
Creates an Entity in the form of a GenericValue without persisting it.

Parameters:
entityName - the entity name.
Returns:
The new GenericValue.
See Also:
createValue(String, java.util.Map)

findByPrimaryKey

org.ofbiz.core.entity.GenericValue findByPrimaryKey(java.lang.String entityName,
                                                    java.lang.Long id)
                                                    throws DataAccessException
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:
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 primary key
Throws:
DataAccessException - DataAccessException
See Also:
findByPrimaryKey(String, java.util.Map)

findByPrimaryKey

org.ofbiz.core.entity.GenericValue findByPrimaryKey(java.lang.String entityName,
                                                    java.util.Map<java.lang.String,?> fields)
                                                    throws DataAccessException
Find a Generic Entity by its Primary Key.

Parameters:
entityName - The Name of the Entity as defined in the entity XML file
fields - The field/value pairs of the primary key (in JIRA, mostly just a single field "id")
Returns:
The GenericValue corresponding to the primary key
Throws:
DataAccessException - DataAccessException
See Also:
findByPrimaryKey(String, Long)

getRelated

java.util.List<org.ofbiz.core.entity.GenericValue> getRelated(java.lang.String relationName,
                                                              org.ofbiz.core.entity.GenericValue gv)
                                                              throws DataAccessException
Throws:
DataAccessException

getCount

long getCount(java.lang.String entityName)
              throws DataAccessException
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
Throws:
DataAccessException - if data access problems occur

findListIteratorByCondition

OfBizListIterator findListIteratorByCondition(java.lang.String entityType,
                                              org.ofbiz.core.entity.EntityCondition condition)
                                              throws DataAccessException
Throws:
DataAccessException

findListIteratorByCondition

OfBizListIterator findListIteratorByCondition(java.lang.String entityName,
                                              org.ofbiz.core.entity.EntityCondition whereEntityCondition,
                                              org.ofbiz.core.entity.EntityCondition havingEntityCondition,
                                              java.util.Collection<java.lang.String> fieldsToSelect,
                                              java.util.List<java.lang.String> orderBy,
                                              org.ofbiz.core.entity.EntityFindOptions entityFindOptions)
                                              throws DataAccessException
Throws:
DataAccessException

bulkUpdateByPrimaryKey

int bulkUpdateByPrimaryKey(java.lang.String entityName,
                           java.util.Map<java.lang.String,?> updateValues,
                           java.util.List<java.lang.Long> keys)
                           throws DataAccessException
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.

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
Throws:
DataAccessException - If an error occurs in the persistence layer.

bulkUpdateByAnd

int bulkUpdateByAnd(java.lang.String entityName,
                    java.util.Map updateValues,
                    java.util.Map criteria)
                    throws DataAccessException
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 - 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
Throws:
DataAccessException - If an error occurs in the persistence layer.

bulkCopyColumnValuesByAnd

int bulkCopyColumnValuesByAnd(java.lang.String entityName,
                              java.util.Map updateColumns,
                              java.util.Map criteria)
                              throws DataAccessException
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
Throws:
DataAccessException - If an error occurs in the persistence layer.

removeByOr

int removeByOr(java.lang.String entityName,
               java.lang.String entityId,
               java.util.List<java.lang.Long> ids)
               throws DataAccessException,
                      org.ofbiz.core.entity.GenericModelException
This can be used to remove rows for a given entity based on entityName and where entityId
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
Throws:
org.ofbiz.core.entity.GenericModelException - if the given entityId is not valid for the given entity
DataAccessException - if there are problems executing/accessing the data store

findByCondition

java.util.List<org.ofbiz.core.entity.GenericValue> findByCondition(java.lang.String entityName,
                                                                   org.ofbiz.core.entity.EntityCondition entityCondition,
                                                                   java.util.Collection<java.lang.String> fieldsToSelect,
                                                                   java.util.List<java.lang.String> orderBy)
                                                                   throws DataAccessException
Finds GenericValues by the conditions specified in the EntityCondition object.

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
Throws:
DataAccessException - If an error occurs in the persistence layer.
Since:
v3.12

findByCondition

java.util.List<org.ofbiz.core.entity.GenericValue> findByCondition(java.lang.String entityName,
                                                                   org.ofbiz.core.entity.EntityCondition entityCondition,
                                                                   java.util.Collection<java.lang.String> fieldsToSelect)
                                                                   throws DataAccessException
Finds GenericValues by the conditions specified in the EntityCondition object with no specified order.

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

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
Throws:
DataAccessException - If an error occurs in the persistence layer.
Since:
v4.1


Copyright © 2002-2010 Atlassian. All Rights Reserved.