public static ValuePathExpression fromFilterExpression(AttributeReference attrRef, FilterExpression attributeExpression) throws FilterParseException { ValuePathExpression vpe = new ValuePathExpression(attrRef, attributeExpression); return vpe; }
@Override public void exitFilterValuePathExpression(FilterValuePathExpressionContext ctx) { String attributePath = ctx.attributePath.getText(); AttributeReference attributeReference = new AttributeReference(attributePath); String urn = attributeReference.getUrn(); String parentAttributeName = attributeReference.getAttributeName(); FilterExpression attributeExpression = (FilterExpression) expressionStack.pop(); ValuePathExpression valuePathExpression = new ValuePathExpression(attributeReference, attributeExpression); attributeExpression.setAttributePath(urn, parentAttributeName); expressionStack.push(valuePathExpression); }
@Override public void exitPatchPathPartial(PatchPathPartialContext ctx) { super.exitPatchPathPartial(ctx); String attributePathText = ctx.attributePath.getText(); AttributeReference attributePath = new AttributeReference(attributePathText); this.valuePathExpression = new ValuePathExpression(attributePath); } }
private PatchOperation buildPatchOperation(PatchOperation.Type patchOpType, ParseData parseData, List<String> attributeReferenceList, FilterExpression valueFilterExpression, List<String> subAttributes, Object value) { PatchOperation operation = new PatchOperation(); operation.setOperation(patchOpType); String attribute = attributeReferenceList.get(0); String subAttribute = attributeReferenceList.size() > 1 ? attributeReferenceList.get(1) : null; if (subAttribute == null && !subAttributes.isEmpty()) { subAttribute = subAttributes.get(0); } AttributeReference attributeReference = new AttributeReference(parseData.pathUri, attribute, subAttribute); PatchOperationPath patchOperationPath = new PatchOperationPath(); ValuePathExpression valuePathExpression = new ValuePathExpression(attributeReference, valueFilterExpression); patchOperationPath.setValuePathExpression(valuePathExpression); operation.setPath(patchOperationPath); operation.setValue(value); return operation; }
private PatchOperation buildPatchOperation(PatchOperation.Type patchOpType, ParseData parseData, List<String> attributeReferenceList, FilterExpression valueFilterExpression, List<String> subAttributes, Object value) { PatchOperation operation = new PatchOperation(); operation.setOperation(patchOpType); String attribute = attributeReferenceList.get(0); String subAttribute = attributeReferenceList.size() > 1 ? attributeReferenceList.get(1) : null; if (subAttribute == null && !subAttributes.isEmpty()) { subAttribute = subAttributes.get(0); } AttributeReference attributeReference = new AttributeReference(parseData.pathUri, attribute, subAttribute); PatchOperationPath patchOperationPath = new PatchOperationPath(); ValuePathExpression valuePathExpression = new ValuePathExpression(attributeReference, valueFilterExpression); patchOperationPath.setValuePathExpression(valuePathExpression); operation.setPath(patchOperationPath); operation.setValue(value); return operation; }
@Override public void exitPatchPathFull(PatchPathFullContext ctx) { super.exitPatchPathFull(ctx); String attributePathText = ctx.attributePath.getText(); String subAttributeName = ctx.subAttributeName != null ? ctx.subAttributeName.getText() : null; FilterExpression attributeExpression = expressionStack.pop(); AttributeReference attributePath = new AttributeReference(attributePathText); String urn = attributePath.getUrn(); String parentAttributeName = attributePath.getAttributeName(); attributeExpression.setAttributePath(urn, parentAttributeName); if (subAttributeName != null) { attributePath.setAttributeName(parentAttributeName); attributePath.setSubAttributeName(subAttributeName); } this.valuePathExpression = new ValuePathExpression(attributePath, attributeExpression); }
private PatchOperation handleExtensions(JsonNode valueNode, Type patchOpType, ParseData parseData) throws JsonProcessingException { PatchOperation operation = new PatchOperation(); operation.setOperation(patchOpType); AttributeReference attributeReference = new AttributeReference(parseData.pathUri, null); PatchOperationPath patchOperationPath = new PatchOperationPath(); ValuePathExpression valuePathExpression = new ValuePathExpression(attributeReference); patchOperationPath.setValuePathExpression(valuePathExpression); operation.setPath(patchOperationPath); operation.setValue(determineValue(patchOpType, valueNode, parseData)); return operation; }
private PatchOperation handleExtensions(JsonNode valueNode, Type patchOpType, ParseData parseData) throws JsonProcessingException { PatchOperation operation = new PatchOperation(); operation.setOperation(patchOpType); AttributeReference attributeReference = new AttributeReference(parseData.pathUri, null); PatchOperationPath patchOperationPath = new PatchOperationPath(); ValuePathExpression valuePathExpression = new ValuePathExpression(attributeReference); patchOperationPath.setValuePathExpression(valuePathExpression); operation.setPath(patchOperationPath); operation.setValue(determineValue(patchOpType, valueNode, parseData)); return operation; }