Hi,
I am trying to upgrade my JIRA Database Values Plugin for JIRA 7. I currently have 3 compilation problems that I don't know how to solve:
ComponentManager.getInstance().getApplicationProperties() -> I need this in the following piece of code:
ApplicationProperties applicationProperties = ComponentManager.getInstance().getApplicationProperties();
String baseUrl = applicationProperties.getString( APKeys.JIRA_BASEURL );
String webworkEncoding = applicationProperties.getString( APKeys.JIRA_WEBWORK_ENCODING );
String renderedText = m_velocityManager.getEncodedBody( DIRNAME_PATH, FILENAME, baseUrl, webworkEncoding, context );
builder.append( renderedText );
I need the base url and the webwork encoding to be able to pass that into the `getEncodedBody` method of the velocity manager.
ComponentManager.getInstance().getJiraAuthenticationContext() -> I need this to know the name of the currently logged on user. I currently do this as follows:
private String replaceJiraUserIfPresent(String sqlQuery)
{
if (sqlQuery.indexOf("${jira.user}") != -1)
{
User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
String userName = user.getName();
logger.debug("Replacing ${jira.user} with " + userName);
sqlQuery = sqlQuery.replaceAll("\\$\\{jira.user\\}", userName);
}
return sqlQuery;
}
ComponentManager.getInstance().getCustomFieldManager() -> I need this in my JiraWebActionSupport subclass to be able to retrieve a helper object I need:
private DatabaseValuesViewHelper getDatabaseValuesViewHelper( String customfieldId )
{
CustomField customField = ComponentManager.getInstance().getCustomFieldManager().getCustomFieldObject( customfieldId );
Map map = customField.getCustomFieldType().getVelocityParameters( null, customField, null );
return (DatabaseValuesViewHelper)map.get( "databaseValuesViewHelper" );
}
I am not actively working on the plugin anymore since our company does not use it anymore. But if I can get it working again relatively easy, I know a lot of people would be happy, since I already had some requests to support JIRA 7.
regards,
Wim
Community moderators have prevented the ability to post new answers.
All plugin references to ComponentManager
should be changed to use ComponentAccessor instead. This has been true for a very long time (as in, since JIRA v4.3).
That you are still trying to use ComponentManager
suggests that you must also still be using jira-core
. You should take this opportunity to remove that dependency and make use of only jira-api
if at all possible.
See https://developer.atlassian.com/jiradev/jira-apis/java-api-policy-for-jira for why moving to jira-api only is a good idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.