Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement paging. #222

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions src/main/java/net/rcarz/jiraclient/IssueType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
/**
* Represents an issue type.
*/
public class IssueType extends Resource {
public class IssueType extends Resource
{

private String description = null;
private String iconUrl = null;
Expand All @@ -41,14 +42,17 @@ public class IssueType extends Resource {
* @param restclient REST client instance
* @param json JSON payload
*/
protected IssueType(RestClient restclient, JSONObject json) {
protected IssueType(RestClient restclient,
JSONObject json)
{
super(restclient);

if (json != null)
deserialise(json);
}

private void deserialise(JSONObject json) {
private void deserialise(JSONObject json)
{
Map map = json;

self = Field.getString(map.get("self"));
Expand All @@ -59,7 +63,7 @@ private void deserialise(JSONObject json) {
subtask = Field.getBoolean(map.get("subtask"));

if (map.containsKey("fields") && map.get("fields") instanceof JSONObject)
fields = (JSONObject)map.get("fields");
fields = (JSONObject) map.get("fields");
}

/**
Expand All @@ -72,46 +76,56 @@ private void deserialise(JSONObject json) {
*
* @throws JiraException when the retrieval fails
*/
public static IssueType get(RestClient restclient, String id)
throws JiraException {
public static IssueType get(RestClient restclient,
String id)
throws JiraException
{

JSON result = null;

try {
try
{
result = restclient.get(getBaseUri() + "issuetype/" + id);
} catch (Exception ex) {
}
catch (Exception ex)
{
throw new JiraException("Failed to retrieve issue type " + id, ex);
}

if (!(result instanceof JSONObject))
throw new JiraException("JSON payload is malformed");

return new IssueType(restclient, (JSONObject)result);
return new IssueType(restclient, (JSONObject) result);
}

@Override
public String toString() {
public String toString()
{
return getName();
}

public String getDescription() {
public String getDescription()
{
return description;
}

public String getName() {
public String getName()
{
return name;
}

public String getIconUrl() {
public String getIconUrl()
{
return iconUrl;
}

public boolean isSubtask() {
public boolean isSubtask()
{
return subtask;
}

public JSONObject getFields() {
public JSONObject getFields()
{
return fields;
}
}

Loading