Exemplo n.º 1
0
  public Object fillBackingObject(Object incomingModel, Map request, Map session, Map application)
      throws Exception {
    // coming from matrix cell, not helper
    session.remove(WizardPageHelper.WIZARD_PAGE);

    CellFormBean cellBean = (CellFormBean) incomingModel;

    String strId = (String) request.get("page_id");
    if (strId == null) {
      strId = (String) session.get("page_id");
      session.remove("page_id");
    }

    Cell cell;
    Id id = getIdManager().getId(strId);

    // Check if the cell has been removed, which can happen if:
    // (1) user views matrix
    // (2) owner removes column or row (the code verifies that no one has
    // modified the matrix)
    // (3) user selects a cell that has just been removed with the column or
    // row
    try {
      cell = matrixManager.getCellFromPage(id);

      cellBean.setCell(cell);

      List nodeList = new ArrayList(matrixManager.getPageContents(cell.getWizardPage()));
      cellBean.setNodes(nodeList);

      if (request.get("view_user") != null) {
        session.put("view_user", cell.getWizardPage().getOwner().getId().getValue());
      }
    } catch (Exception e) {
      logger.error("Error with cell: " + strId + " " + e.toString());
      // tbd how to report error back to user?
    }

    clearSession(getSessionManager().getCurrentToolSession());
    return cellBean;
  }