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

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


   
  }

  @Test
  public void createIssue_statusChanged() throws Exception {
    TaskData taskData = buildEmptyTaskData(TestData.issue2);
    fillTaskData(taskData, TestData.issue2);

    //Change Status (mark as)
    TaskAttribute attribute = taskData.getRoot().getAttribute(TaskAttribute.OPERATION);
    attribute.setValue(RedmineOperation.markas.getTaskKey());

    attribute = taskData.getRoot().getAttribute(RedmineAttribute.STATUS_CHG.getTaskKey());
    attribute.setValue("4");
   
    Issue issue = IssueMapper.createIssue(repository, taskData, null, cfg);
    assertNotNull(issue);
   
View Full Code Here


    assertEquals(4, issue.getStatusId());
  }
 
  @Test
  public void createIssue_watchersChanged() throws Exception {
    TaskData taskData = buildEmptyTaskData(TestData.issue2);
    fillTaskData(taskData, TestData.issue2);

    //Old watchers
    TaskAttribute watchers = taskData.getRoot().getAttribute(RedmineAttribute.WATCHERS.getTaskKey());
    watchers.setValue("1");
    watchers.addValue("2");
   
    //Add a new watcher
    watchers.getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey()).setValue("3");
View Full Code Here

    assertEquals("[2, 3]", Arrays.toString(issue.getWatcherIds()));
  }
 
  @Test
  public void createTimeEntry() throws Exception {
    TaskData taskData = buildEmptyTaskData(TestData.issue2);
    fillTaskData(taskData, TestData.issue2);
   
    TimeEntry timeEntry = IssueMapper.createTimeEntry(repository, taskData, null, cfg);
    assertNotNull(timeEntry);
   
View Full Code Here

    assertEquals("1", customValues.getByCustomFieldId(7).getValue());
    assertEquals("2010-08-20", customValues.getByCustomFieldId(10).getValue());
  }

  TaskData buildEmptyTaskData(Issue issue) throws Exception {
    TaskData taskData = new TaskData(new RedmineTaskAttributeMapper(repository, cfg), RedmineCorePlugin.REPOSITORY_KIND, repository.getUrl(), "" + issue.getId());
 
    Method m = RedmineTaskDataHandler.class.getDeclaredMethod("createAttributes", TaskRepository.class, TaskData.class, Issue.class, Configuration.class);
    m.setAccessible(true);
    m.invoke(taskDataHandler, repository, taskData, issue, cfg);
   
View Full Code Here

  public void open() {
      String product = "";
     
      try {
        TaskData taskData = TasksUi.getTaskDataManager().getTaskData(task);
        product = taskData.getRoot().getMappedAttribute(RedmineAttribute.PROJECT.getTaskKey()).getValue();
       
        AbstractRepositoryConnector reposConn = TasksUi.getRepositoryConnector(taskRepository.getConnectorKind());
        if (reposConn instanceof RedmineRepositoryConnector) {
          RedmineRepositoryConnector redmineReposConnector = (RedmineRepositoryConnector)reposConn;
         
View Full Code Here

  }

  public TaskData createPartialTaskData(TaskRepository repository,
      IProgressMonitor monitor,String user, String project, GitHubIssue issue) {

    TaskData data = new TaskData(getAttributeMapper(repository),
        GitHubRepositoryConnector.KIND, repository.getRepositoryUrl(),
        issue.getNumber());
    data.setVersion(DATA_VERSION);
   
    createOperations(data,issue);
   
   
    createAttribute(data, GitHubTaskAttributes.KEY,issue.getNumber());
    createAttribute(data, GitHubTaskAttributes.TITLE, issue.getTitle());
    createAttribute(data, GitHubTaskAttributes.BODY, issue.getBody());
    createAttribute(data, GitHubTaskAttributes.STATUS, issue.getState());
    createAttribute(data, GitHubTaskAttributes.CREATION_DATE, toLocalDate(issue.getCreated_at()));
    createAttribute(data, GitHubTaskAttributes.MODIFICATION_DATE, toLocalDate(issue.getCreated_at()));
    createAttribute(data, GitHubTaskAttributes.CLOSED_DATE, toLocalDate(issue.getClosed_at()));
   
    if (isPartial(data)) {
      data.setPartial(true);
    }

    return data;
  }
View Full Code Here

  }

  public TaskData createTaskData(TaskRepository repository,
      IProgressMonitor monitor, String user, String project,
      GitHubIssue issue) {
    TaskData taskData = createPartialTaskData(repository, monitor, user, project, issue);
    taskData.setPartial(false);
   
    return taskData;
  }
View Full Code Here

            status, query
                .getAttribute("queryText"));
 
        // collect task data
        for (GitHubIssue issue : issues.getIssues()) {
          TaskData taskData = taskDataHandler.createPartialTaskData(
              repository, monitor,user, project, issue);
          collector.accept(taskData);
        }
        monitor.worked(1);
      }
View Full Code Here

    String user = GitHub.computeTaskRepositoryUser(repository.getUrl());
    String project = GitHub.computeTaskRepositoryProject(repository.getUrl());
   
    try {
      GitHubIssue issue = service.showIssue(user, project, taskId);
      TaskData taskData = taskDataHandler.createTaskData(repository, monitor, user, project, issue);
     
      return taskData;
    } catch (GitHubServiceException e) {
      throw new CoreException(GitHub.createErrorStatus(e));
    }
View Full Code Here

    public TaskData updateTaskData(TaskRepository repository, IssuesEntry issueEntry,
            IProgressMonitor monitor) throws CoreException {
        String repositoryUrl = repository.getRepositoryUrl();

        String issueId = getIssueId(issueEntry);
        TaskData data = new TaskData(getAttributeMapper(repository), repository.getConnectorKind(),
                repositoryUrl, issueId);
        this.initializeTaskData(repository, data, null, monitor);

        String title = issueEntry.getTitle().getPlainText();
        setAttributeValue(data, GoogleCodeAttribute.SUMMARY, title);
        setAttributeValue(data, GoogleCodeAttribute.USER_REPORTER, issueEntry.getAuthors().get(0).getName());
       
        String summary = getPlainTextContent(issueEntry, true);
        if (data.isNew()) {
            setAttributeValue(data, GoogleCodeAttribute.DESCRIPTION_NEW, summary);
        } else {
            setAttributeValue(data, GoogleCodeAttribute.DESCRIPTION_EXISTING, summary);
        }
        setAttributeValue(data, GoogleCodeAttribute.TASK_KEY, issueId);

        if (issueEntry.hasStatus()) {
            // {Status value=Fixed}{Status value=Duplicate}{Status
            // value=WontFix}{Status value=Accepted}
            Status status = issueEntry.getStatus();
            setAttributeValue(data, GoogleCodeAttribute.STATUS, status.getValue());
        }

        if (issueEntry.hasLabels()) {
            // [{Label value=Type-Defect}, {Label value=Priority-Medium}, {Label
            // value=Type-Enhancement}]
            for (Label label : issueEntry.getLabels()) {
                if (label.hasValue()) {
                    String value = label.getValue();
                    if (value.startsWith("Type-")) {
                        String type = value.substring("Type-".length());
                        setAttributeValue(data, GoogleCodeAttribute.TYPE, type);
                    } else if (value.startsWith("Priority-")) {
                        String priority = value.substring("Priority-".length());
                        PriorityLevel level = LabelUtils.convertToMylyn(priority);
                        if (level != null) {
                            setAttributeValue(data, GoogleCodeAttribute.PRIORITY, level.toString());
                        }
                    } else if (value.startsWith("Milestone-")) {
                        String milestone = value.substring("Milestone-".length());
                        setAttributeValue(data, GoogleCodeAttribute.MILESTONE, milestone);
                    }
                }
            }
        }

        setAttributeValue(data, GoogleCodeAttribute.DATE_CREATION, issueEntry.getPublished());
        setAttributeValue(data, GoogleCodeAttribute.DATE_MODIFICATION, issueEntry.getUpdated());

        if (issueEntry.hasOwner()) {
            IRepositoryPerson owner = getPerson(data, issueEntry.getOwner());
            setAttributeValue(data, GoogleCodeAttribute.USER_ASSIGNED, owner);
        }

        if (!data.isNew()) {
            TaskAttribute url = getAttribute(data, GoogleCodeAttribute.URL);
            url.setValue(this.connector.getTaskUrl(repository.getUrl(), issueId));
        }

        IGoogleCodeClient client = getClient(repository);
        IssueCommentsFeed comments = client.getAllComments(issueId, monitor);
        if (!data.isNew()) {
            addComments(issueId, data, comments, monitor);
        }

        // Set the completion date, this allows Mylyn mark the issue as
        // completed
        // There is no API for this so we make an educated guess
        State state = issueEntry.getState();
        if (!data.isNew() && Value.CLOSED == state.getValue()) {
            // find the last comment that set the issue status to the current
            // value
            // it would be better to find the last comment to set that state to
            // closed
            // but as long as we can't do that this will have to do

            // initialize with issue creation date in case we don't find any
            // comments
            DateTime closingDate = issueEntry.getPublished();
            for (IssueCommentsEntry comment : comments.getEntries()) {
                Updates updates = comment.getUpdates();
                if (updates != null && issueEntry.getStatus().equals(updates.getStatus())) {
                    closingDate = comment.getPublished();
                }
            }
            setAttributeValue(data, GoogleCodeAttribute.DATE_COMPLETION, closingDate);
        }

        data.getAttributeMapper().setIntegerValue(getAttribute(data, GoogleCodeAttribute.STARS),
                issueEntry.getStars().getValue());

        List<BlockedOn> blockedOn = issueEntry.getBlockedOns();
        List<String> rawBlockOns = new ArrayList<String>();
        for (BlockedOn blocking : blockedOn) {
View Full Code Here

TOP

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

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.