IStatus status = RedmineCorePlugin.toStatus(IStatus.ERROR, Messages.ERRMSG_TASK_INITIALIZATION_FALED_INSUFFICENT_DATA_X_X, issue.getId(), "Settings" );
StatusHandler.log(status);
throw new RedmineStatusException(status);
}
TaskAttribute attribute;
createAttribute(data, RedmineAttribute.SUMMARY);
createAttribute(data, RedmineAttribute.DESCRIPTION);
createAttribute(data, RedmineAttribute.PRIORITY, cfg.getIssuePriorities().getAll());
if(existingTask) {
attribute = createAttribute(data, RedmineAttribute.PROJECT, cfg.getProjects().getMoveAllowed(project));
attribute.getMetaData().setReadOnly(true);
} else {
createAttribute(data, RedmineAttribute.PROJECT, cfg.getProjects().getNewAllowed());
}
createAttribute(data, RedmineAttribute.PARENT);
createAttribute(data, RedmineAttribute.SUBTASKS);
createAttribute(data, RedmineAttribute.TRACKER, cfg.getTrackers().getById(project.getTrackerIds()));
if (existingTask) {
createAttribute(data, RedmineAttribute.REPORTER);
createAttribute(data, RedmineAttribute.DATE_SUBMITTED);
createAttribute(data, RedmineAttribute.DATE_UPDATED);
createAttribute(data, RedmineAttribute.COMMENT);
createAttribute(data, RedmineAttribute.STATUS, cfg.getIssueStatuses().getById(issue.getAvailableStatusId()));
createAttribute(data, RedmineAttribute.STATUS_CHG, cfg.getIssueStatuses().getById(issue.getAvailableStatusId()));
//// createAttribute(data, RedmineAttribute.RELATION, ticket.getRelations(), false);
//
} else {
createAttribute(data, RedmineAttribute.STATUS, cfg.getIssueStatuses().getAll());
createAttribute(data, RedmineAttribute.STATUS_CHG, cfg.getIssueStatuses().getAll());
}
createAttribute(data, RedmineAttribute.CATEGORY, cfg.getIssueCategories().getById(project.getIssueCategoryIds()), true);
createAttribute(data, RedmineAttribute.VERSION, cfg.getVersions().getOpenById(project.getVersionIds()), true);
attribute = createAttribute(data, RedmineAttribute.PROGRESS, ProgressValues.availableValues());
if (!cfg.getSettings().isUseIssueDoneRatio()) {
attribute.getMetaData().setReadOnly(true);
attribute.getMetaData().setType(null);
}
//Planning
createAttribute(data, RedmineAttribute.ESTIMATED);
createAttribute(data, RedmineAttribute.DATE_DUE);
createAttribute(data, RedmineAttribute.DATE_START);
createAttribute(data, RedmineAttribute.ASSIGNED_TO, cfg.getUsers().getById(project.getAssignableMemberIds()), !existingTask);
//Attributes for a new TimeEntry
if(existingTask) {
if (issue.getTimeEntries()!=null && issue.getTimeEntries().isNewAllowed()) {
createAttribute(data, RedmineAttribute.TIME_ENTRY_HOURS);
createAttribute(data, RedmineAttribute.TIME_ENTRY_ACTIVITY, project.getTimeEntryActivities().getAll());
createAttribute(data, RedmineAttribute.TIME_ENTRY_COMMENTS);
for (IRedmineExtensionField additionalField : RedmineCorePlugin.getDefault().getExtensionManager().getAdditionalTimeEntryFields(repository)) {
createAttribute(data, additionalField, IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_EX);
}
createCustomAttributes(data, cfg, issue, cfg.getCustomFields().getTimeEntryCustomFields(), IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_CF, true);
}
}
//Watchers
if(existingTask) {
if(issue.isWatchersViewAllowed()) {
attribute = createAttribute(data, RedmineAttribute.WATCHERS, cfg.getUsers().getAll());
if(issue.isWatchersAddAllowed()) {
TaskAttribute addWatcherAttribute = attribute.createAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
addWatcherAttribute.getMetaData().setLabel(RedmineAttribute.WATCHERS_ADD.getLabel());
addOptions(addWatcherAttribute, cfg.getUsers().getById(project.getMemberIds()));
}
if(issue.isWatchersDeleteAllowed()) {
attribute.createAttribute(RedmineAttribute.WATCHERS_REMOVE.getTaskKey());