result.addError(Result.Message.ofL10n("errors.is_too_long", "description", 1000));
}
- if (Strings.isNullOrEmpty(projectParam) && oldName == null) {
+ if (Strings.isNullOrEmpty(projectParam)) {
result.addError(Result.Message.ofL10n("errors.cant_be_empty", "project"));
} else {
ResourceDto project = resourceDao.getResource(ResourceQuery.create().setKey(projectParam));
#
# POST /api/action_plans/update
#
+ # -- Mandatory parameters
+ # 'name' is the name of the action plan
+ # 'project' is the key of the project to link the action plan to
+ #
# -- Optional parameters
- # 'name' is the action plan name
- # 'project' is the project key to link the action plan to
# 'description' is the plain-text description
# 'deadLine' is the due date of the action plan. Format is 'day/month/year', for instance, '31/12/2013'.
#
class Api::Utils
- # Format dateTime to ISO format
+ # Format dateTime to ISO format (yyyy-MM-dd'T'HH:mm:ssZ)
#
# -- Revisions
# Added in 2.8
dt.strftime("%Y-%m-%dT%H:%M:%S%z")
end
+ # Format dateTime to ISO format (yyyy-MM-dd)
+ #
+ # Added in 3.6
+ # Support java.util.Date
+ #
+ def self.format_date(datetime)
+ return nil unless datetime
+ dt = datetime.is_a?(Java::JavaUtil::Date) ? java_to_ruby_datetime(datetime) : datetime
+ dt.strftime("%Y-%m-%d")
+ end
+
def self.parse_datetime(datetime_string, default_is_now=true)
if datetime_string.blank?
return (default_is_now ? Time.now : nil)
<td class="left" valign="top">
<%= message('action_plans.col.due_for') -%>:
<br/>
- <% deadline = Api::Utils.java_to_ruby_datetime(@action_plan.deadLine()) if @action_plan && @action_plan.deadLine() %>
- <input type="text" name="deadline" id="deadline" value="<%= @action_plan && deadline ? deadline.strftime('%d/%m/%Y') : params[:deadline] -%>"/>
+ <input type="text" name="deadline" id="deadline" value="<%= @action_plan && @action_plan.deadLine() ? Api::Utils.format_date(@action_plan.deadLine()) : params[:deadline] -%>"/>
<br/>
<span class="note"><%= message('action_plans.date_format_help') -%></span>
</td>
parameters.put("name", "New Long term");
parameters.put("description", "New Long term issues");
parameters.put("deadLine", "2113-05-13");
+ parameters.put("project", "org.sonar.MultiSample");
ArgumentCaptor<ActionPlan> actionPlanCaptor = ArgumentCaptor.forClass(ActionPlan.class);
Result result = internalRubyIssueService.updateActionPlan("ABCD", parameters);