Package com.gitblit.models

Examples of com.gitblit.models.TicketModel$Change


    TicketKey key = new TicketKey(repository, ticketId);
    ticketsCache.invalidate(key);

    boolean success = commitChangeImpl(repository, ticketId, change);
    if (success) {
      TicketModel ticket = getTicket(repository, ticketId);
      ticketsCache.put(key, ticket);
      indexer.index(ticket);

      // call the ticket hooks
      if (pluginManager != null) {
View Full Code Here


   * @param deletedBy
   * @return true if successful
   * @since 1.4.0
   */
  public boolean deleteTicket(RepositoryModel repository, long ticketId, String deletedBy) {
    TicketModel ticket = getTicket(repository, ticketId);
    boolean success = deleteTicketImpl(repository, ticket, deletedBy);
    if (success) {
      log.info(MessageFormat.format("Deleted {0} ticket #{1,number,0}: {2}",
          repository.name, ticketId, ticket.title));
      ticketsCache.invalidate(new TicketKey(repository, ticketId));
View Full Code Here

      String updatedBy, String comment) {
    Change revision = new Change(updatedBy);
    revision.comment(comment);
    revision.comment.id = commentId;
    RepositoryModel repository = repositoryManager.getRepositoryModel(ticket.repository);
    TicketModel revisedTicket = updateTicket(repository, ticket.number, revision);
    return revisedTicket;
  }
View Full Code Here

    Change deletion = new Change(deletedBy);
    deletion.comment("");
    deletion.comment.id = commentId;
    deletion.comment.deleted = true;
    RepositoryModel repository = repositoryManager.getRepositoryModel(ticket.repository);
    TicketModel revisedTicket = updateTicket(repository, ticket.number, deletion);
    return revisedTicket;
  }
View Full Code Here

                Change change = new Change(user.username);
                change.setField(Field.status, status);
                if (!ticket.isWatching(user.username)) {
                  change.watch(user.username);
                }
                TicketModel update = app().tickets().updateTicket(repository, ticket.number, change);
                app().tickets().createNotifier().sendMailing(update);
                setResponsePage(TicketsPage.class, getPageParameters());
              }
            };
            String css = getStatusClass(item.getModel().getObject());
            WicketUtils.setCssClass(link, css);
            item.add(link);
          }
        };
        controls.add(statusView);

        /*
         * RESPONSIBLE LIST
         */
        Set<String> userlist = new TreeSet<String>(ticket.getParticipants());
        for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {
          if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {
            userlist.add(rp.registrant);
          }
        }
        List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();
        if (!StringUtils.isEmpty(ticket.responsible)) {
          // exclude the current responsible
          userlist.remove(ticket.responsible);
        }
        for (String username : userlist) {
          UserModel u = app().users().getUserModel(username);
          if (u != null) {
            responsibles.add(new TicketResponsible(u));
          }
        }
        Collections.sort(responsibles);
        responsibles.add(new TicketResponsible(ESC_NIL, "", ""));
        ListDataProvider<TicketResponsible> responsibleDp = new ListDataProvider<TicketResponsible>(responsibles);
        DataView<TicketResponsible> responsibleView = new DataView<TicketResponsible>("newResponsible", responsibleDp) {
          private static final long serialVersionUID = 1L;

          @Override
          public void populateItem(final Item<TicketResponsible> item) {
            SimpleAjaxLink<TicketResponsible> link = new SimpleAjaxLink<TicketResponsible>("link", item.getModel()) {

              private static final long serialVersionUID = 1L;

              @Override
              public void onClick(AjaxRequestTarget target) {
                TicketResponsible responsible = getModel().getObject();
                Change change = new Change(user.username);
                change.setField(Field.responsible, responsible.username);
                if (!StringUtils.isEmpty(responsible.username)) {
                  if (!ticket.isWatching(responsible.username)) {
                    change.watch(responsible.username);
                  }
                }
                if (!ticket.isWatching(user.username)) {
                  change.watch(user.username);
                }
                TicketModel update = app().tickets().updateTicket(repository, ticket.number, change);
                app().tickets().createNotifier().sendMailing(update);
                setResponsePage(TicketsPage.class, getPageParameters());
              }
            };
            item.add(link);
          }
        };
        controls.add(responsibleView);

        /*
         * MILESTONE LIST
         */
        List<TicketMilestone> milestones = app().tickets().getMilestones(repository, Status.Open);
        if (!StringUtils.isEmpty(ticket.milestone)) {
          for (TicketMilestone milestone : milestones) {
            if (milestone.name.equals(ticket.milestone)) {
              milestones.remove(milestone);
              break;
            }
          }
        }
        milestones.add(new TicketMilestone(ESC_NIL));
        ListDataProvider<TicketMilestone> milestoneDp = new ListDataProvider<TicketMilestone>(milestones);
        DataView<TicketMilestone> milestoneView = new DataView<TicketMilestone>("newMilestone", milestoneDp) {
          private static final long serialVersionUID = 1L;

          @Override
          public void populateItem(final Item<TicketMilestone> item) {
            SimpleAjaxLink<TicketMilestone> link = new SimpleAjaxLink<TicketMilestone>("link", item.getModel()) {

              private static final long serialVersionUID = 1L;

              @Override
              public void onClick(AjaxRequestTarget target) {
                TicketMilestone milestone = getModel().getObject();
                Change change = new Change(user.username);
                if (NIL.equals(milestone.name) || ESC_NIL.equals(milestone.name)) {
                  change.setField(Field.milestone, "");
                } else {
                  change.setField(Field.milestone, milestone.name);
                }
                if (!ticket.isWatching(user.username)) {
                  change.watch(user.username);
                }
                TicketModel update = app().tickets().updateTicket(repository, ticket.number, change);
                app().tickets().createNotifier().sendMailing(update);
                setResponsePage(TicketsPage.class, getPageParameters());
              }
            };
            item.add(link);
View Full Code Here

    Change change = new Change(user.username);
    change.review(ps, score, !ticket.isReviewer(user.username));
    if (!ticket.isWatching(user.username)) {
      change.watch(user.username);
    }
    TicketModel updatedTicket = app().tickets().updateTicket(getRepositoryModel(), ticket.number, change);
    app().tickets().createNotifier().sendMailing(updatedTicket);
    setResponsePage(TicketsPage.class, getPageParameters());
  }
View Full Code Here

            @Override
            public void onClick(AjaxRequestTarget target) {

              // ensure the patchset is still current AND not vetoed
              Patchset patchset = ticket.getCurrentPatchset();
              final TicketModel refreshedTicket = app().tickets().getTicket(getRepositoryModel(), ticket.number);
              if (patchset.equals(refreshedTicket.getCurrentPatchset())) {
                // patchset is current, check for recent veto
                if (!refreshedTicket.isVetoed(patchset)) {
                  // patchset is not vetoed

                  // execute the merge using the ticket service
                  app().tickets().exec(new Runnable() {
                    @Override
View Full Code Here

    try {
      Map<String, Ref> refs = getRepository().getRefDatabase().getRefs(Constants.R_TICKETS_PATCHSETS);
      for (Map.Entry<String, Ref> entry : refs.entrySet()) {
        if (entry.getValue().getObjectId().equals(commit.getId())) {
          long id = PatchsetCommand.getTicketNumber(entry.getKey());
          TicketModel ticket = app().tickets().getTicket(getRepositoryModel(), id);
          return ticket;
        }
      }
    } catch (Exception e) {
      logger().error("failed to determine ticket from ref", e);
View Full Code Here

          newComment.comment(txt);
          if (!ticket.isWatching(user.username)) {
            newComment.watch(user.username);
          }
          RepositoryModel repository = app().repositories().getRepositoryModel(ticket.repository);
          TicketModel updatedTicket = app().tickets().updateTicket(repository, ticket.number, newComment);
          if (updatedTicket != null) {
            app().tickets().createNotifier().sendMailing(updatedTicket);
            setResponsePage(pageClass, WicketUtils.newObjectParameter(updatedTicket.repository, "" + ticket.number));
          } else {
            error("Failed to add comment!");
View Full Code Here

            }
            String tid = path.path.split("/")[2];
            long ticketId = Long.parseLong(tid);
            if (!ids.contains(ticketId)) {
              ids.add(ticketId);
              TicketModel ticket = getTicket(repository, ticketId);
              log.info(MessageFormat.format("indexing ticket #{0,number,0}: {1}",
                  ticketId, ticket.title));
              indexer.index(ticket);
            }
          }
View Full Code Here

TOP

Related Classes of com.gitblit.models.TicketModel$Change

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.