/** * Retrieves the given component record. * * @param restclient REST client instance * @param id Internal JIRA ID of the component * * @return a component instance * * @throws JiraException when the retrieval fails */ public static Component get(RestClient restclient, String id) throws JiraException { JSON result = null; try { result = restclient.get(getRestUri(id)); } catch (Exception ex) { throw new JiraException("Failed to retrieve component " + id, ex); } if (!(result instanceof JSONObject)) throw new JiraException("JSON payload is malformed"); return new Component(restclient, (JSONObject)result); }
/** * Retrieves the given component record. * * @param restclient REST client instance * @param id Internal JIRA ID of the component * * @return a component instance * * @throws JiraException when the retrieval fails */ public static Component get(RestClient restclient, String id) throws JiraException { JSON result = null; try { result = restclient.get(getRestUri(id)); } catch (Exception ex) { throw new JiraException("Failed to retrieve component " + id, ex); } if (!(result instanceof JSONObject)) throw new JiraException("JSON payload is malformed"); return new Component(restclient, (JSONObject)result); }
/** * Executes the create action. * @return the created component * * @throws JiraException when the create fails */ public Component execute() throws JiraException { JSON result = null; try { result = restclient.post(getRestUri(null), req); } catch (Exception ex) { throw new JiraException("Failed to create issue", ex); } if (!(result instanceof JSONObject) || !((JSONObject) result).containsKey("id") || !(((JSONObject) result).get("id") instanceof String)) { throw new JiraException("Unexpected result on create component"); } return new Component(restclient, (JSONObject) result); } }
/** * Executes the create action. * @return the created component * * @throws JiraException when the create fails */ public Component execute() throws JiraException { JSON result = null; try { result = restclient.post(getRestUri(null), req); } catch (Exception ex) { throw new JiraException("Failed to create issue", ex); } if (!(result instanceof JSONObject) || !((JSONObject) result).containsKey("id") || !(((JSONObject) result).get("id") instanceof String)) { throw new JiraException("Unexpected result on create component"); } return new Component(restclient, (JSONObject) result); } }
result = (T)new Comment(restclient, (JSONObject)r); else if (type == Component.class) result = (T)new Component(restclient, (JSONObject)r); else if (type == CustomFieldOption.class) result = (T)new CustomFieldOption(restclient, (JSONObject)r);
result = (T)new Comment(restclient, (JSONObject)r, parentId); else if (type == Component.class) result = (T)new Component(restclient, (JSONObject)r); else if (type == CustomFieldOption.class) result = (T)new CustomFieldOption(restclient, (JSONObject)r);