/** * Executes an HTTP PUT with the given path and payload. * * @param path Path to be appended to the URI supplied in the construtor * @param payload JSON-encoded data to send to the remote service * * @return JSON-encoded result or null when there's no content returned * * @throws RestException when an HTTP-level error occurs * @throws IOException when an error reading the response occurs * @throws URISyntaxException when an error occurred appending the path to the URI */ public JSON put(String path, JSON payload) throws RestException, IOException, URISyntaxException { return put(buildURI(path), payload); }
/** * Executes an HTTP PUT with the given path and payload. * * @param path Path to be appended to the URI supplied in the construtor * @param payload JSON-encoded data to send to the remote service * * @return JSON-encoded result or null when there's no content returned * * @throws RestException when an HTTP-level error occurs * @throws IOException when an error reading the response occurs * @throws URISyntaxException when an error occurred appending the path to the URI */ public JSON put(String path, JSON payload) throws RestException, IOException, URISyntaxException { return put(buildURI(path), payload); }
/** * Executes the update action. * * @throws JiraException when the update fails */ public void execute() throws JiraException { JSONObject fieldmap = new JSONObject(); JSONObject updatemap = new JSONObject(); if (fields.size() == 0 && fieldOpers.size() == 0) throw new JiraException("No fields were given for update"); for (Map.Entry<String, Object> ent : fields.entrySet()) { Object newval = Field.toJson(ent.getKey(), ent.getValue(), editmeta); fieldmap.put(ent.getKey(), newval); } for (Map.Entry<String, List> ent : fieldOpers.entrySet()) { Object newval = Field.toJson(ent.getKey(), ent.getValue(), editmeta); updatemap.put(ent.getKey(), newval); } JSONObject req = new JSONObject(); if (fieldmap.size() > 0) req.put("fields", fieldmap); if (updatemap.size() > 0) req.put("update", updatemap); try { restclient.put(getRestUri(key), req); } catch (Exception ex) { throw new JiraException("Failed to update issue " + key, ex); } }
/** * Executes the update action. * * @throws JiraException when the update fails */ public void execute() throws JiraException { JSONObject fieldmap = new JSONObject(); JSONObject updatemap = new JSONObject(); if (fields.size() == 0 && fieldOpers.size() == 0) throw new JiraException("No fields were given for update"); for (Map.Entry<String, Object> ent : fields.entrySet()) { Object newval = Field.toJson(ent.getKey(), ent.getValue(), editmeta); fieldmap.put(ent.getKey(), newval); } for (Map.Entry<String, List> ent : fieldOpers.entrySet()) { Object newval = Field.toJson(ent.getKey(), ent.getValue(), editmeta); updatemap.put(ent.getKey(), newval); } JSONObject req = new JSONObject(); if (fieldmap.size() > 0) req.put("fields", fieldmap); if (updatemap.size() > 0) req.put("update", updatemap); try { restclient.put(getRestUri(key), req); } catch (Exception ex) { throw new JiraException("Failed to update issue " + key, ex); } }
/** * Merges the given version with current version * * @param version * The version to merge */ public void mergeWith(Version version) { JSONObject req = new JSONObject(); req.put("description", version.getDescription()); req.put("name", version.getName()); req.put("archived", version.isArchived()); req.put("released", version.isReleased()); req.put("releaseDate", version.getReleaseDate()); try { restclient.put(Resource.getBaseUri() + "version/" + id, req); } catch (Exception ex) { throw new RuntimeException("Failed to merge", ex); } }
result = restclient.put(issueUri + "/comment/" + id, req); } catch (Exception ex) { throw new JiraException("Failed add update comment " + id, ex);
/** * Merges the given version with current version * * @param version * The version to merge */ public void mergeWith(Version version) throws JiraException { JSONObject req = new JSONObject(); req.put("description", version.getDescription()); req.put("name", version.getName()); req.put("archived", version.isArchived()); req.put("released", version.isReleased()); req.put("releaseDate", version.getReleaseDate()); try { restclient.put(Resource.getBaseUri() + "version/" + id, req); } catch (Exception ex) { throw new JiraException("Failed to merge", ex); } }