net.sf.aguacate.context.spi.sql.impl.SentenceSqlArrayIterator Maven / Gradle / Ivy
package net.sf.aguacate.context.spi.sql.impl;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.sf.aguacate.function.Function;
import net.sf.aguacate.function.FunctionContext;
import net.sf.aguacate.function.FunctionEvalResult;
/**
*
* "name": "...",
* "type": "ARRAY_ITERATOR",
* "sentences": {
* ...
* },
* "methods": [
* ...
* ]
*
*/
public class SentenceSqlArrayIterator extends AbstractSentenceSql {
private static final Logger LOGGER = LogManager.getLogger(SentenceSqlArrayIterator.class);
private final Function[] sentences;
private final String initialContext;
private final String[] complement;
public SentenceSqlArrayIterator(String name, String message, List methods, List required,
List optional, List sentences) {
super(name, message, methods);
this.sentences = sentences.toArray(new Function[sentences.size()]);
initialContext = required.get(0);
if (optional.size() == 0) {
complement = new String[0];
} else {
complement = optional.toArray(new String[optional.size()]);
}
}
@Override
public String getOutputName() {
return null;
}
@Override
public FunctionEvalResult evaluate0(FunctionContext functionContext, Map context)
throws SQLException {
@SuppressWarnings("unchecked")
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy