kind.setValue(cfg.getTrackers().getById(issue.getTrackerId()).getName());
}
}
public static TimeEntry createTimeEntry(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, Configuration cfg) throws CoreException {
TimeEntry timeEntry = null;
try {
String val = getValue(taskData, RedmineAttribute.TIME_ENTRY_HOURS);
if(!val.isEmpty()) {
timeEntry = new TimeEntry();
/* Default Attributes */
long milisec = Long.parseLong(val);
long minutes = milisec/60000;
float hours = minutes/60;
hours += ((float)(minutes%60))/60.0;
timeEntry.setHours(hours);
timeEntry.setActivityId(Integer.parseInt(getValue(taskData, RedmineAttribute.TIME_ENTRY_ACTIVITY)));
timeEntry.setComments(getValue(taskData, RedmineAttribute.TIME_ENTRY_COMMENTS));
/* Custom Attributes */
List<CustomField> customFields = cfg.getCustomFields().getTimeEntryCustomFields();
if(customFields!=null && customFields.size()>0) {
CustomValues customValues = new CustomValues();
timeEntry.setCustomValues(customValues);
for (CustomField customField : customFields) {
String value = getValue(taskData, IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_CF+customField.getId());
customValues.setCustomValue(customField.getId(), formatCustomValue(value, customField.getId(), cfg));
}
}
/* Extension/Additional Attributes */
IRedmineExtensionField additionalFields[] = RedmineCorePlugin.getDefault().getExtensionManager().getAdditionalTimeEntryFields(repository);
for (IRedmineExtensionField additionalField : additionalFields) {
String value = getValue(taskData, IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_EX+additionalField.getTaskKey());
timeEntry.addExtensionValue(additionalField.getSubmitKey(), value);
}
}
} catch (NumberFormatException e) {
timeEntry = null;