com.atlassian.jira.user.profile
Class AbstractUserProfileFragment

java.lang.Object
  extended by com.atlassian.jira.user.profile.AbstractUserProfileFragment
All Implemented Interfaces:
UserProfileFragment
Direct Known Subclasses:
AssignedAndOpenUserProfileFragment, DetailsUserProfileFragment, PreferencesUserProfileFragment

public abstract class AbstractUserProfileFragment
extends Object
implements UserProfileFragment

Abstract class for UserProfileFragment that helps writing fragments that are velocity rendered. It simply renders the template based of the fragment id and the implementing class can also overide createVelocityParams(User, User)

Since:
v4.1

Field Summary
protected  ApplicationProperties applicationProperties
           
protected  JiraAuthenticationContext jiraAuthenticationContext
           
 
Constructor Summary
AbstractUserProfileFragment(ApplicationProperties applicationProperties, JiraAuthenticationContext jiraAuthenticationContext, com.atlassian.velocity.VelocityManager velocityManager, VelocityParamFactory velocityParamFactory)
           
 
Method Summary
protected  Map<String,Object> createVelocityParams(com.atlassian.crowd.embedded.api.User profileUser, com.atlassian.crowd.embedded.api.User currentUser)
          Creates the parameters passed to the velocity template.
 String getFragmentHtml(com.atlassian.crowd.embedded.api.User profileUser, com.atlassian.crowd.embedded.api.User currentUser)
          Creates the HTML for this fragment.
 boolean showFragment(com.atlassian.crowd.embedded.api.User profileUser, com.atlassian.crowd.embedded.api.User currentUser)
          Whether or not we display this fragment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.user.profile.UserProfileFragment
getId
 

Field Detail

applicationProperties

protected final ApplicationProperties applicationProperties

jiraAuthenticationContext

protected final JiraAuthenticationContext jiraAuthenticationContext
Constructor Detail

AbstractUserProfileFragment

public AbstractUserProfileFragment(ApplicationProperties applicationProperties,
                                   JiraAuthenticationContext jiraAuthenticationContext,
                                   com.atlassian.velocity.VelocityManager velocityManager,
                                   VelocityParamFactory velocityParamFactory)
Method Detail

showFragment

public boolean showFragment(com.atlassian.crowd.embedded.api.User profileUser,
                            com.atlassian.crowd.embedded.api.User currentUser)
Whether or not we display this fragment. By default we do.

Specified by:
showFragment in interface UserProfileFragment
Parameters:
profileUser - The user whose profile the current user is looking at
currentUser - The current user
Returns:
true if we should disply this fragment, otherwise false

getFragmentHtml

public String getFragmentHtml(com.atlassian.crowd.embedded.api.User profileUser,
                              com.atlassian.crowd.embedded.api.User currentUser)
Creates the HTML for this fragment.

This implementation renders the template based off of the frgmant id - UserProfileFragment.getId()

Specified by:
getFragmentHtml in interface UserProfileFragment
Parameters:
profileUser - The user whose profile the current user is looking at
currentUser - The current user
Returns:
The HTML of this fragment

createVelocityParams

protected Map<String,Object> createVelocityParams(com.atlassian.crowd.embedded.api.User profileUser,
                                                  com.atlassian.crowd.embedded.api.User currentUser)
Creates the parameters passed to the velocity template.

By default this contains "fragId", "profileUser", "currentUser"

Implmentors of this abstract class can override this method to provide their own params.

Parameters:
profileUser - The user whose profile the current user is looking at
currentUser - The current user
Returns:
a map of the params passed to the velocity template.
Since:
v4.3


Copyright © 2002-2012 Atlassian. All Rights Reserved.