/** * Puts given FieldInput into fields collection. * <p> * <strong>Recommended</strong> way to set field value is to use {@link IssueInputBuilder#setFieldValue(String, Object)}. * * @param fieldInput FieldInput to insert. * @return this */ public IssueInputBuilder setFieldInput(FieldInput fieldInput) { fields.put(fieldInput.getId(), fieldInput); return this; }
/** * Puts given FieldInput into fields collection. * <p> * <strong>Recommended</strong> way to set field value is to use {@link IssueInputBuilder#setFieldValue(String, Object)}. * * @param fieldInput FieldInput to insert. * @return this */ public IssueInputBuilder setFieldInput(FieldInput fieldInput) { fields.put(fieldInput.getId(), fieldInput); return this; }
@Override public JSONObject generate(Iterable<FieldInput> fieldInputs) throws JSONException { final JSONObject fields = new JSONObject(); if (fieldInputs != null) { for (final FieldInput field : fieldInputs) { final Object fieldValue = (field.getValue() == null) ? JSONObject.NULL : generator.generateFieldValueForJson(field.getValue()); fields.put(field.getId(), fieldValue); } } return fields; } }
@Override public JSONObject generate(Iterable<FieldInput> fieldInputs) throws JSONException { final JSONObject fields = new JSONObject(); if (fieldInputs != null) { for (final FieldInput field : fieldInputs) { final Object fieldValue = (field.getValue() == null) ? JSONObject.NULL : generator.generateFieldValueForJson(field.getValue()); fields.put(field.getId(), fieldValue); } } return fields; } }
@Override public JSONObject generate(IssueInput issue) throws JSONException { final JSONObject jsonObject = new JSONObject(); final JSONObject fields = new JSONObject(); if (issue != null && issue.getFields() != null) { for (final FieldInput field : issue.getFields().values()) { if (field.getValue() != null) { fields.put(field.getId(), complexIssueInputFieldValueJsonGenerator.generateFieldValueForJson(field .getValue())); } } } jsonObject.put("fields", fields); return jsonObject; } }
@Override public JSONObject generate(final IssueInput issue) throws JSONException { final JSONObject jsonObject = new JSONObject(); final JSONObject fields = new JSONObject(); if (issue != null && issue.getFields() != null) { for (final FieldInput field : issue.getFields().values()) { if (field.getValue() != null) { fields.put(field.getId(), complexIssueInputFieldValueJsonGenerator.generateFieldValueForJson(field .getValue())); } } } jsonObject.put("fields", fields); // Add entity properties final JSONArray entityProperties = new JSONArray(); if (issue != null && issue.getProperties() != null) { for (final PropertyInput p : issue.getProperties()) { final JSONObject property = new JSONObject(); property.put("key", p.getKey()); property.put("value", new JSONObject(p.getValue())); entityProperties.put(property); } } jsonObject.put("properties", entityProperties); return jsonObject; }