I have a section on agile board and want to dynamicaly add a web-items to it.
<web-section location="jira.agile.board.tools" key="custom-board-tool-section" weight="10">
<label key="My Section"/>
</web-section>I have tried to use a web-item-provider
<web-item-provider key="items-factory" name="Web Items Factory"
section="jira.agile.board.tools/custom-board-tool-section"
class="com.sample.impl.LinkFactory"
lazy="false"
weight="10"/>with following code
package com.sample.impl;
import com.atlassian.plugin.servlet.PluginHttpRequestWrapper;
import com.atlassian.plugin.web.api.WebItem;
import com.atlassian.plugin.web.api.model.WebFragmentBuilder;
import com.atlassian.plugin.web.api.provider.WebItemProvider;
import com.sample.Utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class LinkFactory implements WebItemProvider {
public Iterable<WebItem> getItems(Map<String, Object> map) {
Map<String, String> names = Utils.getNames();
final List<WebItem> links = new ArrayList<WebItem>();
for (Map.Entry<String, String> entry : names.entrySet()) {
String entryKey = entry.getKey();
int weight = 10;
links.add(new WebFragmentBuilder(weight += 10)
.id(entry.getValue())
.label(entryKey)
.title(entryKey)
.styleClass("")
.webItem("custom-board-tool-section")
// .webItem("")
.url(((PluginHttpRequestWrapper) map.get("request")).getContextPath() + "/secure/nnn")
.build());
}
return links;
}
}and this code does not add any web-item to my section.
Maybe somebody faced with similar problem and can help to solve it?
additional info : Jira version 7.1.1
Thanks in advance!