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

cascading select for reporting doesn't works in jira 6.4.6

Edgar Figueroa October 9, 2015

Hello With jira 4.1.2 we are using cascading select field in reports and it works. But it doesn't works with Jira 6.4.6. The code is:

 atlassian.plugin.xml

<report key="ReportClient" name="Client Report"   class="com.xxx.jira.reports.ReportClient">
   <description key="reports.reportclient.description"></description>
   <label key="reports.reportclient.label" />
   <resource type="velocity" name="view" location="templates/ReportClientHtml.vm" />
   <resource type="velocity" name="excel" location="templates/ReportClientExcel.vm" />
   <resource type="i18n" name="i18n" location="com.xxx.jira.reports.I18nReportClient" />
   <properties>
    <property>
     <key>projectid</key>
     <name>Projects Names</name>
     <description>reports.reportclient.project.selection</description>
     <type>select</type>
     <values clss="com.xxx.jira.reports.ProjectValuesGeneratorWithoutAll"/>
  </property>
  <property>
     <key>componentid</key>
     <name>Project Components</name>
     <description>SELECTION of Project Component</description>
     <type>select</type>
     <values class="com.xxx.jira.reports.ComponentsForSpecificProjectGenerator" />
     <cascade-from>projectid</cascade-from>
   </property>
 </properties>
</report>

 ProjectValuesGeneratorWithoutAll

public class ComponentsForSpecificProjectGenerator implements ValuesGenerator {     
public Map getValues(Map arg0) {
ProjectManager  projectManager  = ComponentAccessor.getProjectManager();       List<Project> projects = projectManager.getProjectObjects();
Map values = new ListOrderedMap();
String keyProject = "";
for (Iterator iterator = projects.iterator(); iterator.hasNext();)
{      
      Project project = (Project) iterator.next();
      Collection components =  project.getComponents();
      keyProject = project.getId().toString();
      values.put(keyProject+"ALL", new ValueClassHolder("All", keyProject));
      String idGvComponent= "";
       String nameGvComponent= "";
       for(Iterator<GenericValue> componentIt = components.iterator();
        componentIt.hasNext();) {
        GenericValue gvComponent = (GenericValue)componentIt.next();
        values.put(gvComponent.getString("id"),new ValueClassHolder(gvComponent.getString("name"), key));
      }
  }
    return values;
   }
  }
}
public class ValueClassHolder {     
private String value;
private String className;  
public ValueClassHolder(String value, String className){
     this.value = value;  
     this.className = className;     
}
 public String getValue(){
      return value;
 }
 public String getClassName(){
    return className;     
 }
 public String toString(){
  return value;
 }
}
public class ProjectValuesGeneratorWithoutAll implements ValuesGenerator{
 public Map getValues(Map arg0) {   @SuppressWarnings("unchecked")   ProjectValuesGenerator projectValuesGenerator = new ProjectValuesGenerator();   Map<String, String> values = new ListOrderedMap();   values.putAll(projectValuesGenerator.getValues(arg0));   return values;  }  }

We've getting all projects list displayed in first projects field, but when we can select a project to obtains their components, nothing happens and, inside components project field, we are a list of all components for all projects, but not only select project components . We´ve founded here, threads with same or similar problem but without answer. Thanks in advance for your help 

 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Edgar Figueroa October 15, 2015

The code is updated, but the problem is when select a value of first field (project) nothing happens on second field ( components), no detection of first selection. So there is a javascript or velocity or jsp problem. Somebody can help?

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 9, 2015

The storage format for select lists changed significantly in JIRA 4.3 - you'll need to refer back to the API documentation to update your code appropriately.

TAGS
AUG Leaders

Atlassian Community Events