org.itracker.persistence.dao
Class IssueDAOImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.itracker.persistence.dao.BaseHibernateDAOImpl<Issue>
              extended by org.itracker.persistence.dao.IssueDAOImpl
All Implemented Interfaces:
BaseDAO<Issue>, IssueDAO, org.springframework.beans.factory.InitializingBean

public class IssueDAOImpl
extends BaseHibernateDAOImpl<Issue>
implements IssueDAO

Default implementation of IssueDAO using Hibernate.

Author:
ready

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
IssueDAOImpl()
           
 
Method Summary
 Long countAllIssues()
          Count all Issues in database
 Long countByComponent(Integer componentId)
          Counts the number of issues attached to a component.
 Long countByProject(Integer projectId)
          Counts the number of issues of the given project.
 Long countByProjectAndHigherStatus(Integer projectId, int minStatus)
          Counts the number of issues of the given project with a status higher than or equal to the given one.
 Long countByProjectAndLowerStatus(Integer projectId, int maxExclusiveStatus)
          Counts the number of issues of the given project with a status lower than the given one.
 Long countByVersion(Integer versionId)
          Counts the number of issues attached to a version.
 List<Issue> findAll()
          Finds all issues in all projects.
 List<Issue> findByComponent(Integer componentId)
          Finds all issues of the component with the given ID.
 List<Issue> findByCreator(Integer creatorId, int maxExclusiveStatus)
          Finds all issues created by the given user in all projects and with a status less than the given one.
 List<Issue> findByCreatorInAvailableProjects(Integer creatorId, int maxExclusiveStatus)
          Finds all issues created by the given user in all active and viewable projects and with a status less than the given one.
 List<Issue> findByNotification(Integer userId, int maxExclusiveStatus)
          Finds all issues with notifications for the given user in all projects and with a status less than the given one.
 List<Issue> findByNotificationInAvailableProjects(Integer userId, int maxExclusiveStatus)
          Finds all issues with notifications for the given user in active and viewable projects.
 List<Issue> findByOwner(Integer ownerId, int maxExclusiveStatus)
          Finds all issues owned by the given user in all projects and with a status lower than the given one.
 List<Issue> findByOwnerInAvailableProjects(Integer ownerId, int maxExclusiveStatus)
          Finds all issues owned by the given user in all active and viewable projects and with a status less than the given one.
 Issue findByPrimaryKey(Integer issueId)
          Finds the issue with the given ID.
 List<Issue> findByProject(Integer projectId)
          Finds all issues of the given project.
 List<Issue> findByProjectAndHigherStatus(Integer projectId, int status)
          Finds all issues of the given project with a status higher than or equal to the given one.
 List<Issue> findByProjectAndLowerStatus(Integer projectId, int maxExclusiveStatus)
          Finds all issues of the given project with a status lower than the given one.
 List<Issue> findBySeverity(int severity)
          Finds all issues with the given severity in all projects.
 List<Issue> findByStatus(int status)
          Finds all issues in the given status in all projects.
 List<Issue> findByStatusLessThan(int maxExclusiveStatus)
          Finds all issues with a status less than the given one in all projects.
 List<Issue> findByStatusLessThanEqualTo(int maxStatus)
          Finds all issues with a status less than or equal to the given status in all projects.
 List<Issue> findByStatusLessThanEqualToInAvailableProjects(int maxStatus)
          Finds all issues with a status less than or equal to the given status in active and viewable projects.
 List<Issue> findByTargetVersion(Integer versionId)
          Delete all issues targeted for the specified version.
 List<Issue> findByVersion(Integer versionId)
          Finds all issues of the version with the given ID.
 List<Issue> findUnassignedIssues(int maxStatus)
          Finds all issues without owner with a status less than or equal to the given one in all projects.
 ProjectDAO getProjectDAO()
           
 Date latestModificationDate(Integer projectId)
          Returns the modification date of the latest modified issue in the project with the given id.
 List<Issue> query(IssueSearchQuery searchQuery, User user, Map<Integer,Set<PermissionType>> userPermissions)
          It doens't really make sense for this method to receive projectDAO, it's just a quick fix for the fact that IssueSearchQuery handles ids and not objects
 void setProjectDAO(ProjectDAO projectDAO)
           
 
Methods inherited from class org.itracker.persistence.dao.BaseHibernateDAOImpl
delete, detach, merge, refresh, save, saveOrUpdate
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.itracker.persistence.dao.BaseDAO
delete, detach, merge, refresh, save, saveOrUpdate
 

Constructor Detail

IssueDAOImpl

public IssueDAOImpl()
Method Detail

findByPrimaryKey

public Issue findByPrimaryKey(Integer issueId)
Description copied from interface: IssueDAO
Finds the issue with the given ID.

PENDING: should this method throw a NoSuchEntityException instead of returning null if the issue doesn't exist ?

Specified by:
findByPrimaryKey in interface IssueDAO
Parameters:
issueId - ID of the issue to retrieve
Returns:
issue with the given ID or null if none exits

countAllIssues

public Long countAllIssues()
Description copied from interface: IssueDAO
Count all Issues in database

Specified by:
countAllIssues in interface IssueDAO
Returns:

findAll

public List<Issue> findAll()
Description copied from interface: IssueDAO
Finds all issues in all projects.

PENDING: do we really need to retrieve all issues at once ? It can cause OutOfMemoryError depending on the DB size! Consider scrolling through an issues result set in case we really do.

Specified by:
findAll in interface IssueDAO
Returns:
list of exiting issues, in an unspecified order

findByStatus

public List<Issue> findByStatus(int status)
Description copied from interface: IssueDAO
Finds all issues in the given status in all projects.

Specified by:
findByStatus in interface IssueDAO
Parameters:
status - status of the issues to return
Returns:
list of issues matching the above filter, in an unspecified order

findByStatusLessThan

public List<Issue> findByStatusLessThan(int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues with a status less than the given one in all projects.

Specified by:
findByStatusLessThan in interface IssueDAO
Parameters:
maxExclusiveStatus - all issues under this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findByStatusLessThanEqualTo

public List<Issue> findByStatusLessThanEqualTo(int maxStatus)
Description copied from interface: IssueDAO
Finds all issues with a status less than or equal to the given status in all projects.

Specified by:
findByStatusLessThanEqualTo in interface IssueDAO
Parameters:
maxStatus - all issues less that or equal to this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findByStatusLessThanEqualToInAvailableProjects

public List<Issue> findByStatusLessThanEqualToInAvailableProjects(int maxStatus)
Description copied from interface: IssueDAO
Finds all issues with a status less than or equal to the given status in active and viewable projects.

Specified by:
findByStatusLessThanEqualToInAvailableProjects in interface IssueDAO
Parameters:
maxStatus - all issues less that or equal to this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findBySeverity

public List<Issue> findBySeverity(int severity)
Description copied from interface: IssueDAO
Finds all issues with the given severity in all projects.

Specified by:
findBySeverity in interface IssueDAO
Parameters:
severity - severity of the issues to return
Returns:
list of issues matching the above filter, in an unspecified order

findByProject

public List<Issue> findByProject(Integer projectId)
Description copied from interface: IssueDAO
Finds all issues of the given project.

Specified by:
findByProject in interface IssueDAO
Parameters:
projectId - ID of the project of which to retrieve all issues
Returns:
list of issues in no particular order

countByProject

public Long countByProject(Integer projectId)
Description copied from interface: IssueDAO
Counts the number of issues of the given project.

Specified by:
countByProject in interface IssueDAO
Parameters:
projectId - ID of the project of which to count issues
Returns:
number of issues

findByProjectAndLowerStatus

public List<Issue> findByProjectAndLowerStatus(Integer projectId,
                                               int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues of the given project with a status lower than the given one.

Specified by:
findByProjectAndLowerStatus in interface IssueDAO
Parameters:
projectId - ID of the project of which to retrieve the issues
maxExclusiveStatus - all issues under this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

countByProjectAndLowerStatus

public Long countByProjectAndLowerStatus(Integer projectId,
                                         int maxExclusiveStatus)
Description copied from interface: IssueDAO
Counts the number of issues of the given project with a status lower than the given one.

Specified by:
countByProjectAndLowerStatus in interface IssueDAO
Parameters:
projectId - ID of the project of which to count issues
maxExclusiveStatus - all issues under this status will be counted
Returns:
number of issues

findByProjectAndHigherStatus

public List<Issue> findByProjectAndHigherStatus(Integer projectId,
                                                int status)
Description copied from interface: IssueDAO
Finds all issues of the given project with a status higher than or equal to the given one.

Specified by:
findByProjectAndHigherStatus in interface IssueDAO
Parameters:
projectId - ID of the project of which to retrieve the issues
status - all issues with this status or above will be returned
Returns:
list of issues matching the above filter, in an unspecified order

countByProjectAndHigherStatus

public Long countByProjectAndHigherStatus(Integer projectId,
                                          int minStatus)
Description copied from interface: IssueDAO
Counts the number of issues of the given project with a status higher than or equal to the given one.

Specified by:
countByProjectAndHigherStatus in interface IssueDAO
Parameters:
projectId - ID of the project of which to count issues
minStatus - all issues with this status or above will be counted
Returns:
number of issues

findByOwner

public List<Issue> findByOwner(Integer ownerId,
                               int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues owned by the given user in all projects and with a status lower than the given one.

Specified by:
findByOwner in interface IssueDAO
Parameters:
ownerId - ID of the user who owns the issues to return
maxExclusiveStatus - status under which to return issues
Returns:
list of issues matching the above filter, in an unspecified order

findByOwnerInAvailableProjects

public List<Issue> findByOwnerInAvailableProjects(Integer ownerId,
                                                  int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues owned by the given user in all active and viewable projects and with a status less than the given one.

Specified by:
findByOwnerInAvailableProjects in interface IssueDAO
Parameters:
ownerId - ID of the user who owns the issues to return
maxExclusiveStatus - status under which to return issues
Returns:
list of issues matching the above filter, in an unspecified order

findUnassignedIssues

public List<Issue> findUnassignedIssues(int maxStatus)
Description copied from interface: IssueDAO
Finds all issues without owner with a status less than or equal to the given one in all projects.

Specified by:
findUnassignedIssues in interface IssueDAO
Parameters:
maxStatus - maximum status allowed for the issues to return
Returns:
list of issues matching the above filter, in an unspecified order

findByCreator

public List<Issue> findByCreator(Integer creatorId,
                                 int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues created by the given user in all projects and with a status less than the given one.

Specified by:
findByCreator in interface IssueDAO
maxExclusiveStatus - all issues under this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findByCreatorInAvailableProjects

public List<Issue> findByCreatorInAvailableProjects(Integer creatorId,
                                                    int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues created by the given user in all active and viewable projects and with a status less than the given one.

Specified by:
findByCreatorInAvailableProjects in interface IssueDAO
maxExclusiveStatus - all issues under this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findByNotification

public List<Issue> findByNotification(Integer userId,
                                      int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues with notifications for the given user in all projects and with a status less than the given one.

Only 1 instance of every issue is returned, even if multiple notifications exist for an issue.

Specified by:
findByNotification in interface IssueDAO
Parameters:
userId - ID of the user with notifications for the issues to return
maxExclusiveStatus - all issues under this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findByNotificationInAvailableProjects

public List<Issue> findByNotificationInAvailableProjects(Integer userId,
                                                         int maxExclusiveStatus)
Description copied from interface: IssueDAO
Finds all issues with notifications for the given user in active and viewable projects.

Only 1 instance of every issue is returned, even if multiple notifications exist for an issue.

Specified by:
findByNotificationInAvailableProjects in interface IssueDAO
Parameters:
userId - ID of the user with notifications for the issues to return
maxExclusiveStatus - all issues under this status will be returned
Returns:
list of issues matching the above filter, in an unspecified order

findByComponent

public List<Issue> findByComponent(Integer componentId)
Description copied from interface: IssueDAO
Finds all issues of the component with the given ID.

Specified by:
findByComponent in interface IssueDAO
Parameters:
componentId - ID of the component of which to retrieve all issues
Returns:
list of issues in no particular order

countByComponent

public Long countByComponent(Integer componentId)
Description copied from interface: IssueDAO
Counts the number of issues attached to a component.

Specified by:
countByComponent in interface IssueDAO
Parameters:
componentId - ID of the component
Returns:
number of issues

findByVersion

public List<Issue> findByVersion(Integer versionId)
Description copied from interface: IssueDAO
Finds all issues of the version with the given ID.

Specified by:
findByVersion in interface IssueDAO
Parameters:
versionId - ID of the version of which to retrieve all issues
Returns:
list of issues in no particular order

countByVersion

public Long countByVersion(Integer versionId)
Description copied from interface: IssueDAO
Counts the number of issues attached to a version.

Specified by:
countByVersion in interface IssueDAO
Parameters:
versionId - ID of the version
Returns:
number of issues

latestModificationDate

public Date latestModificationDate(Integer projectId)
Description copied from interface: IssueDAO
Returns the modification date of the latest modified issue in the project with the given id.

Specified by:
latestModificationDate in interface IssueDAO
Parameters:
projectId - ID of the project of which to retrieve the issues
Returns:
date of the most recent issue modification for the project. null if no issue exists in the project

query

public List<Issue> query(IssueSearchQuery searchQuery,
                         User user,
                         Map<Integer,Set<PermissionType>> userPermissions)
It doens't really make sense for this method to receive projectDAO, it's just a quick fix for the fact that IssueSearchQuery handles ids and not objects

Specified by:
query in interface IssueDAO
Parameters:
searchQuery - The search criteria.
user - The currently logged-in user.
userPermissions - Permissions currently inforced. TODO: We could look this up instead of passing this as parameter.
Returns:

getProjectDAO

public ProjectDAO getProjectDAO()

setProjectDAO

public void setProjectDAO(ProjectDAO projectDAO)

findByTargetVersion

public List<Issue> findByTargetVersion(Integer versionId)
Delete all issues targeted for the specified version.

Specified by:
findByTargetVersion in interface IssueDAO
Parameters:
versionId - the version ID.
Returns:


Copyright © 2002-2012 itracker. All Rights Reserved.