com.atlassian.jira.user
Class DefaultUserProjectHistoryManager

java.lang.Object
  extended by com.atlassian.jira.user.DefaultUserProjectHistoryManager
All Implemented Interfaces:
UserProjectHistoryManager

public class DefaultUserProjectHistoryManager
extends Object
implements UserProjectHistoryManager

Convienience wrapper for the UserHistoryManager that deals directly with Projects.

Since:
v4.0

Constructor Summary
DefaultUserProjectHistoryManager(UserHistoryManager userHistoryManager, ProjectManager projectManager, PermissionManager permissionManager)
           
 
Method Summary
 void addProjectToHistory(com.atlassian.crowd.embedded.api.User user, Project project)
          Add a Project to the user hsitory list.
 Project getCurrentProject(int permission, com.atlassian.crowd.embedded.api.User user)
          Gets the last viewed project that the user visted and still has permission to see.
 List<UserHistoryItem> getProjectHistoryWithoutPermissionChecks(com.atlassian.crowd.embedded.api.User user)
          Retreive the user's project history queue.
 List<Project> getProjectHistoryWithPermissionChecks(int permission, com.atlassian.crowd.embedded.api.User user)
          Retreive the user's project history queue.
 List<Project> getProjectHistoryWithPermissionChecks(ProjectAction projectAction, com.atlassian.crowd.embedded.api.User user)
          Retreive the user's project history queue.
 boolean hasProjectHistory(int permission, com.atlassian.crowd.embedded.api.User user)
          Determines whether the user has a current project history.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUserProjectHistoryManager

public DefaultUserProjectHistoryManager(UserHistoryManager userHistoryManager,
                                        ProjectManager projectManager,
                                        PermissionManager permissionManager)
Method Detail

addProjectToHistory

public void addProjectToHistory(com.atlassian.crowd.embedded.api.User user,
                                Project project)
Description copied from interface: UserProjectHistoryManager
Add a Project to the user hsitory list. A null users history should still be stored, even if only for duration of session

Specified by:
addProjectToHistory in interface UserProjectHistoryManager
Parameters:
user - The user to add the history item to
project - The project to add to the history list

hasProjectHistory

public boolean hasProjectHistory(int permission,
                                 com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserProjectHistoryManager
Determines whether the user has a current project history. This method also performs permission checks against the project to ensure that user can see atleast 1 project.

Specified by:
hasProjectHistory in interface UserProjectHistoryManager
Parameters:
permission - the permission to check against
user - The user to check for.
Returns:
true if the user has at least 1 project in their project history queue that they can see, false otherwise

getCurrentProject

public Project getCurrentProject(int permission,
                                 com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserProjectHistoryManager
Gets the last viewed project that the user visted and still has permission to see. This method also performs permission checks against the project to ensure that user can see it.

Specified by:
getCurrentProject in interface UserProjectHistoryManager
Parameters:
permission - the permission the user must have for the project
user - The user to get teh history for.
Returns:
the last project the use visited.

getProjectHistoryWithoutPermissionChecks

public List<UserHistoryItem> getProjectHistoryWithoutPermissionChecks(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserProjectHistoryManager
Retreive the user's project history queue. The list is returned ordered by DESC lastViewed date (i.e. newest is first). This method performs no permission checks. And is extremely fast.

Specified by:
getProjectHistoryWithoutPermissionChecks in interface UserProjectHistoryManager
Parameters:
user - The user to get the history project items for.
Returns:
a list of history project items sort by desc lastViewed date.

getProjectHistoryWithPermissionChecks

public List<Project> getProjectHistoryWithPermissionChecks(int permission,
                                                           com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserProjectHistoryManager
Retreive the user's project history queue. The list is returned ordered by DESC lastViewed date (i.e. newest is first). This method performs permission checks.

Specified by:
getProjectHistoryWithPermissionChecks in interface UserProjectHistoryManager
Parameters:
permission - The permission the user must have for the project
user - The user to get the history project items for.
Returns:
a list of projects sort by desc lastViewed date.

getProjectHistoryWithPermissionChecks

public List<Project> getProjectHistoryWithPermissionChecks(ProjectAction projectAction,
                                                           com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserProjectHistoryManager
Retreive the user's project history queue. The list is returned ordered by DESC lastViewed date (i.e. newest is first). This method performs permission checks.

Specified by:
getProjectHistoryWithPermissionChecks in interface UserProjectHistoryManager
Parameters:
projectAction - The projectAction the user must have for the project
user - The user to get the history project items for.
Returns:
a list of projects sort by desc lastViewed date.


Copyright © 2002-2012 Atlassian. All Rights Reserved.