com.atlassian.jira.bc.project.component
Class OfBizProjectComponentStore

java.lang.Object
  extended by com.atlassian.jira.bc.project.component.OfBizProjectComponentStore
All Implemented Interfaces:
ProjectComponentStore

public class OfBizProjectComponentStore
extends java.lang.Object
implements ProjectComponentStore

Ofbiz non-caching implementation of ProjectComponentStore. CachingProjectComponentStore


Field Summary
static org.apache.log4j.Logger log
           
 
Constructor Summary
OfBizProjectComponentStore(OfBizDelegator delegator)
          Create a new instance of the class backed by the delegator specified.
 
Method Summary
 boolean containsName(java.lang.String name, java.lang.Long projectId)
          Check whether component with specified name is stored.
 void delete(java.lang.Long componentId)
          Remove the given component from the persistent storage.
 MutableProjectComponent find(java.lang.Long id)
          Retrieve the MutableProjectComponent with the specified ID.
 java.util.Collection findAll()
          Retrieve all ProjectComponent objects stored and sort by name.
 java.util.Collection findAllForProject(java.lang.Long projectId)
          Retrieve all components that are related to the project with given ID and sort by name.
 MutableProjectComponent findByComponentName(java.lang.Long projectId, java.lang.String componentName)
          Finds the ProjectComponent with the given name (case sensitive) in the project with the given Id.
 java.util.Collection<MutableProjectComponent> findByComponentNameCaseInSensitive(java.lang.String componentName)
          Finds the ProjectComponents with the given name (case insensitive) in all projects.
 java.util.Collection findComponentsBylead(java.lang.String userName)
          Retrieve a collection of components - where the lead of each component is the specified user.
 java.lang.Long findProjectIdForComponent(java.lang.Long componentId)
          Retrieve the project ID for the given component ID.
protected  ComponentConverter getComponentConverter()
           
 MutableProjectComponent store(MutableProjectComponent component)
          Persists the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.log4j.Logger log
Constructor Detail

OfBizProjectComponentStore

public OfBizProjectComponentStore(OfBizDelegator delegator)
Create a new instance of the class backed by the delegator specified.

Parameters:
delegator - persistent store manager
Method Detail

find

public MutableProjectComponent find(java.lang.Long id)
                             throws EntityNotFoundException
Retrieve the MutableProjectComponent with the specified ID. An EntityNotFoundException is thrown if the component is not found.

Specified by:
find in interface ProjectComponentStore
Parameters:
id - component ID to search for
Returns:
MutableProjectComponent component with the specified ID
Throws:
EntityNotFoundException - if the component is not found

findAllForProject

public java.util.Collection findAllForProject(java.lang.Long projectId)
Retrieve all components that are related to the project with given ID and sort by name.

Specified by:
findAllForProject in interface ProjectComponentStore
Parameters:
projectId - project ID
Returns:
a collection of ProjectComponent objects that are related to the project with given ID

getComponentConverter

protected ComponentConverter getComponentConverter()

findByComponentName

public MutableProjectComponent findByComponentName(java.lang.Long projectId,
                                                   java.lang.String componentName)
                                            throws java.lang.IllegalArgumentException
Description copied from interface: ProjectComponentStore
Finds the ProjectComponent with the given name (case sensitive) in the project with the given Id.

Specified by:
findByComponentName in interface ProjectComponentStore
Parameters:
projectId - the id of the component's project.
componentName - the name of the component to find.
Returns:
a MutableProjectComponent or null if none found.
Throws:
java.lang.IllegalArgumentException

findByComponentNameCaseInSensitive

public java.util.Collection<MutableProjectComponent> findByComponentNameCaseInSensitive(java.lang.String componentName)
Description copied from interface: ProjectComponentStore
Finds the ProjectComponents with the given name (case insensitive) in all projects.

Specified by:
findByComponentNameCaseInSensitive in interface ProjectComponentStore
Parameters:
componentName - the name of the component to find.
Returns:
All MutableProjectComponents with the given name or an empty list if none found.

findProjectIdForComponent

public java.lang.Long findProjectIdForComponent(java.lang.Long componentId)
                                         throws EntityNotFoundException
Retrieve the project ID for the given component ID. If project is not found, a EntityNotFoundException is thrown.

Specified by:
findProjectIdForComponent in interface ProjectComponentStore
Parameters:
componentId - component ID
Returns:
project ID
Throws:
EntityNotFoundException - if component not found for the given component ID

store

public MutableProjectComponent store(MutableProjectComponent component)
                              throws EntityNotFoundException,
                                     DataAccessException
Persists the component. If component has no ID (null), it is inserted in the store, otherwise an update operation is performed on the store.

Specified by:
store in interface ProjectComponentStore
Parameters:
component - component to persist
Returns:
persisted project component
Throws:
EntityNotFoundException - in case of update if the component does not exist (maybe was deleted :-)
DataAccessException - if cannot persist the component

delete

public void delete(java.lang.Long componentId)
            throws EntityNotFoundException
Description copied from interface: ProjectComponentStore
Remove the given component from the persistent storage.

Specified by:
delete in interface ProjectComponentStore
Parameters:
componentId - ID of the component.
Throws:
EntityNotFoundException - if component does not exist (maybe was removed previously).

containsName

public boolean containsName(java.lang.String name,
                            java.lang.Long projectId)
Check whether component with specified name is stored.

Specified by:
containsName in interface ProjectComponentStore
Parameters:
name - component name, null will cause IllegalArgumentException
projectId - project ID
Returns:
true if new name is stored
Throws:
java.lang.IllegalArgumentException - if name or projectId is null

findComponentsBylead

public java.util.Collection findComponentsBylead(java.lang.String userName)
Retrieve a collection of components - where the lead of each component is the specified user.

Specified by:
findComponentsBylead in interface ProjectComponentStore
Parameters:
userName - the lead user name
Returns:
collection of components - where the lead of each component is the specified user

findAll

public java.util.Collection findAll()
Retrieve all ProjectComponent objects stored and sort by name.

Specified by:
findAll in interface ProjectComponentStore
Returns:
all ProjectComponent objects stored


Copyright © 2002-2010 Atlassian. All Rights Reserved.