There is a Ajax call with JSON data of String, Array and Map. I am able to get String and Array data after converting into DashboardChartData
(a Bean class) in jersey but not able to get Map values.
suppose bean is the object of DashboardChartData
and globalInFilters is a data member of DashboardChartData Class and make setter/getter as same then
bean.getGlobalInFilters(); is getting null not desired value.
Code is:
function demo(){
var dashbord = {
"aoId": "M_AO_918",
"viewBys": ["Brand", "Category", "State"],
"viewIds": ["615228", "615128", "614847"],
"dimensions": ["615228"],
"aggregation": ["SUM", "SUM", "SUM", "SUM", "SUM", "SUM"],
"meassures": ["Gross Sales", "Net Sales", "Discount Amt", "Discount%", "Net Margin Amt", "Gross Margin Amt"],
"meassureIds": ["616275", "616283", "616279", "616648", "616295", "616303"],
"globalInFilters": {"615228": ["Lenovo", "Apple"]}
};
$("#query").html(JSON.stringify(dashbord));
$.ajax({
type: "POST",
contentType: "application/json; charSet=UTF-8",
dataType: "json",
data: JSON.stringify(dashbord),
url: "<%=request.getContextPath()%>/webresources/solrservice/test1",
success: function(data, textStatus, jqXHR){
alert('Bean created successfully');
},
error: function(jqXHR, textStatus, errorThrown){
alert('Bean error: ' + textStatus);
}
});
}
I have created DashboardChartData
class with above parameter including:
private Map<String, List<String>> globalInFilters;
public Map<String, List<String>> getGlobalInFilters() {
return globalInFilters;
}
public void setGlobalInFilters(Map<String, List<String>> globalInFilters) {
this.globalInFilters = globalInFilters;
}
@Path("/test1")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public void setData1(DashboardChartDataBean bean) throws Exception {
bean.getGlobalInFilters(); //getting null
ProgenSolrDao daoObj = new ProgenSolrDao();
try {
QueryResponse response = daoObj.executeSolrQuery("city",bean);
} catch (Exception e) {
}
}
bean.getGlobalInFilters()
gets null
, except this all other values is getting fine. please help how I can get the values of globalInFilters
.