private String buildSelf(final Long entityId) { return propertySelf(urls, entityId, key, entityIdToSelfFunction); } }
private Map<String, JSONObject> getCommentProperties(final List<EntityPropertyBean> properties) { final Map<String, JSONObject> mapOfProperties = Maps.newHashMap(); if (properties != null) { for (EntityPropertyBean propertyBean : properties) { try { mapOfProperties.put(propertyBean.getKey(), new JSONObject(propertyBean.getValue())); } catch (JSONException e) { log.error("Error when building comment properties", e); } } } return mapOfProperties; } }
public EntityPropertyBean build(Long entityId) { return new EntityPropertyBean(checkNotNull(key), checkNotNull(value), buildSelf(entityId)); }
@Override public Response apply(final EntityProperty entityProperty) { com.atlassian.jira.issue.fields.rest.json.beans.EntityPropertyBean entityPropertyBean = com.atlassian.jira.issue.fields.rest.json.beans.EntityPropertyBean.builder(jiraBaseUrls, entityIdAndPropertyKeyToSelfFunction) // escape unicode, because for some characters(i.e. pile of poo) jackson may throw exception // during processing of JsonRawValue, which entity property value is in this case .value(RestStringUtils.escapeUnicode(entityProperty.getValue())) .key(entityProperty.getKey()) .build(entityProperty.getEntityId()); return status(Response.Status.OK).entity(entityPropertyBean).cacheControl(never()).build(); } }
@Override public EntityPropertyBean apply(final Map<String, Object> entityPropertyBean) { final String key = (String) entityPropertyBean.get("key"); final Map<String, Object> value = (Map<String, Object>) entityPropertyBean.get("value"); return new EntityPropertyBean(key, new JSONObject(value).toString(), null); } }));
/** * @deprecated In 7.0.0 {@link Function2} has been deprecated in favour of {@link BiFunction}. Use {@link #propertySelf(JiraBaseUrls, Long, String, BiFunction)} */ @Deprecated public static String propertySelf(JiraBaseUrls urls, Long entityId, String propertyKey, Function2<Long, String, String> selfFunction) { return propertySelf(urls, entityId, propertyKey, (BiFunction<Long, String, String>) selfFunction::apply); }
@Override public EntityPropertyKeyBean apply(final String propertyKey) { return new EntityPropertyKeyBean(propertyKey, com.atlassian.jira.issue.fields.rest.json.beans.EntityPropertyBean.propertySelf(urls, issueId, propertyKey, selfFunction)); } })));