com.sap.cds.impl.parser.DeleteParser Maven / Gradle / Ivy
/*******************************************************************
* © 2019 SAP SE or an SAP affiliate company. All rights reserved. *
*******************************************************************/
package com.sap.cds.impl.parser;
import com.fasterxml.jackson.databind.JsonNode;
import com.jayway.jsonpath.DocumentContext;
import com.sap.cds.ql.Delete;
import com.sap.cds.ql.StructuredType;
import com.sap.cds.ql.cqn.CqnPredicate;
import com.sap.cds.ql.cqn.CqnStructuredTypeRef;
import com.sap.cds.ql.impl.DeleteBuilder;
public class DeleteParser extends CqnParser {
private DeleteParser(DocumentContext cqn) {
super(cqn);
}
public static DeleteParser of(String cqn) {
return new DeleteParser(getDocumentContext(cqn));
}
public static Delete> parse(String cqn) {
return of(cqn).parse();
}
public Delete> parse() {
CqnStructuredTypeRef ref = TokenParser.ref(cqn.read("$.DELETE.from"));
return DeleteBuilder.from(ref).where(where());
}
private CqnPredicate where() {
JsonNode where = cqn.read("$.DELETE.where");
return ExpressionParser.parsePredicate(where);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy