I’ve developed a macro and have been able to confirm that my licensing is working correctly. However I would like to add some context to my error messaging. If a user’s license has had an issue and it can not be confirmed (or it’s expired), my message currently just points them to my website. I would like to enhance this by having a link in the message which will point them to thier confluence server’s upm link like “/plugins/servlet/upm” so that they can view their licensing issue directly. Is there a way to get the host url and append the “/plugins/servlet/upm” to the end of that within my macro?
Inject the SettingsManager and use it as
settingsManager.getGlobalSettings().getBaseUrl();
thanks for the help! I did find that api function and I’ve attempted to use it, but maybe I’m having trouble injecting it properly?
I’ve included this import:
import com.atlassian.confluence.setup.settings.Settings;
This is where I’ve injected/instantiated the SettingsManager:
``
@Scanned
public class myMacro implements Macro {
private final PluginLicenseManager pluginLicenseManager;
private PageBuilderService pageBuilderService;
private SettingsManager settingsManager;
@Autowired
public myMacro(@ComponentImport PageBuilderService pageBuilderService, @ComponentImport PluginLicenseManager pluginLicenseManager, @ComponentImport SettingsManager settingsManager) {
this.pageBuilderService = pageBuilderService;
this.pluginLicenseManager = pluginLicenseManager;
this.settingsManager = settingsManager;
}
public String execute(Map<String, String> map, String s, ConversionContext conversionContext) throws MacroExecutionException {
String output;
String baseUrl;
baseUrl = settingsManager.getGlobalSettings().getBaseUrl();
...working code which turns output into something...
return output;
}
public BodyType getBodyType() { return BodyType.NONE; }
public OutputType getOutputType() { return OutputType.BLOCK; }
}
``
But I’m still getting errors like this:
``
java:[28,152] cannot find symbol
[ERROR] symbol: class SettingsManager
``
Thanks again,
Joe S.
That is Settings, not SettingsManager. For SettignsManager use the
import com.atlassian.confluence.setup.settings.SettingsManager;