public abstract class AbstractUserProfileFragment extends Object implements UserProfileFragment
Abstract class for UserProfileFragment
that helps writing fragments that
are rendered by velocity.
It simply renders the template based of the fragment id and the implementing class can also
override #createVelocityParams(User, User)
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_USER |
protected JiraAuthenticationContext |
jiraAuthenticationContext |
static String |
PROFILE_USER |
Constructor and Description |
---|
AbstractUserProfileFragment(JiraAuthenticationContext jiraAuthenticationContext,
VelocityTemplatingEngine templatingEngine,
VelocityParamFactory velocityParamFactory) |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
createVelocityParams(ApplicationUser profileUser,
ApplicationUser currentUser)
Creates the parameters passed to the velocity template.
|
String |
getFragmentHtml(ApplicationUser profileUser,
ApplicationUser currentUser)
Creates the HTML for this fragment.
|
boolean |
showFragment(ApplicationUser profileUser,
ApplicationUser currentUser)
Whether or not we display this fragment.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getId
public static final String PROFILE_USER
public static final String CURRENT_USER
protected final JiraAuthenticationContext jiraAuthenticationContext
public AbstractUserProfileFragment(JiraAuthenticationContext jiraAuthenticationContext, VelocityTemplatingEngine templatingEngine, VelocityParamFactory velocityParamFactory)
public boolean showFragment(ApplicationUser profileUser, ApplicationUser currentUser)
showFragment
in interface UserProfileFragment
profileUser
- The user whose profile the current user is looking atcurrentUser
- The current userpublic String getFragmentHtml(ApplicationUser profileUser, ApplicationUser currentUser)
This implementation renders the template based off of the fragment id - UserProfileFragment.getId()
getFragmentHtml
in interface UserProfileFragment
profileUser
- The user whose profile the current user is looking atcurrentUser
- The current userprotected Map<String,Object> createVelocityParams(ApplicationUser profileUser, ApplicationUser currentUser)
By default this contains "fragId", "profileUser", "currentUser"
Implmentors of this abstract class can override this method to provide their own params.
profileUser
- The user whose profile the current user is looking atcurrentUser
- The current userCopyright © 2002-2024 Atlassian. All Rights Reserved.