示例#1
0
 @Override
 public void mergeDashboard(Dashboard dashboard) {
   if (dashboard.getItems() != null) {
     for (DashboardItem item : dashboard.getItems()) {
       mergeDashboardItem(item);
     }
   }
 }
示例#2
0
  @Override
  public boolean addItemContent(String dashboardUid, String type, String contentUid) {
    Dashboard dashboard = getDashboard(dashboardUid);

    if (dashboard == null) {
      return false;
    }

    if (TYPE_CHART.equals(type)) {
      DashboardItem item = new DashboardItem();
      item.setChart(objectManager.get(Chart.class, contentUid));
      dashboard.getItems().add(0, item);
    } else if (TYPE_EVENT_CHART.equals(type)) {
      DashboardItem item = new DashboardItem();
      item.setEventChart(objectManager.get(EventChart.class, contentUid));
      dashboard.getItems().add(0, item);
    } else if (TYPE_MAP.equals(type)) {
      DashboardItem item = new DashboardItem();
      item.setMap(objectManager.get(Map.class, contentUid));
      dashboard.getItems().add(0, item);
    } else if (TYPE_REPORT_TABLE.equals(type)) {
      DashboardItem item = new DashboardItem();
      item.setReportTable(objectManager.get(ReportTable.class, contentUid));
      dashboard.getItems().add(0, item);
    } else if (TYPE_MESSAGES.equals(type)) {
      DashboardItem item = new DashboardItem();
      item.setMessages(true);
      dashboard.getItems().add(0, item);
    } else // Link item
    {
      DashboardItem availableItem = dashboard.getAvailableItemByType(type);

      DashboardItem item = availableItem == null ? new DashboardItem() : availableItem;

      if (TYPE_USERS.equals(type)) {
        item.getUsers().add(objectManager.get(User.class, contentUid));
      } else if (TYPE_REPORT_TABLES.equals(type)) {
        item.getReportTables().add(objectManager.get(ReportTable.class, contentUid));
      } else if (TYPE_REPORTS.equals(type)) {
        item.getReports().add(objectManager.get(Report.class, contentUid));
      } else if (TYPE_RESOURCES.equals(type)) {
        item.getResources().add(objectManager.get(Document.class, contentUid));
      }

      if (availableItem == null) {
        dashboard.getItems().add(0, item);
      }
    }

    if (dashboard.getItemCount() > Dashboard.MAX_ITEMS) {
      return false;
    }

    updateDashboard(dashboard);

    return true;
  }
示例#3
0
  @Override
  public void deleteDashboard(Dashboard dashboard) {
    dashboardStore.delete(dashboard);

    for (DashboardItem dashboardItem : dashboard.getItems()) {
      dashboardItemStore.delete(dashboardItem);
    }
  }