Refine search
/** * Method that is similar to {@link #has(String)}, but that will * return <code>false</code> for explicitly added nulls. *<p> * This method is functionally equivalent to: *<pre> * node.get(fieldName) != null && !node.get(fieldName).isNull() *</pre> * * @since 2.1 */ public boolean hasNonNull(String fieldName) { JsonNode n = get(fieldName); return (n != null) && !n.isNull(); }
protected static String getActiveValue(String originalValue, String propertyName, ObjectNode elementProperties) { String activeValue = originalValue; if (elementProperties != null) { JsonNode overrideValueNode = elementProperties.get(propertyName); if (overrideValueNode != null) { if (overrideValueNode.isNull()) { activeValue = null; } else { activeValue = overrideValueNode.asText(); } } } return activeValue; }
protected String getActiveValue(String originalValue, String propertyName, ObjectNode taskElementProperties) { String activeValue = originalValue; if (taskElementProperties != null) { JsonNode overrideValueNode = taskElementProperties.get(propertyName); if (overrideValueNode != null) { if (overrideValueNode.isNull()) { activeValue = null; } else { activeValue = overrideValueNode.asText(); } } } return activeValue; }
/** * Method that is similar to {@link #has(int)}, but that will * return <code>false</code> for explicitly added nulls. *<p> * This method is equivalent to: *<pre> * node.get(index) != null && !node.get(index).isNull() *</pre> * * @since 2.1 */ public boolean hasNonNull(int index) { JsonNode n = get(index); return (n != null) && !n.isNull(); }
protected List<String> getValueAsList(String name, JsonNode objectNode) { List<String> resultList = new ArrayList<String>(); JsonNode valuesNode = objectNode.get(name); if (valuesNode != null) { for (JsonNode valueNode : valuesNode) { if (valueNode.get("value") != null && !valueNode.get("value").isNull()) { resultList.add(valueNode.get("value").asText()); } } } return resultList; }
protected void setOutcomeConditionExpression(SequenceFlow flow, JsonNode expressionNode) { Long formId = null; if (expressionNode.get("outcomeFormId") != null && !(expressionNode.get("outcomeFormId").isNull())) { formId = expressionNode.get("outcomeFormId").asLong(); } String operator = null; if (expressionNode.get("operator") != null && expressionNode.get("operator").isNull() == false) { operator = expressionNode.get("operator").asText(); } String outcomeName = null; if (expressionNode.get("outcomeName") != null && !(expressionNode.get("outcomeName").isNull())) { outcomeName = expressionNode.get("outcomeName").asText(); } if (formId != null && operator != null && outcomeName != null) { flow.setConditionExpression("${form" + formId + "outcome " + operator + " " + outcomeName + "}"); addExtensionElement("conditionFormId", String.valueOf(formId), flow); addExtensionElement("conditionOperator", operator, flow); addExtensionElement("conditionOutcomeName", outcomeName, flow); } }
protected boolean doesElementPropertyExist(String id, String propertyName, ObjectNode infoNode) { boolean exists = false; if (infoNode.get(BPMN_NODE) != null && infoNode.get(BPMN_NODE).get(id) != null && infoNode.get(BPMN_NODE).get(id).get(propertyName) != null) { JsonNode propNode = infoNode.get(BPMN_NODE).get(id).get(propertyName); if (!propNode.isNull()) { exists = true; } } return exists; }
protected void setFieldConditionExpression(SequenceFlow flow, JsonNode expressionNode) { String fieldId = null; if (expressionNode.get("fieldId") != null && !(expressionNode.get("fieldId").isNull())) { fieldId = expressionNode.get("fieldId").asText(); } String operator = null; if (expressionNode.get("operator") != null && !(expressionNode.get("operator").isNull())) { operator = expressionNode.get("operator").asText(); } String value = null; if (expressionNode.get("value") != null && !(expressionNode.get("value").isNull())) { value = expressionNode.get("value").asText(); } if (fieldId != null && operator != null && value != null) { flow.setConditionExpression("${" + fieldId + " " + operator + " " + value + "}"); addExtensionElement("conditionFieldId", fieldId, flow); addExtensionElement("conditionOperator", operator, flow); addExtensionElement("conditionValue", value, flow); } }
List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName) throws JWTDecodeException { JsonNode node = tree.get(claimName); if (node == null || node.isNull() || !(node.isArray() || node.isTextual())) { return null; } if (node.isTextual() && !node.asText().isEmpty()) { return Collections.singletonList(node.asText()); } List<String> list = new ArrayList<>(node.size()); for (int i = 0; i < node.size(); i++) { try { list.add(objectReader.treeToValue(node.get(i), String.class)); } catch (JsonProcessingException e) { throw new JWTDecodeException("Couldn't map the Claim's array contents to String", e); } } return list; }
public static Object extractValue(@Nullable JsonNode jsonValue, FieldSpec fieldSpec) { if (fieldSpec.isSingleValueField()) { if (jsonValue != null && !jsonValue.isNull()) { return extractSingleValue(jsonValue, fieldSpec.getDataType()); } else { return fieldSpec.getDefaultNullValue(); } } else { if (jsonValue != null && !jsonValue.isNull()) { if (jsonValue.isArray()) { int numValues = jsonValue.size(); if (numValues != 0) { Object[] values = new Object[numValues]; for (int i = 0; i < numValues; i++) { values[i] = extractSingleValue(jsonValue.get(i), fieldSpec.getDataType()); } return values; } else { return new Object[]{fieldSpec.getDefaultNullValue()}; } } else { return new Object[]{extractSingleValue(jsonValue, fieldSpec.getDataType())}; } } else { return new Object[]{fieldSpec.getDefaultNullValue()}; } } }
Map<String, JsonNode> sourceRefMap) { if (objectNode.get(EDITOR_CHILD_SHAPES) != null) { for (JsonNode jsonChildNode : objectNode.get(EDITOR_CHILD_SHAPES)) { if (targetNode != null && !targetNode.isNull()) { String targetRefId = targetNode.get(EDITOR_SHAPE_ID).asText(); List<JsonNode> sourceAndTargetList = new ArrayList<JsonNode>(); sourceAndTargetList.add(sourceRefMap.get(childNode.get(EDITOR_SHAPE_ID).asText())); sourceAndTargetList.add(shapeMap.get(targetRefId)); sourceAndTargetMap.put(childEdgeId,
public static JsonNode validateIfNodeIsTextual(JsonNode node) { if (node != null && !node.isNull() && node.isTextual() && StringUtils.isNotEmpty(node.asText())) { try { node = validateIfNodeIsTextual(objectMapper.readTree(node.asText())); } catch(Exception e) { logger.error("Error converting textual node", e); } } return node; }