/** @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; }
/** @param context */ public void rollbackDashboards(ResourceId context) { // rollback data views DataViewInfoData[] data = getDataViewInfoData(context); if (data != null) { ResourceId rid; DataViewInfoData d; DataViewInfo dvinfo; for (int i = 0; i < data.length; i++) { d = data[i]; dvinfo = d.getInfo(); rid = d.getContext(); if (!dvinfo.isCommitted()) { model.getDataViewHelper().rollbackDataView(rid, dvinfo.getDataView().getName()); } } } // rollback counters CounterInfoData[] counters = getCounterInfoData(context); if (!Utils.isEmptyArray(counters)) { // check that all counters are present for (CounterInfoData cid : counters) { model.getCounterHelper().rollbackCounter(cid.counterId, true); } } ArtefactInfoContainerImpl qc = model.getArtefactContainerImplForResource(context, true); if (qc == null) { if (logger.isTraceEnabled()) { logger.error("Couldn't find container for: " + context); } return; } Collection<DashboardInfoImpl> dis = qc.getDashboardInfoImpl(); if (!Utils.isEmptyCollection(dis)) { for (DashboardInfoImpl di : dis) { di.rollback(); } } }