Java源码示例:org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector
示例1
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
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
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);
}
示例4
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;
}
示例5
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;
}
示例6
GetRepositoryTasksCommand (AbstractRepositoryConnector connector,
TaskRepository taskRepository, Set<String> taskIds,
TaskDataManager taskDataManager) {
this.connector = connector;
this.taskRepository = taskRepository;
this.taskIds = taskIds;
this.taskDataManager = taskDataManager;
this.monitor = new CancelableProgressMonitor();
}
示例7
GetAttachmentCommand(AbstractRepositoryConnector repositoryConnector,
TaskRepository taskRepository,
ITask task,
TaskAttribute ta,
OutputStream os) {
this.ta = ta;
this.task = task;
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.os = os;
}
示例8
SubmitTaskCommand (TaskDataManager taskDataManager,
AbstractRepositoryConnector repositoryConnector,
TaskRepository taskRepository, ITask task, TaskData taskData,
Set<TaskAttribute> changedOldAttributes) {
this.taskDataManager = taskDataManager;
this.repositoryConnector = repositoryConnector;
this.taskRepository = taskRepository;
this.task = task;
this.taskData = taskData;
this.changedOldAttributes = changedOldAttributes;
this.monitor = new CancelableProgressMonitor();
}
示例9
SimpleQueryCommand (AbstractRepositoryConnector repositoryConnector,
TaskRepository taskRepository, TaskDataManager taskDataManager,
IRepositoryQuery query) {
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.query = query;
this.taskDataManager = taskDataManager;
this.monitor = new CancelableProgressMonitor();
tasks = new HashSet<NbTask>();
}
示例10
SynchronizeTasksCommand (AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository,
RepositoryModel repositoryModel, TaskDataManager taskDataManager, TaskList taskList,
Set<NbTask> tasks, boolean isUserAction) {
this.repositoryConnector = repositoryConnector;
this.taskRepository = taskRepository;
this.repositoryModel = repositoryModel;
this.taskDataManager = taskDataManager;
this.taskList = taskList;
this.tasks = tasks;
this.monitor = new CancelableProgressMonitor();
this.user = isUserAction;
}
示例11
public 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;
}
示例12
public GetAttachmentCommand(AbstractRepositoryConnector repositoryConnector,
TaskRepository taskRepository,
ITask task,
TaskAttribute ta,
OutputStream os) {
this.ta = ta;
this.task = task;
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.os = os;
}
示例13
/**
* Creates an unsubmitted task that's to be populated and submitted later.
* The task is local until submitted and kept in the tasklist under
* "Unsubmitted" category.
*
* @param taskRepository repository the task will be submitted to later.
* @param initializingData default data (such as product/component) to
* preset in the new task's data
* @return the newly created task.
* @throws CoreException tasklist or task data storage is inaccessible
*/
public NbTask createTask (TaskRepository taskRepository, ITaskMapping initializingData) throws CoreException {
ensureTaskListLoaded();
AbstractTask task = createNewTask(taskRepository);
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
AbstractTaskDataHandler taskDataHandler = taskRepository == localTaskRepository
? new LocalTaskDataHandler(taskRepository)
: repositoryConnector.getTaskDataHandler();
TaskAttributeMapper attributeMapper = taskDataHandler.getAttributeMapper(taskRepository);
TaskData taskData = new TaskData(attributeMapper, repositoryConnector.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
taskDataHandler.initializeTaskData(taskRepository, taskData, initializingData, new NullProgressMonitor());
initializeTask(repositoryConnector, taskData, task, taskRepository);
return MylynSupport.getInstance().toNbTask(task);
}
示例14
private void addTaskRepository (AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository) {
if (!taskRepository.getConnectorKind().equals(repositoryConnector.getConnectorKind())) {
throw new IllegalArgumentException("The given task repository is not managed by the given repository connector");
}
taskRepositoryManager.addRepositoryConnector(repositoryConnector);
taskRepositoryManager.addRepository(taskRepository);
// assert, noone should add two repository instances with the same URL
assert taskRepository == taskRepositoryManager.getRepository(repositoryConnector.getConnectorKind(), taskRepository.getUrl());
}
示例15
private void registerConnectors () {
for (RepositoryConnectorProvider provider : result.allInstances()) {
AbstractRepositoryConnector connector = provider.getConnector();
if (connector != null) {
taskRepositoryManager.addRepositoryConnector(connector);
}
}
}
示例16
public GetRepositoryTasksCommand createGetRepositoryTasksCommand (TaskRepository taskRepository, Set<String> taskIds) throws CoreException {
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
GetRepositoryTasksCommand cmd = new GetRepositoryTasksCommand(repositoryConnector,
taskRepository, taskIds, taskDataManager);
return cmd;
}
示例17
public SimpleQueryCommand createSimpleQueryCommand (TaskRepository taskRepository, IRepositoryQuery query) throws CoreException {
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
return new SimpleQueryCommand(repositoryConnector, taskRepository, taskDataManager, query);
}
示例18
public GetAttachmentCommand createGetAttachmentCommand (TaskRepository taskRepository,
NbTask nbTask, TaskAttribute ta, OutputStream os) {
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
return new GetAttachmentCommand(repositoryConnector, taskRepository,
Accessor.getInstance().getDelegate(nbTask), ta, os);
}
示例19
public MylynSubmitTaskJob (TaskDataManager taskDataManager, AbstractRepositoryConnector connector,
TaskRepository taskRepository, ITask task, TaskData taskData, Set<TaskAttribute> oldAttributes) {
super(taskDataManager, connector, taskRepository, task, taskData, oldAttributes);
}
示例20
public GetMultiTaskDataCommand(AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository, TaskDataCollector collector, Set<String> ids) {
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.ids = ids;
this.collector = collector;
}
示例21
public SubmitCommand(AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository, TaskData data) {
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.data = data;
wasNew = data.isNew();
}
示例22
public PerformQueryCommand(AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository, TaskDataCollector collector, IRepositoryQuery query) {
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
this.query = query;
this.collector = collector;
}
示例23
public GetTaskDataCommand(AbstractRepositoryConnector repositoryConnector, TaskRepository taskRepository, String id) {
this.id = id;
this.taskRepository = taskRepository;
this.repositoryConnector = repositoryConnector;
}
示例24
/**
* Synchronizes given tasks with their state in a repository.
*
* @param taskRepository repository
* @param tasks tasks to synchronize
* @param isUserAction when set to <code>true</code> mylyn will force the
* refresh and may run certain additional tasks like fetching subtasks and
* parent tasks.
* @return
*/
public SynchronizeTasksCommand createSynchronizeTasksCommand (TaskRepository taskRepository, Set<NbTask> tasks, boolean isUserAction) {
AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
return new SynchronizeTasksCommand(repositoryConnector, taskRepository,
repositoryModel, taskDataManager, taskList, tasks, isUserAction);
}
示例25
AbstractRepositoryConnector getConnector ();