コード例 #1
0
  @SuppressWarnings("unused")
  public ActionForward add(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String lookupListItemLabel = request.getParameter("lookupListItemLabel");
    String lookupListId = request.getParameter("lookupListId");
    String user = (String) request.getSession().getAttribute("user");
    LookupListItem lookupListItem;
    int lookupListIdInteger;
    List<LookupListItem> lookupListItems;

    if (user == null) {
      user = "";
    }

    if (lookupListItemLabel != null
        && !lookupListItemLabel.isEmpty()
        && lookupListId != null
        && !lookupListId.isEmpty()) {

      lookupListIdInteger = Integer.parseInt(lookupListId);
      lookupListItems =
          lookupListManager.findLookupListItemsByLookupListId(loggedInInfo, lookupListIdInteger);
      lookupListItem = new LookupListItem();
      lookupListItem.setActive(true);
      lookupListItem.setCreatedBy(user);
      lookupListItem.setDisplayOrder(
          lookupListItems.get(lookupListItems.size() - 1).getDisplayOrder() + 1);
      lookupListItem.setLabel(lookupListItemLabel);
      lookupListItem.setLookupListId(lookupListIdInteger);
      lookupListItem.setValue(UUID.randomUUID().toString());

      lookupListManager.addLookupListItem(loggedInInfo, lookupListItem);
    }

    request.setAttribute("lookupLists", lookupListManager.findAllActiveLookupLists(loggedInInfo));

    return mapping.findForward("success");
  }
コード例 #2
0
  @SuppressWarnings("unused")
  public ActionForward manage(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    request.setAttribute("lookupLists", lookupListManager.findAllActiveLookupLists(loggedInInfo));

    return mapping.findForward("success");
  }
コード例 #3
0
  @SuppressWarnings("unused")
  public ActionForward remove(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String lookupListItemId = request.getParameter("lookupListItemId");
    int id = 0;

    if (lookupListItemId != null && !lookupListItemId.isEmpty()) {
      id = Integer.parseInt(lookupListItemId);
    }

    if (id > 0) {
      lookupListManager.removeLookupListItem(loggedInInfo, id);
    }

    request.setAttribute("lookupLists", lookupListManager.findAllActiveLookupLists(loggedInInfo));

    return mapping.findForward("success");
  }
コード例 #4
0
  @SuppressWarnings("unused")
  public ActionForward manageSingle(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String listName = request.getParameter("listName");
    if (listName != null && !listName.isEmpty()) {
      request.setAttribute(
          "lookupListSingle", lookupListManager.findLookupListByName(loggedInInfo, listName));
    }

    return mapping.findForward("success");
  }
コード例 #5
0
  @SuppressWarnings("unused")
  public ActionForward order(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String lookupListItemId = request.getParameter("lookupListItemId");
    String lookupListItemDisplayOrder = request.getParameter("lookupListItemDisplayOrder");

    if (lookupListItemId != null
        && !lookupListItemId.isEmpty()
        && lookupListItemDisplayOrder != null
        && !lookupListItemDisplayOrder.isEmpty()) {

      lookupListManager.updateLookupListItemDisplayOrder(
          loggedInInfo,
          Integer.parseInt(lookupListItemId),
          Integer.parseInt(lookupListItemDisplayOrder));
    }

    return mapping.findForward("success");
  }