/**
  * 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()]);
 }
 /** @see com.ixora.rms.client.model.DashboardModelHelper#getAllCommittedDashboards(int) */
 @SuppressWarnings("unchecked")
 public Collection<DashboardId> getAllCommittedDashboards(int flag) {
   Collection<DashboardId> ret = new LinkedList<DashboardId>();
   Enumeration<SessionModelTreeNode> e = model.getSessionNode().breadthFirstEnumeration();
   while (e.hasMoreElements()) {
     SessionModelTreeNode sn = (SessionModelTreeNode) e.nextElement();
     Collection<DashboardInfo> dashboards = sn.getArtefactInfoContainer().getDashboardInfo();
     if (!Utils.isEmptyCollection(dashboards)) {
       for (DashboardInfo di : dashboards) {
         if (di.isCommitted() && di.getFlag(flag)) {
           ret.add(new DashboardId(sn.getResourceId(), di.getDashboard().getName()));
         }
       }
     }
   }
   return ret;
 }
 /**
  * Returns the counter info for all counters for all dashboards in the given context
  *
  * @param context
  * @param dbName
  * @return
  */
 private CounterInfoData[] getCounterInfoData(ResourceId context) {
   ArtefactInfoContainerImpl ac = model.getArtefactContainerImplForResource(context, true);
   if (ac == null) {
     if (logger.isTraceEnabled()) {
       logger.error("Couldn't find query group container for: " + context.toString());
     }
     return null;
   }
   Collection<DashboardInfo> cs = ac.getDashboardInfo();
   if (cs == null) {
     return null;
   }
   List<CounterInfoData> ret = new LinkedList<CounterInfoData>();
   for (DashboardInfo dinfo : cs) {
     CounterInfoData[] counters = getCounterInfoData(context, dinfo.getDashboard().getName());
     if (counters != null) {
       ret.addAll(Arrays.asList(counters));
     }
   }
   return ret.toArray(new CounterInfoData[ret.size()]);
 }