Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add configuration for the plugin and store the data and make it accessible globally?

Ashish Biswal March 28, 2019

I want to add configuration for the plugin and where to store the configuration data so that it can be accessed by any module of the plugin

1 answer

0 votes
Aleksandr Zuevich
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.
March 30, 2019

Hi,

 

Usually com.atlassian.sal.api.pluginsettings.PluginSettingsFactory is used for this purpose. Please google in this direction.

Ashish Biswal April 2, 2019

@Aleksandr Zuevich 

i have gone through how to configure the admin page in jira i have found several ways such as the webwork, servlet, actionobject, pluginsettingsfactory.

Could you please help me with any links of the tutorial for pluginsettingsfactory?

as the tutorial in the documentation doesn't give much information about how to store and retrieve the values

Aleksandr Zuevich
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.
April 2, 2019
Ashish Biswal April 3, 2019

Thanks for your support @Aleksandr Zuevich . On researching about how to connect the web-item with pluginsettingsfactory i found that we can use servlet.

I found few documentations on the adminUI but unsure of the correct sequence in which I should follow them.

Could you please help me with any link of sample plugin or the correct sequence of following the documents?

Ashish Biswal April 3, 2019

It would be of great help if you could let me know that how can i retrieve the stored value in a different REST module 

Aleksandr Zuevich
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.
April 3, 2019
Aleksandr Zuevich
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.
April 3, 2019

Usually I create Settings class which I inject everywhere I need to use it:

@JiraComponent
public class Settings {
private static final String AUTO_UPDATED_FIELD_KEY = "autoupdated.field.id";
private final PluginSettings pluginSettings;

@Inject
public Settings(@ComponentImport PluginSettingsFactory pluginSettingsFactory) {
pluginSettings = pluginSettingsFactory.createSettingsForKey(getClass().getPackage().toString());
}

public void putAutoUpdatedFieldId(String fieldId) {
pluginSettings.put(AUTO_UPDATED_FIELD_KEY, fieldId);
}

public String getAutoUpdatedFieldId() {
return (String) pluginSettings.get(AUTO_UPDATED_FIELD_KEY);
}

}

Suggest an answer

Log in or Sign up to answer