Package org.eclipse.mylyn.tasks.core.data

Examples of org.eclipse.mylyn.tasks.core.data.TaskCommentMapper


   
    /* Journals */
    if(issue.getJournals()!=null) {
      int jrnlCount=1;
      for (Journal journal : issue.getJournals().getAll()) {
        TaskCommentMapper mapper = new TaskCommentMapper();
        mapper.setAuthor(repository.createPerson(""+journal.getUserId())); //$NON-NLS-1$
        mapper.setCreationDate(journal.getCreatedOn());
        mapper.setText(journal.getNotes());
        String issueUrl = RedmineRepositoryConnector.getTaskUrl(repository.getUrl(), issue.getId());
        mapper.setUrl(issueUrl + String.format(IRedmineConstants.REDMINE_URL_PART_COMMENT, journal.getId()));
        mapper.setNumber(jrnlCount++);
        mapper.setCommentId(String.valueOf(journal.getId()));
       
        taskAttribute = taskData.getRoot().createAttribute(TaskAttribute.PREFIX_COMMENT + mapper.getCommentId());
        mapper.applyTo(taskAttribute);
      }
    }

    /* Attachments */
    if(issue.getAttachments()!=null) {
      for (Attachment  attachment : issue.getAttachments().getAll()) {
        TaskAttachmentMapper mapper = new TaskAttachmentMapper();
        mapper.setAttachmentId("" + attachment.getId()); //$NON-NLS-1$
        mapper.setAuthor(repository.createPerson(""+attachment.getAuthorId())); //$NON-NLS-1$
        mapper.setDescription(attachment.getDescription());
        mapper.setCreationDate(attachment.getCreatedOn());
        mapper.setContentType(attachment.getContentType());
        mapper.setFileName(attachment.getFilename());
        mapper.setLength((long)attachment.getFilesize());
        mapper.setUrl(String.format(IRedmineConstants.REDMINE_URL_ATTACHMENT_DOWNLOAD, repository.getUrl(), attachment.getId()));
       
        taskAttribute = taskData.getRoot().createAttribute(TaskAttribute.PREFIX_ATTACHMENT + mapper.getAttachmentId());
        mapper.applyTo(taskAttribute);
      }
    }
   
    if(issue.getTimeEntries()!=null && issue.getTimeEntries().isViewAllowed()) {
      //TODO kind/label
      taskAttribute = taskData.getRoot().createAttribute(IRedmineConstants.TASK_ATTRIBUTE_TIMEENTRY_TOTAL);
     
      if(issue.getTimeEntries()!=null) {
        taskAttribute.setValue(""+issue.getTimeEntries().getSum()); //$NON-NLS-1$
       
       
        for (TimeEntry timeEntry : issue.getTimeEntries().getAll()) {
          RedmineTaskTimeEntryMapper mapper = new RedmineTaskTimeEntryMapper();
          mapper.setTimeEntryId(timeEntry.getId());
          mapper.setUser(repository.createPerson(""+timeEntry.getUserId())); //$NON-NLS-1$
          mapper.setActivityId(timeEntry.getActivityId());
          mapper.setHours(timeEntry.getHours());
          mapper.setSpentOn(timeEntry.getSpentOn());
          mapper.setComments(timeEntry.getComments());
          mapper.setCustomValues(timeEntry.getCustomValues().getAll());
         
          taskAttribute = taskData.getRoot().createAttribute(IRedmineConstants.TASK_ATTRIBUTE_TIMEENTRY_PREFIX + mapper.getTimeEntryId());
          mapper.applyTo(taskAttribute, cfg);
        }
      }
     
    } 
      
View Full Code Here


        for (IssueCommentsEntry issueComment : comments.getEntries()) {
            String content = getPlainTextContent(issueComment, false);
            if (!(StringUtils.isEmpty(content))) {
                TaskAttribute attribute = data.getRoot().createAttribute(
                        TaskAttribute.PREFIX_COMMENT + i);
                TaskCommentMapper taskComment = TaskCommentMapper.createFrom(attribute);
                // Comment id is something like
                // http://code.google.com/feeds/issues/p/googlecode-mylyn-connector/issues/1/comments/full/1
                String commentId = StringUtils.substringAfterLast(issueComment.getId(), "/");
                taskComment.setCommentId(commentId);
                List<Person> authors = issueComment.getAuthors();
                if (authors.size() == 1) {
                    IRepositoryPerson person = getPerson(data, authors.get(0));
                    taskComment.setAuthor(person);
                }
                taskComment.setNumber(i);
                taskComment.setText(content);
                taskComment.setCreationDate(new Date(issueComment.getPublished().getValue()));
                taskComment.setUrl(commentId);
                taskComment.applyTo(attribute);
            }
            i++;
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.mylyn.tasks.core.data.TaskCommentMapper

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.