All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.ql.impl.CqnParserImpl Maven / Gradle / Ivy

There is a newer version: 3.8.0
Show newest version
/*******************************************************************
 * © 2019 SAP SE or an SAP affiliate company. All rights reserved. *
 *******************************************************************/
package com.sap.cds.ql.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sap.cds.impl.parser.DeleteParser;
import com.sap.cds.impl.parser.SelectParser;
import com.sap.cds.impl.parser.UpdateParser;
import com.sap.cds.impl.parser.XsertParser;
import com.sap.cds.ql.CqnParser;
import com.sap.cds.ql.Delete;
import com.sap.cds.ql.Insert;
import com.sap.cds.ql.Select;
import com.sap.cds.ql.StructuredType;
import com.sap.cds.ql.Update;
import com.sap.cds.ql.Upsert;

public class CqnParserImpl implements CqnParser {
	private static final Logger logger = LoggerFactory.getLogger(CqnParserImpl.class);

	@SuppressWarnings("unchecked")
	@Override
	public Select> select(String cqn) {
		try {
			Select select = SelectParser.parse(cqn);
			return (Select>) select;
		} catch (UnsupportedOperationException e) {
			logger.warn("Failed to parse CQN Select: " + cqn, e);
			return null;
		}
	}

	@Override
	public Insert insert(String cqn) {
		return XsertParser.parseInsert(cqn);
	}

	@Override
	public Upsert upsert(String cqn) {
		return XsertParser.parseUpsert(cqn);
	}

	@Override
	public Update> update(String cqn) {
		return UpdateParser.parse(cqn);
	}

	@Override
	public Delete> delete(String cqn) {
		return DeleteParser.parse(cqn);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy