/**
  * Returns the view info for all counters that are part of the given dashboard
  *
  * @param context
  * @param dbName
  * @return
  */
 private CounterInfoData[] getCounterInfoData(ResourceId context, String dbName) {
   DashboardInfo dinfo = model.getDashboardInfo(new DashboardId(context, dbName), true);
   if (dinfo == null) {
     return null;
   }
   List<CounterInfoData> ret = new LinkedList<CounterInfoData>();
   Dashboard db = dinfo.getDashboard();
   ResourceId[] counters = db.getCounters();
   if (counters == null) {
     return null;
   }
   // find now query info on every member query
   ResourceId m;
   CounterInfo cinfo;
   for (int i = 0; i < counters.length; i++) {
     m = counters[i];
     if (context != null) {
       m = m.complete(context);
     }
     cinfo = model.getCounterInfo(m, true);
     if (cinfo == null) {
       if (logger.isTraceEnabled()) {
         logger.error("Counter " + m + " not found for dashboard " + db.getName());
       }
       continue;
     }
     ret.add(new CounterInfoData(m, cinfo));
   }
   return ret.toArray(new CounterInfoData[ret.size()]);
 }
 /**
  * Returns the view info for all views in the given group in the given context.
  *
  * @param context
  * @param dbName
  * @return
  */
 private DataViewInfoData[] getDataViewInfoData(ResourceId context, String dbName) {
   DashboardInfo dinfo = model.getDashboardInfo(new DashboardId(context, dbName), true);
   if (dinfo == null) {
     return null;
   }
   List<DataViewInfoData> ret = new LinkedList<DataViewInfoData>();
   Dashboard db = dinfo.getDashboard();
   DataViewId[] views = db.getViews();
   if (views == null) {
     return null;
   }
   // find now query info on every member query
   DataViewId m;
   DataViewInfo dvinfo;
   for (int i = 0; i < views.length; i++) {
     m = views[i];
     if (context != null) {
       m = m.complete(context);
     }
     dvinfo = model.getDataViewInfo(m, true);
     if (dvinfo == null) {
       if (logger.isTraceEnabled()) {
         logger.error("Dataview " + m + " not found for dashboard " + db.getName());
       }
       continue;
     }
     ret.add(new DataViewInfoData(m.getContext(), dvinfo));
   }
   return (DataViewInfoData[]) ret.toArray(new DataViewInfoData[ret.size()]);
 }
 /**
  * @param context
  * @param dashboard
  */
 private void handleSavedDashboard(ResourceId context, Dashboard dashboard) {
   // add to model only if the data view applies for the given context
   String version = fSessionData.getAgentVersionInContext(context);
   // add to model only if:
   // 1. outside of an agent context
   // 2. dashboard applies to version in context
   if (version == null || dashboard.appliesToAgentVersion(version)) {
     fSessionData.getDashboardHelper().addDashboard(context, dashboard);
   } else {
     // otherwise remove
     fSessionData.getDashboardHelper().removeDashboard(context, dashboard.getName());
   }
   // refresh table model
   refreshTableModel();
 }