com.atlassian.greenhopper.service.backlog
Class BacklogDao

java.lang.Object
  extended by com.atlassian.greenhopper.service.backlog.BacklogDao

@Service(value="gh-backlogDao")
public class BacklogDao
extends java.lang.Object

Handles all database access for Backlog objects.

Author:
ahennecke

Field Summary
static java.lang.String SERVICE
           
 
Constructor Summary
BacklogDao()
           
 
Method Summary
 void create(Backlog backlog)
          The given Backlog instance is persisted into the database.
 void delete(Backlog backlog)
          Delete the given Backlog record.
 void deleteAll(XProject xproject)
          Delete all records for an XProject.
 java.util.SortedSet<Backlog> findBy(XProject xproject)
           
 java.util.SortedSet<Backlog> findBy(XProject xproject, Backlog.Status... statuses)
           
 java.util.SortedSet<Backlog> findBy(XProject xproject, Backlog.Type type)
           
 java.util.SortedSet<Backlog> findByName(java.lang.String name)
           
 java.util.SortedSet<Backlog> getAll()
           
 Backlog getUnscheduled(XProject xproject)
           
 Backlog load(java.lang.Long id)
          Load a Backlog for the given ID.
 void save(Backlog backlog)
          Saves an existing Backlog to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE

public static final java.lang.String SERVICE
See Also:
Constant Field Values
Constructor Detail

BacklogDao

public BacklogDao()
Method Detail

load

public Backlog load(java.lang.Long id)
Load a Backlog for the given ID. No permission checking is done here.

Returns:
Backlog entity for the given ID or null if none is found
Throws:
java.lang.IllegalArgumentException - if either parameter is null

create

public void create(Backlog backlog)
The given Backlog instance is persisted into the database. A new ID will be generated and added to the instance, so once this method returns, expect the ID to be present, e.g. for consecutive save operations.

Throws:
com.atlassian.jira.exception.DataAccessException - If for any reason a record with the new ID already exists

save

public void save(Backlog backlog)
Saves an existing Backlog to the database. Previously existing data will be overwritten, not merged, so callers must ensure that the state is current.

Throws:
java.lang.IllegalArgumentException - if the XProject has no ID
com.atlassian.jira.exception.DataAccessException - if the record we're trying to save no longer exists

delete

public void delete(Backlog backlog)
Delete the given Backlog record. If there is no such record, nothing will happen.

Throws:
java.lang.IllegalArgumentException - if backlog or its ID are null

deleteAll

public void deleteAll(XProject xproject)
Delete all records for an XProject. If there is no such record, nothing will happen.

Throws:
java.lang.IllegalArgumentException - if xproject or its ID is null

findBy

public java.util.SortedSet<Backlog> findBy(XProject xproject)
Returns:
A set of backlogs for the given XProject, or an empty set if there are none.

findBy

public java.util.SortedSet<Backlog> findBy(XProject xproject,
                                           Backlog.Type type)
Returns:
A set of backlogs for the given XProject with the given type, or an empty set if there are none.

findBy

public java.util.SortedSet<Backlog> findBy(XProject xproject,
                                           Backlog.Status... statuses)
Returns:
A set of backlogs for the given XProject with the given status(es), or an empty set if there are none.

getUnscheduled

public Backlog getUnscheduled(XProject xproject)
Returns:
The unscheduled backlog for a given XProject. Note that this method will throw an error if not exactly one unscheduled backlog exists

findByName

public java.util.SortedSet<Backlog> findByName(java.lang.String name)
Returns:
all backlogs that match the given name, across all XProjects. No permission checking is done here. If name is null, expect an empty set (unless someone managed to get a record with a null name in).

getAll

public java.util.SortedSet<Backlog> getAll()
Returns:
all backlog entries across all XProjects. No permission checking is done here.


Copyright © 2007-2011 Atlassian. All Rights Reserved.