本文整理汇总了Java中org.eclipse.mylyn.tasks.core.TaskRepository类的典型用法代码示例。如果您正苦于以下问题:Java TaskRepository类的具体用法?Java TaskRepository怎么用?Java TaskRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskRepository类属于org.eclipse.mylyn.tasks.core包,在下文中一共展示了TaskRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSubtask
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
public NbTask createSubtask (NbTask parentTask) throws CoreException {
ensureTaskListLoaded();
TaskRepository taskRepository = taskRepositoryManager.getRepository(parentTask.getDelegate().getRepositoryUrl());
if (taskRepository == null || parentTask.isUnsubmittedRepositoryTask()) {
throw new IllegalStateException("Task repository: " + parentTask.getDelegate().getRepositoryUrl()
+ " - parent: " + parentTask.isUnsubmittedRepositoryTask());
}
AbstractTask task = createNewTask(taskRepository);
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
AbstractTaskDataHandler taskDataHandler = repositoryConnector.getTaskDataHandler();
TaskAttributeMapper attributeMapper = repositoryConnector.getTaskDataHandler().getAttributeMapper(taskRepository);
TaskData taskData = new TaskData(attributeMapper, repositoryConnector.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
taskDataHandler.initializeSubTaskData(taskRepository, taskData, parentTask.getTaskDataState().getRepositoryData(), new NullProgressMonitor());
initializeTask(repositoryConnector, taskData, task, taskRepository);
return MylynSupport.getInstance().toNbTask(task);
}
示例2: initializeTask
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
private void initializeTask (AbstractRepositoryConnector repositoryConnector, TaskData taskData, AbstractTask task, TaskRepository taskRepository) throws CoreException {
ITaskMapping mapping = repositoryConnector.getTaskMapping(taskData);
String taskKind = mapping.getTaskKind();
if (taskKind != null && taskKind.length() > 0) {
task.setTaskKind(taskKind);
}
ITaskDataWorkingCopy workingCopy = taskDataManager.createWorkingCopy(task, taskData);
workingCopy.save(null, null);
repositoryConnector.updateNewTaskFromTaskData(taskRepository, task, taskData);
String summary = mapping.getSummary();
if (summary != null && summary.length() > 0) {
task.setSummary(summary);
}
if (taskRepository == localTaskRepository) {
taskList.addTask(task);
} else {
taskList.addTask(task, taskList.getUnsubmittedContainer(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL)));
}
task.setAttribute(AbstractNbTaskWrapper.ATTR_NEW_UNREAD, Boolean.TRUE.toString());
}
示例3: setRepositoryUrl
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
public void setRepositoryUrl (TaskRepository repository, String url) throws CoreException {
String oldUrl = repository.getRepositoryUrl();
if (!url.equals(oldUrl)) {
ensureTaskListLoaded();
assert taskRepositoryManager.getRepositoryConnector(repository.getConnectorKind()) != null
: "Did you forget to implement RepositoryConnectorProvider?";
try {
for (ITask task : taskList.getAllTasks()) {
if (url.equals(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL))) {
taskDataManager.refactorRepositoryUrl(task, task.getRepositoryUrl(), url);
} else if (oldUrl.equals(task.getRepositoryUrl())) {
taskDataManager.refactorRepositoryUrl(task, url, url);
}
}
} catch (Throwable t) {
// log, but set the rapository & co
LOG.log(Level.WARNING, null, t);
}
taskList.refactorRepositoryUrl(oldUrl, url);
repository.setRepositoryUrl(url);
taskRepositoryManager.notifyRepositoryUrlChanged(repository, oldUrl);
}
}
示例4: getTaskDataModel
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
NbTaskDataModel getTaskDataModel (NbTask task) {
assert taskListInitialized;
ITask mylynTask = task.getDelegate();
mylynTask.setAttribute(MylynSupport.ATTR_TASK_INCOMING_NEW, null);
TaskRepository taskRepository = getTaskRepositoryFor(mylynTask);
try {
ITaskDataWorkingCopy workingCopy = taskDataManager.getWorkingCopy(mylynTask);
if (workingCopy instanceof TaskDataState && workingCopy.getLastReadData() == null) {
((TaskDataState) workingCopy).setLastReadData(workingCopy.getRepositoryData());
}
return new NbTaskDataModel(taskRepository, task, workingCopy);
} catch (CoreException ex) {
MylynSupport.LOG.log(Level.INFO, null, ex);
return null;
}
}
示例5: setupTaskRepository
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
/**
* If oldUrl is not null, gets the repository for the oldUrl and rewrites it
* to the new url.
*/
private static TaskRepository setupTaskRepository (String name, String oldUrl, String url, String user,
char[] password, String httpUser, char[] httpPassword,
boolean shortLoginEnabled) {
TaskRepository repository;
if (oldUrl == null) {
repository = MylynSupport.getInstance().getTaskRepository(Bugzilla.getInstance().getRepositoryConnector(), url);
} else {
repository = MylynSupport.getInstance().getTaskRepository(Bugzilla.getInstance().getRepositoryConnector(), oldUrl);
try {
MylynSupport.getInstance().setRepositoryUrl(repository, url);
} catch (CoreException ex) {
Bugzilla.LOG.log(Level.WARNING, null, ex);
}
}
setupProperties(repository, name, user, password, httpUser, httpPassword, shortLoginEnabled);
return repository;
}
示例6: readComment
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
private void readComment(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository, String comment) throws CoreException {
// refresh
data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_COMMENT);
assertNotNull(attributes);
boolean fail = true;
for (TaskAttribute ta : attributes) {
if(ta.getMappedAttribute(TaskAttribute.COMMENT_TEXT).getValue().equals(comment)) {
fail = false;
break;
}
}
if(fail) {
fail("Couldn't find comment text [" + comment + "] for taskdata [" + data.getTaskId() + "]");
}
}
示例7: updateTaskData
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的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);
}
示例8: addAttachement
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的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;
}
示例9: readAttachement
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
private void readAttachement(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository, String content) throws Exception {
// refresh
data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_ATTACHMENT);
TaskAttribute attribute = attributes.get(0);
TaskAttachmentMapper attachment = TaskAttachmentMapper.createFrom(attribute);
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream is = brc.getClientManager().getClient(repository, nullProgressMonitor).getAttachmentData(attachment.getAttachmentId(), nullProgressMonitor);
FileUtils.copyStream(is, os);
try {
// byte[] d = new byte[4];
// os.read(d);
assertEquals(content, os.toString());
} finally {
if(os != null) os.close();
}
}
示例10: closeIssue
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的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());
}
示例11: hasTaskChanged
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
@Override
public boolean hasTaskChanged(@NonNull TaskRepository taskRepository, @NonNull ITask task,
@NonNull TaskData taskData) {
Date changedAtTaskData = taskData.getAttributeMapper()
.getDateValue(taskData.getRoot().getAttribute(TaskAttribute.DATE_MODIFICATION));
Date changedAtTask = task.getModificationDate();
if (changedAtTask == null || changedAtTaskData == null)
return true;
if (!changedAtTask.equals(changedAtTaskData))
return true;
return false;
}
示例12: createSynchronizeQueriesCommand
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
public SynchronizeQueryCommand createSynchronizeQueriesCommand (TaskRepository taskRepository, IRepositoryQuery iquery, IProgressMonitor monitor) {
assert iquery instanceof RepositoryQuery;
RepositoryQuery repositoryQuery;
if (iquery instanceof RepositoryQuery) {
repositoryQuery = (RepositoryQuery) iquery;
} else {
return null;
}
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
return new SynchronizeQueryCommand(repositoryModel, repositoryConnector,
taskRepository, taskList, taskDataManager, repositoryQuery, monitor);
}
示例13: createPostAttachmentCommand
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
public PostAttachmentCommand createPostAttachmentCommand (TaskRepository taskRepository, NbTask task,
TaskAttribute attAttribute, FileTaskAttachmentSource attachmentSource, String comment) {
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
return new PostAttachmentCommand(repositoryConnector, taskRepository,
Accessor.getInstance().getDelegate(task),
attAttribute, attachmentSource, comment);
}
示例14: SynchronizeQueryCommand
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
SynchronizeQueryCommand (RepositoryModel repositoryModel,
AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository,
TaskList taskList, TaskDataManager taskDataManager, RepositoryQuery query, IProgressMonitor monitor)
{
this.repositoryModel = repositoryModel;
this.repositoryConnector = repositoryConnector;
this.taskRepository = taskRepository;
this.taskList = taskList;
this.taskDataManager = taskDataManager;
this.query = query;
this.monitor = monitor;
}
示例15: PostAttachmentCommand
import org.eclipse.mylyn.tasks.core.TaskRepository; //导入依赖的package包/类
PostAttachmentCommand (AbstractRepositoryConnector repositoryConnector,
TaskRepository taskRepository,
ITask task,
TaskAttribute ta,
AbstractTaskAttachmentSource taskAttachmentSource,
String comment) {
this.attAttribute = ta;
this.task = task;
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.taskAttachmentSource = taskAttachmentSource;
this.comment = comment;
}