Package com.gitblit.models

Examples of com.gitblit.models.TicketModel


          List<Change> changes = TicketSerializer.deserializeJournal(json);
          if (ArrayUtils.isEmpty(changes)) {
            log.warn("Empty journal for {}:{}", repository, path.path);
            continue;
          }
          TicketModel ticket = TicketModel.buildTicket(changes);
          ticket.project = repository.projectPath;
          ticket.repository = repository.name;
          ticket.number = ticketId;

          // add the ticket, conditionally, to the list
View Full Code Here


      List<Change> changes = getJournal(db, ticketId);
      if (ArrayUtils.isEmpty(changes)) {
        log.warn("Empty journal for {}:{}", repository, ticketId);
        return null;
      }
      TicketModel ticket = TicketModel.buildTicket(changes);
      if (ticket != null) {
        ticket.project = repository.projectPath;
        ticket.repository = repository.name;
        ticket.number = ticketId;
      }
View Full Code Here

    if (ticketId <= 0L) {
      return null;
    }

    // deserialize the ticket model so that we have the attachment metadata
    TicketModel ticket = getTicket(repository, ticketId);
    Attachment attachment = ticket.getAttachment(filename);

    // attachment not found
    if (attachment == null) {
      return null;
    }
View Full Code Here

      for (long id : ids) {
        List<Change> journal = inputService.getJournal(repository, id);
        if (journal == null || journal.size() == 0) {
          continue;
        }
        TicketModel ticket = outputService.createTicket(repository, id, journal.get(0));
        if (ticket == null) {
          System.err.println(String.format("Failed to migrate %s #%s", repository.name, id));
          System.exit(1);
        }
        totalTickets++;
        System.out.println(String.format("%s #%s: %s", repository.name, ticket.number, ticket.title));
        for (int i = 1; i < journal.size(); i++) {
          TicketModel updated = outputService.updateTicket(repository, ticket.number, journal.get(i));
          if (updated != null) {
            System.out.println(String.format("   applied change %d", i));
            totalChanges++;
          } else {
            System.err.println(String.format("Failed to apply change %d:\n%s", i, journal.get(i)));
View Full Code Here

      TicketNotifier notifier = createNotifier();
      for (QueryResult qr : tm.tickets) {
        Change change = new Change(createdBy);
        change.setField(Field.milestone, newName);
        TicketModel ticket = updateTicket(repository, qr.number, change);
        if (notifyOpenTickets && ticket.isOpen()) {
          notifier.queueMailing(ticket);
        }
      }
      if (notifyOpenTickets) {
        notifier.sendAll();
View Full Code Here

      TicketNotifier notifier = createNotifier();
      for (QueryResult qr : tm.tickets) {
        Change change = new Change(createdBy);
        change.setField(Field.milestone, "");
        TicketModel ticket = updateTicket(repository, qr.number, change);
        if (notifyOpenTickets && ticket.isOpen()) {
          notifier.queueMailing(ticket);
        }
      }
      if (notifyOpenTickets) {
        notifier.sendAll();
View Full Code Here

   * @return a ticket, if it exists, otherwise null
   * @since 1.4.0
   */
  public final TicketModel getTicket(RepositoryModel repository, long ticketId) {
    TicketKey key = new TicketKey(repository, ticketId);
    TicketModel ticket = ticketsCache.getIfPresent(key);

    // if ticket not cached
    if (ticket == null) {
      //load ticket
      ticket = getTicketImpl(repository, ticketId);
      // if ticket exists
      if (ticket != null) {
        if (ticket.hasPatchsets() && updateDiffstats) {
          Repository r = repositoryManager.getRepository(repository.name);
          try {
            Patchset patchset = ticket.getCurrentPatchset();
            DiffStat diffStat = DiffUtils.getDiffStat(r, patchset.base, patchset.tip);
            // diffstat could be null if we have ticket data without the
            // commit objects.  e.g. ticket replication without repo
            // mirroring
            if (diffStat != null) {
View Full Code Here

    change.setField(Field.status, Status.New);

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

      // call the ticket hooks
      if (pluginManager != null) {
        for (TicketHook hook : pluginManager.getExtensions(TicketHook.class)) {
View Full Code Here

    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

TOP

Related Classes of com.gitblit.models.TicketModel

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.