예제 #1
0
  private void handleBatchResponse(JSOModel resp) {
    // Early exit if this activity has already been canceled.
    if (eventBus == null) {
      return;
    }

    // TODO: wow, this is some sloppy sh!t
    Office office = clientFactory.getModelDao().getOfficeById(officeId);
    JsArray<CalendarListResource> list = clientFactory.getModelDao().getRooms(office);
    for (int i = 0; i < list.length(); i++) {
      CalendarListResource room = list.get(i);
      JSOModel foo = resp.getObject(room.getId());
      if (foo != null) {
        JSOModel result = foo.getObject("result");
        JSOModel event = clientFactory.getModelDao().findCurrentEvent(result.getArray("items"));
        boolean isBusy = result.getArray("items") != null && event != null;
        // Window.alert(result.get("summary") + " : " + isBusy);
        updateColor(room.getD3id(), isBusy);
      }
    }
  }