From 3cf604a6c153075b7fde38a4bd23e86fde55eaab Mon Sep 17 00:00:00 2001 From: Javier Molina Date: Fri, 1 Aug 2014 13:46:57 +1000 Subject: [PATCH 1/4] Add description getter --- src/main/java/net/rcarz/jiraclient/Component.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/rcarz/jiraclient/Component.java b/src/main/java/net/rcarz/jiraclient/Component.java index 1c0ed45..5e197cf 100644 --- a/src/main/java/net/rcarz/jiraclient/Component.java +++ b/src/main/java/net/rcarz/jiraclient/Component.java @@ -131,6 +131,7 @@ public class Component extends Resource { } private String name = null; + private String description = null; private boolean isAssigneeTypeValid = false; /** @@ -152,6 +153,7 @@ public class Component extends Resource { self = Field.getString(map.get("self")); id = Field.getString(map.get("id")); name = Field.getString(map.get("name")); + description = Field.getString(map.get("description")); isAssigneeTypeValid = Field.getBoolean(map.get("isAssigneeTypeValid")); } @@ -191,6 +193,10 @@ public class Component extends Resource { return name; } + public String getDescription() { + return description; + } + public boolean isAssigneeTypeValid() { return isAssigneeTypeValid; } From da7e33e44325846f1080b2836b9f91ad10aa4e6e Mon Sep 17 00:00:00 2001 From: Javier Molina Date: Fri, 1 Aug 2014 14:37:05 +1000 Subject: [PATCH 2/4] - Added number to field types --- src/main/java/net/rcarz/jiraclient/Field.java | 7 +++++++ src/main/java/net/rcarz/jiraclient/Issue.java | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/rcarz/jiraclient/Field.java b/src/main/java/net/rcarz/jiraclient/Field.java index 57c5c42..bffda38 100644 --- a/src/main/java/net/rcarz/jiraclient/Field.java +++ b/src/main/java/net/rcarz/jiraclient/Field.java @@ -594,6 +594,13 @@ public final class Field { return JSONNull.getInstance(); else if (value instanceof TimeTracking) return ((TimeTracking) value).toJsonObject(); + } else if (m.type.equals("number")) { + if(!(value instanceof java.lang.Integer) && !(value instanceof java.lang.Double) && !(value + instanceof java.lang.Float) && !(value instanceof java.lang.Long) ) + { + throw new JiraException("Field expects a Numeric value"); + } + return value; } throw new UnsupportedOperationException(m.type + " is not a supported field type"); diff --git a/src/main/java/net/rcarz/jiraclient/Issue.java b/src/main/java/net/rcarz/jiraclient/Issue.java index e0c8f8b..cb69927 100644 --- a/src/main/java/net/rcarz/jiraclient/Issue.java +++ b/src/main/java/net/rcarz/jiraclient/Issue.java @@ -472,7 +472,8 @@ public class Issue extends Resource { restclient); if (projects.isEmpty() || projects.get(0).getIssueTypes().isEmpty()) - throw new JiraException("Project or issue type missing from create metadata"); + throw new JiraException("Project '"+ project + "' or issue type '" + issueType + + "' missing from create metadata. Do you have enough permissions?"); return projects.get(0).getIssueTypes().get(0).getFields(); } From 6a9c1eddc913dca3ed87e771cf7a0b2cc4b02f69 Mon Sep 17 00:00:00 2001 From: Johan Mena Date: Fri, 27 Jun 2014 18:44:02 -0400 Subject: [PATCH 3/4] Add datetime support for issues --- src/main/java/net/rcarz/jiraclient/Field.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/rcarz/jiraclient/Field.java b/src/main/java/net/rcarz/jiraclient/Field.java index bffda38..68b1125 100644 --- a/src/main/java/net/rcarz/jiraclient/Field.java +++ b/src/main/java/net/rcarz/jiraclient/Field.java @@ -21,6 +21,7 @@ package net.rcarz.jiraclient; import java.lang.Iterable; import java.lang.UnsupportedOperationException; +import java.sql.Timestamp; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -147,6 +148,7 @@ public final class Field { public static final String TIME_SPENT = "timespent"; public static final String DATE_FORMAT = "yyyy-MM-dd"; + public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; private Field() { } @@ -551,6 +553,14 @@ public final class Field { SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); return df.format(d); + } else if (m.type.equals("datetime")) { + if (value == null) + return JSONNull.getInstance(); + else if (!(value instanceof Timestamp)) + throw new JiraException("Field expects a Timestamp value"); + + SimpleDateFormat df = new SimpleDateFormat(DATETIME_FORMAT); + return df.format(value); } else if (m.type.equals("issuetype") || m.type.equals("priority") || m.type.equals("user") || m.type.equals("resolution")) { JSONObject json = new JSONObject(); @@ -641,7 +651,7 @@ public final class Field { /** * Create a value tuple with value type of name. * - * @param key The name value + * @param name The name value * * @return a value tuple */ @@ -652,7 +662,7 @@ public final class Field { /** * Create a value tuple with value type of ID number. * - * @param key The ID number value + * @param id The ID number value * * @return a value tuple */ From 83b0f75c090e1604c2fd93c00ea53907f4f5123c Mon Sep 17 00:00:00 2001 From: Javier Molina Date: Fri, 1 Aug 2014 14:52:36 +1000 Subject: [PATCH 4/4] Adding myself to the Authors file. --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 41b188a..9f29357 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,3 +1,4 @@ Bob Carroll @rcarz Kyle Chaplin @chaplinkyle Alesandro Lang @alesandroLang +Javier Molina @javinovich