Exemplo n.º 1
0
  protected Unit getUnit(HttpServletRequest request) {
    Unit unit = (Unit) request.getAttribute("unit");

    if (unit == null) {
      FilterFunctionalityContext context =
          (FilterFunctionalityContext) AbstractFunctionalityContext.getCurrentContext(request);
      UnitSite site = (UnitSite) context.getSelectedContainer();
      unit = site.getUnit();
    }

    return unit;
  }
Exemplo n.º 2
0
  public Unit getUnit(HttpServletRequest request) {
    String parameter = request.getParameter(getContextParamName());

    if (parameter == null) {
      UnitSite site = SiteMapper.getSite(request);
      if (site != null) {
        return site.getUnit();
      }
      UnitAnnouncementBoard board = getDomainObject(request, "announcementBoardId");
      if (board != null) {
        return board.getUnit();
      }
      Announcement announcement = getDomainObject(request, "announcementId");
      if (announcement != null) {
        return ((UnitAnnouncementBoard) announcement.getAnnouncementBoard()).getUnit();
      }
    }

    try {
      return (Unit) FenixFramework.getDomainObject(parameter);
    } catch (NumberFormatException e) {
      return null;
    }
  }