Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Questions on upgrading plugin for JIRA 7

Wim Deblauwe
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2015

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:

Problem 1

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.

Problem 2

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;
}

Problem 3

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

 

 

 

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2015

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.

crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2015

See https://developer.atlassian.com/jiradev/jira-apis/java-api-policy-for-jira for why moving to jira-api only is a good idea.

TAGS
AUG Leaders

Atlassian Community Events