use of lucee.runtime.type.ArrayImpl in project Lucee by lucee.
the class DataSourceServiceImpl method getNames.
@Override
public Array getNames() throws SecurityException {
checkReadAccess();
lucee.runtime.db.DataSource[] sources = config().getDataSources();
Array names = new ArrayImpl();
for (int i = 0; i < sources.length; i++) {
names.appendEL(sources[i].getName());
}
return names;
}
use of lucee.runtime.type.ArrayImpl in project Lucee by lucee.
the class Admin method doGetCustomTagSetting.
private void doGetCustomTagSetting() throws PageException {
Struct sct = new StructImpl();
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
// deprecated
sct.set("customTagDeepSearch", Caster.toBoolean(config.doCustomTagDeepSearch()));
// deprecated
sct.set("customTagLocalSearch", Caster.toBoolean(config.doLocalCustomTag()));
sct.set("deepSearch", Caster.toBoolean(config.doCustomTagDeepSearch()));
sct.set("localSearch", Caster.toBoolean(config.doLocalCustomTag()));
sct.set("customTagPathCache", Caster.toBoolean(config.useCTPathCache()));
sct.set("extensions", new ArrayImpl(config.getCustomTagExtensions()));
}
use of lucee.runtime.type.ArrayImpl in project Lucee by lucee.
the class XMLConfigAdmin method getResourceProviders.
private void getResourceProviders(ResourceProvider[] providers, Query qry, Element p, int row, Boolean def) throws PageException {
Array support = new ArrayImpl();
String cn = p.getAttribute("class");
String name = p.getAttribute("bundle-name");
String version = p.getAttribute("bundle-version");
ClassDefinition cd = new ClassDefinitionImpl(cn, name, version, ThreadLocalPageContext.getConfig().getIdentification());
qry.setAt("scheme", row, p.getAttribute("scheme"));
qry.setAt("arguments", row, p.getAttribute("arguments"));
qry.setAt("class", row, cd.getClassName());
qry.setAt("bundleName", row, cd.getName());
qry.setAt("bundleVersion", row, cd.getVersionAsString());
for (int i = 0; i < providers.length; i++) {
if (providers[i].getClass().getName().equals(cd.getClassName())) {
if (providers[i].isAttributesSupported())
support.append("attributes");
if (providers[i].isModeSupported())
support.append("mode");
qry.setAt("support", row, ListUtil.arrayToList(support, ","));
qry.setAt("scheme", row, providers[i].getScheme());
qry.setAt("caseSensitive", row, Caster.toBoolean(providers[i].isCaseSensitive()));
qry.setAt("default", row, def);
break;
}
}
}
use of lucee.runtime.type.ArrayImpl in project Lucee by lucee.
the class ArrayFindAll method find.
public static Array find(PageContext pc, Array array, UDF udf) throws PageException {
Array rtn = new ArrayImpl();
int len = array.size();
Object[] arr = new Object[1];
Object res;
Boolean b;
for (int i = 1; i <= len; i++) {
arr[0] = array.get(i, null);
if (arr[0] != null) {
res = udf.call(pc, arr, false);
b = Caster.toBoolean(res, null);
if (b == null)
throw new FunctionException(pc, "ArrayFindAll", 2, "function", "return value of the " + (udf instanceof Closure ? "closure" : "function [" + udf.getFunctionName() + "]") + " cannot be casted to a boolean value.", CasterException.createMessage(res, "boolean"));
if (b.booleanValue()) {
rtn.appendEL(Caster.toDouble(i));
}
}
}
return rtn;
}
use of lucee.runtime.type.ArrayImpl in project Lucee by lucee.
the class ArrayFindAll method find.
public static Array find(Array array, Object value, boolean caseSensitive) throws PageException {
Array rtn = new ArrayImpl();
int len = array.size();
boolean valueIsSimple = Decision.isSimpleValue(value);
Object o;
for (int i = 1; i <= len; i++) {
o = array.get(i, null);
if (o != null && Operator.equals(o, value, caseSensitive, !valueIsSimple)) {
rtn.appendEL(Caster.toDouble(i));
}
}
return rtn;
}
Aggregations