当前位置: 首页>>代码示例>>Java>>正文


Java TaskAttribute.setValue方法代码示例

本文整理汇总了Java中org.eclipse.mylyn.tasks.core.data.TaskAttribute.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java TaskAttribute.setValue方法的具体用法?Java TaskAttribute.setValue怎么用?Java TaskAttribute.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.mylyn.tasks.core.data.TaskAttribute的用法示例。


在下文中一共展示了TaskAttribute.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setValue

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void setValue (NbTaskDataModel model, TaskAttribute ta, String value) {
    TaskData repositoryTaskData = model.getRepositoryTaskData();
    if (value.isEmpty() && repositoryTaskData != null) {
        // should be empty or set to ""???
        TaskAttribute a = repositoryTaskData.getRoot().getAttribute(ta.getId());
        if (a == null || a.getValues().isEmpty()) {
            // repository value is also empty list, so let's set to the same
            ta.clearValues();
        } else {
            ta.setValue(value);
        }
    } else {
        ta.setValue(value);
    }
    model.attributeChanged(ta);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BugzillaIssue.java

示例2: closeTask

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void closeTask (String resolution) {
    TaskOperation taskOperation = null;
    TaskAttribute opAttr = model.getLocalTaskData().getRoot().getMappedAttribute(TaskAttribute.OPERATION);
    for (TaskOperation op : model.getLocalTaskData().getAttributeMapper().getTaskOperations(opAttr)) {
        if (BugzillaOperation.resolve.getLabel().equals(op.getLabel())) {
            taskOperation = op;
            break;
        }
    }
    assertNotNull(taskOperation);
    assertFalse(task.isCompleted());
    model.getLocalTaskData().getAttributeMapper().setTaskOperation(opAttr, taskOperation);
    model.attributeChanged(opAttr);
    TaskAttribute resolutionAttr = model.getLocalTaskData().getRoot().getMappedAttribute(BugzillaOperation.resolve.getInputId());
    resolutionAttr.setValue(resolution);
    model.attributeChanged(resolutionAttr);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MylynStorageTest.java

示例3: updateTaskData

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void updateTaskData(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws CoreException {
      data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
TaskAttribute attrModification1 = data.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);

      TaskAttribute rta = data.getRoot();
      TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.USER_ASSIGNED);
      ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
      String val = ta.getValue();
      ta.setValue(val + " updated");
      Set<TaskAttribute> attrs = new HashSet<TaskAttribute>();
      attrs.add(ta);
      RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, attrs, new NullProgressMonitor());
      assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);

      data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
      rta = data.getRoot();
      ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
      assertEquals(val + " updated", ta.getValue());

      TaskAttribute attrModification2 = data.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
      assertNotSame(attrModification1, attrModification2);

  }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:BugzillaTest.java

示例4: addAttachement

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private TaskData addAttachement(TaskData data,  BugzillaRepositoryConnector brc, TaskRepository repository, String comment, String desc, String content) throws Exception {
//        Task task = new Task(getRepository().getRepositoryUrl(), getRepository().getConnectorKind(), key, taskId, "");
        File f = getAttachmentFile(content);

        FileTaskAttachmentSource attachmentSource = new FileTaskAttachmentSource(f);
        attachmentSource.setContentType("text/plain");

//        List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_ATTACHMENT);
        TaskAttribute attAttribute = new TaskAttribute(data.getRoot(),  TaskAttribute.TYPE_ATTACHMENT);
        TaskAttribute a = attAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_DESCRIPTION);
        a.setValue(desc);
        String bugId = data.getTaskId();
        brc.getClientManager().getClient(repository, nullProgressMonitor)
                .postAttachment(bugId, comment, attachmentSource, attAttribute, nullProgressMonitor);

        data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
        List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_ATTACHMENT);
        assertTrue(attributes.size() > 0);
        return data;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:BugzillaTest.java

示例5: closeIssue

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void closeIssue(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws Exception {
    //RepositoryConfiguration rc = brc.getClientManager().getClient(repository, nullProgressMonitor).getRepositoryConfiguration();

    // refresh
    data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);

    Set<TaskAttribute> attrs = new HashSet<TaskAttribute>();
    TaskAttribute rta = data.getRoot();

    TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.OPERATION);
    ta.setValue("resolve");
    attrs.add(ta);

    ta = rta.getMappedAttribute(TaskAttribute.STATUS);
    ta.setValue("FIXED");
    attrs.add(ta);

    RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, attrs, nullProgressMonitor);
    assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);

    data = brc.getTaskData(repository, rr.getTaskId(), nullProgressMonitor);
    rta = data.getRoot();
    ta = rta.getMappedAttribute(TaskAttribute.STATUS);
    assertEquals("RESOLVED", ta.getValue());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BugzillaTest.java

示例6: initializeTaskData

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
@Override
public boolean initializeTaskData (TaskRepository repository, TaskData data, ITaskMapping initializationData, IProgressMonitor monitor) throws CoreException {
    TaskAttribute ta = data.getRoot().createAttribute(ATTRIBUTE_KEY_SUMMARY);
    String value = initializationData.getSummary();
    if (value != null) {
        ta.setValue(value);
    }
    data.getRoot().createAttribute(ATTRIBUTE_KEY_NB_ATTACHMENTS);
    data.getRoot().createAttribute(ATTRIBUTE_KEY_NB_REFERENCES);
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:LocalTaskDataHandler.java

示例7: testRefreshConfigOnMidAir

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public void testRefreshConfigOnMidAir() throws Throwable {
    BugzillaRepository repository = TestUtil.getRepository("test", REPO_URL, REPO_USER, REPO_PASSWD);
    
    String id = TestUtil.createIssue(repository, "testRefreshConfigOnMidAir");
    
    BugzillaIssue issue = repository.getIssue(id);
    issue.addComment("comment1");
    
    // add comment bypassing the issue to cause a midair collision
    TaskData data2 = TestUtil.getTaskData(repository.getTaskRepository(), id);
    TaskAttribute ta2 = data2.getRoot().createMappedAttribute(TaskAttribute.COMMENT_NEW);
    ta2.setValue("midairingcomment");
    TestUtil.postTaskData(brc, repository.getTaskRepository(), data2);
    
    // try to submit
    LogHandler lhExecute = new LogHandler("execute SubmitTaskCommand [task #"+id, LogHandler.Compare.STARTS_WITH, LogHandler.DEFAULT_TIMEOUT, 2);
    LogHandler lhRefresh = new LogHandler(" Refresh bugzilla configuration", LogHandler.Compare.STARTS_WITH, LogHandler.DEFAULT_TIMEOUT, 1);
    System.setProperty("netbeans.t9y.throwOnClientError", "true");
    
    Throwable st = null;
    try {
        IssueTestUtils.submit(issue);
    } catch (Throwable t) {
        st = t;
    }
    lhExecute.waitUntilDone();
    lhRefresh.waitUntilDone();
    assertEquals(2, lhExecute.getInterceptedCount());
    assertTrue(lhRefresh.isDone());
    assertTrue(st.getMessage().contains("Mid-air collision occurred while submitting"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ExceptionHandlerTest.java

示例8: testTaskRemovedFromQueryExt

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public void testTaskRemovedFromQueryExt () throws Exception {
    MylynSupport supp = MylynSupport.getInstance();
    IRepositoryQuery q = supp.getRepositoryQuery(btr, QUERY_NAME);
    Collection<NbTask> tasks = supp.getTasks(q);
    
    // get tasks from the query
    assertFalse(tasks.isEmpty());
    DummyQueryController controller = new DummyQueryController(q);
    // get a task to close
    NbTask task = tasks.iterator().next();
    assertTrue(controller.tasks.contains(task));
    
    // close the task externally
    assertFalse(task.isCompleted());
    TaskData external = task.getTaskDataState().getRepositoryData();
    TaskAttribute opAttr = external.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
    TaskOperation taskOperation = null;
    for (TaskOperation op : external.getAttributeMapper().getTaskOperations(opAttr)) {
        if (BugzillaOperation.resolve.getLabel().equals(op.getLabel())) {
            taskOperation = op;
            break;
        }
    }
    assertNotNull(taskOperation);
    external.getAttributeMapper().setTaskOperation(opAttr, taskOperation);
    TaskAttribute resolutionAttr = external.getRoot().getMappedAttribute(BugzillaOperation.resolve.getInputId());
    resolutionAttr.setValue("WONTFIX");
    SubmitCommand submitCmd = new SubmitCommand(Bugzilla.getInstance().getRepositoryConnector(), btr, external);
    br.getExecutor().execute(submitCmd);
    
    // refresh query
    SynchronizeQueryCommand cmd = supp.getCommandFactory().createSynchronizeQueriesCommand(btr, q);
    cmd.addCommandProgressListener(controller);
    br.getExecutor().execute(cmd);
    
    // task should be removed from the list
    assertFalse(controller.getTasks().contains(task));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:MylynStorageTest.java

示例9: createNewTask

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private NbTask createNewTask (String summary) throws CoreException {
    MylynSupport supp = MylynSupport.getInstance();
    ITaskMapping mapping = new TaskMapping() {

        @Override
        public String getProduct () {
            return PRODUCT;
        }

        @Override
        public String getComponent () {
            return COMPONENT;
        }
        
    };
    NbTask task = supp.createTask(btr, mapping);
    NbTaskDataModel model = task.getTaskDataModel();
    
    // model.getTaskData returns our local data
    TaskAttribute rta = model.getLocalTaskData().getRoot();
    assertFalse(model.isDirty());
    // now edit summary, product and component
    String newSummary = summary;
    TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
    ta.setValue(newSummary);
    model.attributeChanged(ta);
    
    // save
    model.save(new NullProgressMonitor());
    if (task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
        task.setSummary(newSummary);
    }
    return submitTask(task, model);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:MylynStorageTest.java

示例10: createTaskData

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public static TaskData createTaskData(BugzillaRepositoryConnector brc, TaskRepository repository, String summary, String desc, String typeName) throws MalformedURLException, CoreException {
    TaskAttributeMapper attributeMapper = brc.getTaskDataHandler().getAttributeMapper(repository);
    TaskData data = new TaskData(attributeMapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
    TaskAttribute rta = data.getRoot();
    TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.USER_ASSIGNED);
    ta = rta.createMappedAttribute(TaskAttribute.SUMMARY);
    ta.setValue(summary);
    ta = rta.createMappedAttribute(TaskAttribute.DESCRIPTION);
    ta.setValue(desc);

    BugzillaClient client = brc.getClientManager().getClient(repository, NULL_PROGRESS_MONITOR);
    RepositoryConfiguration rc = brc.getRepositoryConfiguration(repository, false, new NullProgressMonitor());
    String os = client.getRepositoryConfiguration().getOSs().get(0);
    ta = rta.createMappedAttribute(BugzillaAttribute.OP_SYS.getKey());
    ta.setValue(os);

    ta = rta.createMappedAttribute(BugzillaAttribute.PRODUCT.getKey());
    ta.setValue(TEST_PROJECT);

    String platform = client.getRepositoryConfiguration().getPlatforms().get(0);
    ta = rta.createMappedAttribute(BugzillaAttribute.REP_PLATFORM.getKey());
    ta.setValue(platform);

    String version = client.getRepositoryConfiguration().getVersions(TEST_PROJECT).get(0);
    ta = rta.createMappedAttribute(BugzillaAttribute.VERSION.getKey());
    ta.setValue(version);

    String component = client.getRepositoryConfiguration().getComponents(TEST_PROJECT).get(0);
    ta = rta.createMappedAttribute(BugzillaAttribute.COMPONENT.getKey());
    ta.setValue(component);

    return data;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:TestUtil.java

示例11: addComment

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public static RepositoryResponse addComment(TaskRepository taskRepository, TaskData data, String comment) throws CoreException {
    TaskAttribute ta = data.getRoot().createMappedAttribute(TaskAttribute.COMMENT_NEW);
    ta.setValue(comment);

    Set<TaskAttribute> attrs = new HashSet<TaskAttribute>();
    attrs.add(ta);
    return Bugzilla.getInstance().getRepositoryConnector().getTaskDataHandler().postTaskData(taskRepository, data, attrs, new NullProgressMonitor());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TestUtil.java

示例12: setValue

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void setValue (NbTaskDataModel model, TaskAttribute ta, String value) {
    ta.setValue(value);
    model.attributeChanged(ta);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:LocalTask.java

示例13: testSubmitTemporaryTask

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public void testSubmitTemporaryTask () throws Exception {
    MylynSupport supp = MylynSupport.getInstance();
    NbTask task = supp.getUnsubmittedTasksContainer(btr).getTasks().iterator().next();
    // edit the task
    NbTaskDataModel model = task.getTaskDataModel();
    
    // model.getTaskData returns our local data
    String defaultSummary = task.getSummary();
    TaskAttribute rta = model.getLocalTaskData().getRoot();
    assertFalse(model.isDirty());
    // now edit summary, product and component
    String newSummary = "Task summary testSubmitTemporaryTask";
    TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
    ta.setValue(newSummary);
    model.attributeChanged(ta);
    
    // now we have unsaved changes, the task is dirty
    assertTrue(model.isDirty());
    // not yet saved
    assertEquals(defaultSummary, task.getSummary());
    // save
    model.save(new NullProgressMonitor());
    // all saved?
    assertFalse(model.isDirty());
    // well, not exactly, for new unsubmitted task we need to manually refresh task's attributes
    assertEquals(defaultSummary, task.getSummary());
    if (task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
        task.setSummary(newSummary);
    }
    assertEquals(newSummary, task.getSummary());
    
    // let's submit finally
    NbTask submittedTask = submitTask(task, model);
    
    assertNotSame(task, submittedTask); // they difer, the new task is a persistent, not local one
    assertEquals(0, supp.getUnsubmittedTasksContainer(btr).getTasks().size());
    assertSame(submittedTask, supp.getTask(btr.getUrl(), submittedTask.getTaskId()));
    
    assertEquals(newSummary, task.getSummary());
    model = submittedTask.getTaskDataModel();
    assertSame(btr, model.getTaskRepository());
    assertSame(submittedTask, model.getTask());
    assertFalse(model.isDirty());
    assertTrue(model.hasBeenRead());
    assertTrue(model.getChangedAttributes().isEmpty());
    assertTrue(model.getChangedOldAttributes().isEmpty());
    assertEquals(SynchronizationState.SYNCHRONIZED, submittedTask.getSynchronizationState());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:MylynStorageTest.java

示例14: changeSummary

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void changeSummary (String newSummary) {
    TaskAttribute summaryAttr = model.getLocalTaskData().getRoot().getMappedAttribute(TaskAttribute.SUMMARY);
    summaryAttr.setValue(newSummary);
    model.attributeChanged(summaryAttr);
    assertTrue(model.isDirty());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MylynStorageTest.java

示例15: changeProduct

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void changeProduct(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws CoreException, IOException {
    data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);

    TaskAttribute rta = data.getRoot();
    TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.PRODUCT);

    BugzillaClient client = brc.getClientManager().getClient(repository, NULL_PROGRESS_MONITOR);
    
    List<String> products = client.getRepositoryConfiguration().getProducts();
    String newProject = TEST_PROJECT2;
    assertNotNull(newProject);
    ta.setValue(newProject);

    String version = client.getRepositoryConfiguration(NULL_PROGRESS_MONITOR).getVersions(newProject).get(0);
    ta = rta.getMappedAttribute(BugzillaAttribute.VERSION.getKey());
    ta.setValue(version);

    String component = client.getRepositoryConfiguration(NULL_PROGRESS_MONITOR).getComponents(newProject).get(0);
    ta = rta.getMappedAttribute(BugzillaAttribute.COMPONENT.getKey());
    ta.setValue(component);

    String milestone = client.getRepositoryConfiguration(NULL_PROGRESS_MONITOR).getTargetMilestones(newProject).get(0);
    ta = rta.getMappedAttribute(BugzillaAttribute.TARGET_MILESTONE.getKey());
    ta.setValue(milestone);

    ta = rta.getMappedAttribute(BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey());
    if (ta != null) {
        ta.setValue("1"); 
    }

    ta = rta.getMappedAttribute(BugzillaAttribute.CONFIRM_PRODUCT_CHANGE.getKey());
    if (ta == null) {
        ta = BugzillaTaskDataHandler.createAttribute(rta, BugzillaAttribute.CONFIRM_PRODUCT_CHANGE);
    }

    if (ta != null) {
        ta.setValue("1");
    }

    RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, null, new NullProgressMonitor());
    assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);


}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:45,代码来源:BugzillaTest.java


注:本文中的org.eclipse.mylyn.tasks.core.data.TaskAttribute.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。