com.atlassian.greenhopper.service.project
Class XProjectServiceImpl

java.lang.Object
  extended by com.atlassian.greenhopper.service.project.XProjectServiceImpl
All Implemented Interfaces:
XProjectService

@Service(value="gh-xProjectService")
public class XProjectServiceImpl
extends java.lang.Object
implements XProjectService


Field Summary
 
Fields inherited from interface com.atlassian.greenhopper.service.project.XProjectService
SERVICE
 
Constructor Summary
XProjectServiceImpl()
           
 
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)
          Find a XProject given an assigned 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)
          Shortcut to getAll as many places require this.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XProjectServiceImpl

public XProjectServiceImpl()
Method Detail

create

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

Specified by:
create in interface XProjectService
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

public ErrorCollection save(com.opensymphony.user.User user,
                            XProject xproject)
Description copied from interface: XProjectService
Save changes made to an XProject object.

Specified by:
save in interface XProjectService
Returns:
an ErrorCollection containing validation errors. The xproject has been successfully persisted if the collection is empty.

delete

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

Specified by:
delete in interface XProjectService
Returns:
an ErrorCollection containing validation errors. The xproject has been successfully deleted if the collection is empty.

get

public XProject get(com.opensymphony.user.User user,
                    java.lang.Long id)
Description copied from interface: XProjectService
Fetch an xproject for a given id.

Specified by:
get in interface XProjectService
Returns:
an XProject or null if not found

findBy

public XProject findBy(com.opensymphony.user.User user,
                       com.atlassian.jira.project.Project project)
Find a XProject given an assigned Project.

Specified by:
findBy in interface XProjectService
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

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

Specified by:
getAll in interface XProjectService
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

public java.util.SortedSet<XProject> getAllBrowsable(com.opensymphony.user.User user)
Shortcut to getAll as many places require this.

Specified by:
getAllBrowsable in interface XProjectService
Parameters:
user - the user to search browsable projects for
Returns:
a set of XProjects

isBrowsable

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

Specified by:
isBrowsable in interface XProjectService

isAdmin

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

Specified by:
isAdmin in interface XProjectService

getProjectsSortedByName

public java.util.SortedSet<com.atlassian.jira.project.Project> getProjectsSortedByName(XProject xproject,
                                                                                       java.util.Locale locale)
Specified by:
getProjectsSortedByName in interface XProjectService
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

public com.atlassian.jira.project.Project getFirstProject(com.opensymphony.user.User user,
                                                          XProject xproject)
Specified by:
getFirstProject in interface XProjectService
Returns:
the JIRA project that alphabetically comes first


Copyright © 2007-2011 Atlassian. All Rights Reserved.