Ejemplo n.º 1
0
 @Override
 public boolean equals(Object o) {
   if (this == o) {
     return true;
   }
   if (!(o instanceof User)) {
     return false;
   }
   final User u = (User) o;
   return u.getLoginName().equals(loginName);
 }
Ejemplo n.º 2
0
 public void spaceUsersGet(HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   String prefixCode = request.getParameter("prefixCode");
   Space space = jtrac.loadSpace(prefixCode);
   Document d = XmlUtils.getNewDocument("users");
   Element root = d.getRootElement();
   root.addAttribute("prefixCode", prefixCode);
   List<User> users = jtrac.findUsersForSpace(space.getId());
   for (User user : users) {
     root.addElement("user")
         .addAttribute("loginName", user.getLoginName())
         .addText(user.getName());
   }
   writeXml(d, response);
 }
Ejemplo n.º 3
0
 public List<Field> getEditableFieldList(User user) {
   return user.getEditableFieldList(space, getStatus());
 }
Ejemplo n.º 4
0
  public DashboardRowPanel(String id, final UserSpaceRole usr, final Counts counts) {

    super(id);
    setOutputMarkupId(true);

    final Space space = usr.getSpace();
    final User user = usr.getUser();

    WebMarkupContainer spaceCell = new WebMarkupContainer("space");
    add(spaceCell);

    spaceCell.add(new Label("name", space.getName()));
    spaceCell.add(new Label("prefixCode", space.getPrefixCode()));

    if (usr.isAbleToCreateNewItem()) {
      add(
          new Link("new") {
            public void onClick() {
              setCurrentSpace(space);
              setResponsePage(ItemFormPage.class);
            }
          });
    } else {
      add(new Label("new").setVisible(false));
    }

    add(
        new Link("search") {
          public void onClick() {
            setCurrentSpace(space);
            ItemSearch itemSearch = new ItemSearch(space);
            setResponsePage(ItemSearchFormPage.class, itemSearch.getAsQueryString());
          }
        });

    add(
        new IndicatingAjaxLink("link") {
          public void onClick(AjaxRequestTarget target) {
            Counts tempCounts = counts;
            // avoid hitting the database again if re-expanding
            if (!tempCounts.isDetailed()) {
              tempCounts = getJtrac().loadCountsForUserSpace(user, space);
            }
            DashboardRowExpandedPanel dashboardRow =
                new DashboardRowExpandedPanel("dashboardRow", usr, tempCounts);
            DashboardRowPanel.this.replaceWith(dashboardRow);
            target.addComponent(dashboardRow);
          }
        });

    if (user.getId() > 0) {
      add(
          new Link("loggedByMe") {
            public void onClick() {
              setCurrentSpace(space);
              ItemSearch itemSearch = new ItemSearch(space);
              itemSearch.setLoggedBy(user);
              // setCurrentItemSearch(itemSearch);
              setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
            }
          }.add(new Label("loggedByMe", new PropertyModel(counts, "loggedByMe"))));

      add(
          new Link("assignedToMe") {
            public void onClick() {
              setCurrentSpace(space);
              ItemSearch itemSearch = new ItemSearch(space);
              itemSearch.setAssignedTo(user);
              // setCurrentItemSearch(itemSearch);
              setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
            }
          }.add(new Label("assignedToMe", new PropertyModel(counts, "assignedToMe"))));
    } else {
      add(new WebMarkupContainer("loggedByMe").setVisible(false));
      add(new WebMarkupContainer("assignedToMe").setVisible(false));
    }

    add(
        new Link("total") {
          public void onClick() {
            setCurrentSpace(space);
            ItemSearch itemSearch = new ItemSearch(space);
            // setCurrentItemSearch(itemSearch);
            setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
          }
        }.add(new Label("total", new PropertyModel(counts, "total"))));
  }
Ejemplo n.º 5
0
 public Map<Integer, String> getPermittedTransitions(User user) {
   return user.getPermittedTransitions(space, getStatus());
 }