Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mylyn-integrators] How to read the due date in newly created tasks?

Hi,

I working on some issues raised by users beta version of Industrial SQL Connector.
See bug 184532: [connector] Generic SQL connector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=184532

On a newly created bug I have a field for the Due Date that I can set. When I press submit, at some point I call myTaskDataHandler:

public RepositoryResponse postTaskData(TaskRepository repository,
TaskData taskData, Set<TaskAttribute> oldAttributes,
IProgressMonitor monitor) throws CoreException {

and determine whether it is a new task, I then try to get the value set in TaskAttribute.DATE_DUE
...
taskDto.setDueDate(safeDate(taskData, TaskAttribute.DATE_DUE));
...

but the value of that attribute is not set at this stage, so how can I retrieve it?

/**
 * @param taskData
 * @param key specifies {@link TaskAttribute} 
 * @return the Date if the attribute exists, or null if it does not exist
 */
private Date safeDate(TaskData taskData, String key) {
TaskAttribute attribute = taskData.getRoot().getMappedAttribute(key);
if (attribute != null) {
return taskData.getAttributeMapper().getDateValue(attribute);
}
return null;
}

Where can I find how to do this?



Maarten Meijer
mm105@xxxxxxxxx
Eclipse RCP consultant & trainer
contributed to Mylyn & ECF





Back to the top