@Override public JSONObject generate(ComplexIssueInputFieldValue bean) throws JSONException { final JSONObject json = new JSONObject(); for (Map.Entry<String, Object> entry : bean.getValuesMap().entrySet()) { json.put(entry.getKey(), generateFieldValueForJson(entry.getValue())); } return json; }
@Override public JSONObject generate(ComplexIssueInputFieldValue bean) throws JSONException { final JSONObject json = new JSONObject(); for (Map.Entry<String, Object> entry : bean.getValuesMap().entrySet()) { json.put(entry.getKey(), generateFieldValueForJson(entry.getValue())); } return json; }
@Override public Object mapToFieldValue(String fieldId, FieldSchema schema, String attributeValue) { if (!Strings.isNullOrEmpty(attributeValue)) { final String[] split = attributeValue.split(","); // split by "," if (split != null && split.length >= 1) { // we have at least one value final String optionKey = getOptionKey(fieldId, "value"); final Map<String, Object> parentValueMap = new HashMap<>(); parentValueMap.put(optionKey, split[0]); // set first value final ComplexIssueInputFieldValue parentValue = new ComplexIssueInputFieldValue(parentValueMap); if (split.length >= 2) { // if we have a 2nd value, set it as child of value 1 parentValue.getValuesMap().put("child", ComplexIssueInputFieldValue.with(optionKey, split[1])); } return parentValue; } } return null; } }
@Override public Object mapToFieldValue(String fieldId, FieldSchema schema, String attributeValue) { if (!Strings.isNullOrEmpty(attributeValue)) { final String[] split = attributeValue.split(","); // split by "," if (split != null && split.length >= 1) { // we have at least one value final String optionKey = getOptionKey(fieldId, "value"); final Map<String, Object> parentValueMap = new HashMap<>(); parentValueMap.put(optionKey, split[0]); // set first value final ComplexIssueInputFieldValue parentValue = new ComplexIssueInputFieldValue(parentValueMap); if (split.length >= 2) { // if we have a 2nd value, set it as child of value 1 parentValue.getValuesMap().put("child", ComplexIssueInputFieldValue.with(optionKey, split[1])); } return parentValue; } } return null; } }