Search in sources :

Example 1 with TaskMapper

use of org.eclipse.mylyn.tasks.core.data.TaskMapper in project linuxtools by eclipse.

the class OSIORestConnector method updateTaskFromTaskData.

@Override
public void updateTaskFromTaskData(TaskRepository taskRepository, ITask task, TaskData taskData) {
    TaskMapper scheme = getTaskMapping(taskData);
    scheme.applyTo(task);
    task.setUrl(taskData.getRoot().getAttribute(OSIORestTaskSchema.getDefault().TASK_URL.getKey()).getValue());
    boolean isComplete = false;
    TaskAttribute attributeStatus = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
    if (attributeStatus != null) {
        String statusValue = attributeStatus.getValue();
        isComplete = (statusValue.equals(IOSIORestConstants.RESOLVED) || statusValue.equals(IOSIORestConstants.CLOSED));
    }
    if (taskData.isPartial()) {
        if (isComplete) {
            if (task.getCompletionDate() == null) {
                task.setCompletionDate(new Date(0));
            }
        } else {
            task.setCompletionDate(null);
        }
    } else {
        inferCompletionDate(task, taskData, scheme, isComplete);
    }
}
Also used : TaskAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute) Date(java.util.Date) TaskMapper(org.eclipse.mylyn.tasks.core.data.TaskMapper)

Aggregations

Date (java.util.Date)1 TaskAttribute (org.eclipse.mylyn.tasks.core.data.TaskAttribute)1 TaskMapper (org.eclipse.mylyn.tasks.core.data.TaskMapper)1