Package net.sf.redmine_mylyn.api.model

Examples of net.sf.redmine_mylyn.api.model.Issue


    monitor.beginTask(Messages.PROGRESS_FETCH_ISSUE, 1);

    String uri = String.format(URL_ISSUE, id);
    GetMethod method = new GetMethod(uri);
   
    Issue issue = executeMethod(method, issueParser, monitor);

    if(monitor.isCanceled()) {
      throw new OperationCanceledException();
    } else {
      monitor.worked(1);
View Full Code Here


    return updatedOn;
  }
 
  public Issue toIssue() {
    try {
      Issue issue = new Issue();
      idField.setInt(issue, id);
      issue.setSubject(subject);
      issue.setProjectId(project);
      issue.setStatusId(status);
      issue.setPriorityId(priority);
      issue.setUpdatedOn(updatedOn);
      return issue;
    } catch (Exception e) {
      //should never happens
    }
    return null;
View Full Code Here

    this.configuration = configuration;
  }
 
  @Override
  public Issue parseResponse(InputStream input, int sc) throws RedmineApiErrorException {
    Issue issue = super.parseResponse(input, sc);
    if(issue!=null) {
      IssueStatus status = configuration.getIssueStatuses().getById(issue.getStatusId());
      issue.setClosed(status==null || status.isClosed());
    }
    return issue;
  }
View Full Code Here

  }
 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  static Issue buildIssue2() {
    try {
      Issue issue = new Issue();
     
      Field idField = Issue.class.getDeclaredField("id");
      idField.setAccessible(true);
      idField.setInt(issue, 2);
     
      issue.setSubject("Add ingredients categories");
      issue.setDescription("Ingredients of the recipe should be classified by categories");
      issue.setCreatedOn(new Date(1153335861000l));
      issue.setUpdatedOn(new Date(1153336190000l));
      issue.setTrackerId(2);
      issue.setProjectId(1);
      issue.setStatusId(2);
      issue.setPriorityId(5);
      issue.setSubtasks(new int[]{3,4});
      issue.setWatched(true);
      issue.setWatcherIds(new int[]{1,3});
      issue.setWatchersViewAllowed(true);
      issue.setWatchersAddAllowed(true);
      issue.setWatchersDeleteAllowed(true);
      issue.setStartDate(df.parse("2010-05-08"));
      //dueDate
      issue.setDoneRatio(10);
       issue.setEstimatedHours(3.5f);
      issue.setAuthorId(2);
      //categoryId
      issue.setAssignedToId(3);
      issue.setFixedVersionId(2);
      issue.setParentId(1);
     
      issue.setAvailableStatusId(new int[]{1,3,4,5,6,2});
     
      /* CustomValues */
      issue.setCustomValues(new CustomValues());
      List lst = getList(issue.getCustomValues());
      lst.add(buildCustomValue(5, 2, null));
      lst.add(buildCustomValue(11, 6, "2.05"));
      lst.add(buildCustomValue(12, 1, "Oracle"));
      lst.add(buildCustomValue(13, 9, "2009-12-01"));
     
      /* Journals */
      issue.setJournals(new Journals());
      lst = getList(issue.getJournals());
      lst.add(buildJournal(3, 2, 1273356000000l, "A comment with inline image: !picture.jpg!"));
     
      /* Attachments */
      issue.setAttachments(new Attachments());
      lst = getList(issue.getAttachments());
      lst.add(buildAttachment(10, 2, 1153336047000l, "picture.jpg", 452, "b91e08d0cf966d5c6ff411bd8c4cc3a2", "image/jpeg", "kurze Beschreibung"));
     
      /* IssueRelations */
     
      /* TimeEntries + sum*/
      TimeEntries timeEntries = new TimeEntries();
      timeEntries.setNewAllowed(true);
      timeEntries.setViewAllowed(true);
      Field sum = timeEntries.getClass().getDeclaredField("sum");
      sum.setAccessible(true);
      sum.setFloat(timeEntries, 4.25f);
      issue.setTimeEntries(timeEntries);
      lst = getList(timeEntries);
      lst.add(buildTimeEntry(1, 4.25f, 9, 2, "2007-03-23", "My hours", buildCustomValue(5, 7, "1")));
     
      return issue;

View Full Code Here

    assertEquals("", root.getAttribute(RedmineAttribute.PROGRESS.getTaskKey()).getValue());
  }
 
  @Test
  public void testUpdateTaskData_empty() throws Exception{
    Issue issue = new Issue();
    issue.setProjectId(1);
    issue.setTrackerId(1);
    TaskData taskData = buildEmptyTaskData(issue);
   
    TaskAttribute root = taskData.getRoot();
    IssueMapper.updateTaskData(repository, taskData, cfg, issue);
   
View Full Code Here

  @Test
  public void createIssue() throws Exception {
    TaskData taskData = buildEmptyTaskData(TestData.issue2);
    fillTaskData(taskData, TestData.issue2);
   
    Issue issue = IssueMapper.createIssue(repository, taskData, null, cfg);
    assertNotNull(issue);
   
    assertEquals(2, issue.getId());
    assertEquals("Add ingredients categories", issue.getSubject());
    assertEquals("Ingredients of the recipe should be classified by categories", issue.getDescription());
    assertEquals(1, issue.getProjectId());
    assertEquals(2, issue.getTrackerId());
    assertEquals(2, issue.getStatusId());
    assertEquals(1, issue.getParentId());
    assertEquals(5, issue.getPriorityId());
    assertEquals(0, issue.getCategoryId());
    assertEquals(3, issue.getAssignedToId());
    assertEquals(2, issue.getFixedVersionId());
    assertEquals(df.parse("2010-05-08"), issue.getStartDate());
    assertNull(issue.getDueDate());
    assertEquals(3.5f, issue.getEstimatedHours(), 0.0);
    assertEquals(10, issue.getDoneRatio());

    //CustomValues
    CustomValues customValues = issue.getCustomValues();
    assertNotNull(customValues);
    assertNotNull(customValues.getAll());
    assertEquals(4, customValues.getAll().size());
    assertEquals("", customValues.getByCustomFieldId(2).getValue());
    assertEquals("2.05", customValues.getByCustomFieldId(6).getValue());
View Full Code Here

    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);
   
    assertEquals(2, issue.getId());
    assertEquals(4, issue.getStatusId());
  }
View Full Code Here

    //Remove a watcher
    watchers.getAttribute(RedmineAttribute.WATCHERS_REMOVE.getTaskKey()).setValue("1");
   
    //expected 2,3
    Issue issue = IssueMapper.createIssue(repository, taskData, null, cfg);
    assertNotNull(issue);

    assertEquals("[2, 3]", Arrays.toString(issue.getWatcherIds()));
  }
View Full Code Here

    return new RedmineTaskAttributeMapper(repository, connector.getRepositoryConfiguration(repository));
  }
 
  @Override
  public boolean initializeSubTaskData(TaskRepository repository, TaskData taskData, TaskData parentTaskData, IProgressMonitor monitor) throws CoreException {
    Issue issue = new Issue();
   
    TaskAttribute parentRoot = parentTaskData.getRoot();
    issue.setProjectId(RedmineUtil.parseIntegerId(parentRoot.getAttribute(RedmineAttribute.PROJECT.getTaskKey()).getValue()));
    issue.setTrackerId(RedmineUtil.parseIntegerId(parentRoot.getAttribute(RedmineAttribute.TRACKER.getTaskKey()).getValue()));
   
   
    if(initializeNewTaskData(issue, repository, taskData, monitor)) {
      TaskAttribute childRoot = taskData.getRoot();
      childRoot.getAttribute(RedmineAttribute.PARENT.getTaskKey()).setValue(parentTaskData.getTaskId());
View Full Code Here

  }

  @Override
  public boolean initializeTaskData(TaskRepository repository, TaskData taskData, ITaskMapping taskMapping, IProgressMonitor monitor) throws CoreException {
    Configuration conf = connector.getRepositoryConfiguration(repository);
    Issue issue = new Issue();
   
    try {
      Project project = conf.getProjects().getAll().get(0);
      issue.setProjectId(project.getId());
      issue.setTrackerId(conf.getTrackers().getById(project.getTrackerIds()).get(0).getId());
     
      return initializeNewTaskData(issue, repository, taskData, monitor);
    } catch (RuntimeException e) {
      IStatus status = new Status(IStatus.ERROR, RedmineCorePlugin.PLUGIN_ID, Messages.ERRMSG_TASK_INITIALIZATION_FALED_INSUFFICENT_DATA, e);
      StatusHandler.log(status);
View Full Code Here

TOP

Related Classes of net.sf.redmine_mylyn.api.model.Issue

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.