}
public MapDataBean generateMapView(String key1, String key2, String key3,
Integer hitsNumber)
{
MapDataBean mapDataBean = new MapDataBean(key1, key2, key3);
mapDataBean.setName(key2);
Collection<MapPointBean> fullData = new ArrayList<MapPointBean>();
try
{
NamedList result = (NamedList) ((SimpleOrderedMap) ((SimpleOrderedMap) solrResponse
.getResponse().get("facet_counts")).get("facet_fields"))
.get(key3);
int limit = result.size();
if (key3.equals(_CONTINENT) && hitsNumber != null && hitsNumber > 0)
{
limit = hitsNumber;
}
else if (key3.equals(_COUNTRY_CODE) && hitsNumber != null
&& hitsNumber > 0)
{
limit = hitsNumber;
}
if (key3.equals(_CITY) && hitsNumber != null && hitsNumber > 0)
{
limit = hitsNumber;
}
Integer other = 0;
for (int i = 0; i < result.size(); i++)
{
try
{
if (result.getVal(i).getClass().equals(Integer.class))
{
StringTokenizer st = new StringTokenizer(
(result.getName(i)).toString(),
DELIM_LATITUDE_LONGITUDE);
MapPointBean mapPointBean = new MapPointBean(
st.nextToken(), st.nextToken(),
(Integer) result.getVal(i));
fullData.add(mapPointBean);
}
}
catch (Exception e)
{
fullData.add(new MapPointBean(_NotAvailable, _NotAvailable,
null));
e.printStackTrace();
}
}
mapDataBean.setHits(result.size());
mapDataBean.setDataTable(fullData);
try
{
mapDataBean.setPercentages();
}
catch (Exception e)
{
e.printStackTrace();
}