com.atlassian.greenhopper.service.project
Interface XProjectService

All Known Implementing Classes:
XProjectServiceImpl

public interface XProjectService

Service to create, query, update and delete XProject entities.


Field Summary
static java.lang.String SERVICE
          Service identifier, used for dependency injection.
 
Method Summary
 ErrorCollection create(com.opensymphony.user.User user, XProject xproject)
          Create a new XProject given the XProject object.
 ErrorCollection delete(com.opensymphony.user.User user, java.lang.Long id)
          Delete the XProject.
 XProject findBy(com.opensymphony.user.User user, com.atlassian.jira.project.Project project)
          Get a XProject for a given project
 XProject get(com.opensymphony.user.User user, java.lang.Long id)
          Fetch an xproject for a given id.
 java.util.SortedSet<XProject> getAll(com.opensymphony.user.User user, int permission, boolean mustMatchAllProjects)
          Get all XProjects stored in the system for which the user has given permission
 java.util.SortedSet<XProject> getAllBrowsable(com.opensymphony.user.User user)
          Get all browsable projects for a given user.
 com.atlassian.jira.project.Project getFirstProject(com.opensymphony.user.User user, XProject xproject)
           
 java.util.SortedSet<com.atlassian.jira.project.Project> getProjectsSortedByName(XProject xproject, java.util.Locale locale)
           
 boolean isAdmin(com.opensymphony.user.User user, XProject xproject)
          Does the user have project admin rights for the passed project.
 boolean isBrowsable(com.opensymphony.user.User user, XProject xproject)
          Is the passed XProject browsable by the user
 ErrorCollection save(com.opensymphony.user.User user, XProject xproject)
          Save changes made to an XProject object.
 

Field Detail

SERVICE

static final java.lang.String SERVICE
Service identifier, used for dependency injection.

See Also:
Constant Field Values
Method Detail

create

ErrorCollection create(com.opensymphony.user.User user,
                       XProject xproject)
Create a new XProject given the XProject object. If successful the passed in xproject will hold an id after the method call.

Parameters:
user -
xproject - the xproject with a non-empty name and a set of projects associated with it
Returns:
an ErrorCollection containing validation errors. The xproject has been persisted ok if the collection is empty.

save

ErrorCollection save(com.opensymphony.user.User user,
                     XProject xproject)
Save changes made to an XProject object.

Returns:
an ErrorCollection containing validation errors. The xproject has been successfully persisted if the collection is empty.

delete

ErrorCollection delete(com.opensymphony.user.User user,
                       java.lang.Long id)
Delete the XProject. This will not remove the associated JIRA projects, but all Backlogs will be removed.

Returns:
an ErrorCollection containing validation errors. The xproject has been successfully deleted if the collection is empty.

get

XProject get(com.opensymphony.user.User user,
             java.lang.Long id)
Fetch an xproject for a given id.

Returns:
an XProject or null if not found

findBy

XProject findBy(com.opensymphony.user.User user,
                com.atlassian.jira.project.Project project)
Get a XProject for a given project

Returns:
the XProject the passed in project is part of or null if project is not assigned or the user does not have browse permission.

getAll

java.util.SortedSet<XProject> getAll(com.opensymphony.user.User user,
                                     int permission,
                                     boolean mustMatchAllProjects)
Get all XProjects stored in the system for which the user has given permission

Parameters:
mustMatchAllProjects - if true then the permission must apply to all projects contained in the XProject, otherwise true is returned if the user matches at least one of the projects.
Returns:
A set of XProjects

getAllBrowsable

java.util.SortedSet<XProject> getAllBrowsable(com.opensymphony.user.User user)
Get all browsable projects for a given user.

Parameters:
user - the user to search browsable projects for
Returns:
a set of XProjects

isBrowsable

boolean isBrowsable(com.opensymphony.user.User user,
                    XProject xproject)
Is the passed XProject browsable by the user


isAdmin

boolean isAdmin(com.opensymphony.user.User user,
                XProject xproject)
Does the user have project admin rights for the passed project.


getProjectsSortedByName

java.util.SortedSet<com.atlassian.jira.project.Project> getProjectsSortedByName(XProject xproject,
                                                                                java.util.Locale locale)
Returns:
a view on the projects, sorted by their name. JIRA project names are unique and not null. The sorting is locale-specific collator-based and takes things like upper/lowercase into account.

getFirstProject

com.atlassian.jira.project.Project getFirstProject(com.opensymphony.user.User user,
                                                   XProject xproject)
Returns:
the JIRA project that alphabetically comes first


Copyright © 2007-2011 Atlassian. All Rights Reserved.