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

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


    }

    /* 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


    return true;
  }

  @Override
  public InputStream getContent(TaskRepository repository, ITask task, TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws CoreException {
    TaskAttachmentMapper attachment = TaskAttachmentMapper.createFrom(attachmentAttribute);
    try {
      IClient client;
      client = connector.getClientManager().getClient(repository);
      return client.getAttachmentContent(RedmineUtil.parseIntegerId(attachment.getAttachmentId()), attachment.getFileName(), monitor);
    } catch (RedmineStatusException e) {
      throw new CoreException(e.getStatus());
    }
  }
View Full Code Here

  public void postContent(TaskRepository repository, ITask task, AbstractTaskAttachmentSource source, String comment, TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws CoreException {
    String fileName = source.getName();
    String description = source.getDescription();
   
    if (attachmentAttribute!=null) {
      TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute);
      if (mapper.getFileName() != null) {
        fileName = mapper.getFileName();
      }
      if (mapper.getComment() != null) {
        comment = mapper.getComment();
      }
      if (mapper.getDescription() != null) {
        description = mapper.getDescription();
      }
    }
   
    try {
      IClient client = connector.getClientManager().getClient(repository);
View Full Code Here

TOP

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

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.