Commits

Janusz Gorycki committed 49ec073

PL-2739 - use JIRA REST API to talk to JIRA

  • Participants
  • Parent commits 5aa0ab7

Comments (0)

Files changed (2)

src/main/java/com/atlassian/jira/rest/client/domain/BasicProject.java

 	private final String key;
     @Nullable
     private final String name;
+    @Nullable
+    private final Long id;
+
+    public BasicProject(URI self, String key, String name) {
+		this(self, key, name, null);
+    }
 
-	public BasicProject(URI self, String key, String name) {
-		this.self = self;
-		this.key = key;
+    public BasicProject(URI self, String key, String name, Long id) {
+        this.self = self;
+        this.key = key;
         this.name = name;
+        this.id = id;
     }
 
-	@Override
+    @Override
 	public URI getSelf() {
 		return self;
 	}
         return name;
     }
 
-	@Override
+    @Nullable
+    public Long getId() {
+        return id;
+    }
+
+    @Override
 	public String toString() {
 		return getToStringHelper().toString();
 	}
 		return Objects.toStringHelper(this).
 				add("self", self).
 				add("key", key).
-				add("name", name);
+				add("name", name)
+                .add("id", name);
 	}
 
 	@Override
 			BasicProject that = (BasicProject) obj;
 			return Objects.equal(this.self, that.self)
                     && Objects.equal(this.name, that.name)
-					&& Objects.equal(this.key, that.key);
+					&& Objects.equal(this.key, that.key)
+                    && Objects.equal(this.id, that.id);
 		}
 		return false;
 	}
 
 	@Override
 	public int hashCode() {
-		return Objects.hashCode(self, name, key);
+		return Objects.hashCode(self, name, key, id);
 	}
 
 }

src/main/java/com/atlassian/jira/rest/client/internal/json/BasicProjectJsonParser.java

         final URI selfUri = JsonParseUtil.getSelfUri(json);
         final String key = json.getString("key");
         final String name = JsonParseUtil.getOptionalString(json, "name");
-        return new BasicProject(selfUri, key, name);
+        final Long id = JsonParseUtil.getOptionalLong(json, "id");
+        return new BasicProject(selfUri, key, name, id);
     }
 }