Search in sources :

Example 11 with ArrayImpl

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;
}
Also used : Array(lucee.runtime.type.Array) ArrayImpl(lucee.runtime.type.ArrayImpl) DataSource(coldfusion.sql.DataSource)

Example 12 with ArrayImpl

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()));
}
Also used : StructImpl(lucee.runtime.type.StructImpl) ArrayImpl(lucee.runtime.type.ArrayImpl) Struct(lucee.runtime.type.Struct)

Example 13 with ArrayImpl

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;
        }
    }
}
Also used : Array(lucee.runtime.type.Array) ClassDefinitionImpl(lucee.transformer.library.ClassDefinitionImpl) ArrayImpl(lucee.runtime.type.ArrayImpl) ClassDefinition(lucee.runtime.db.ClassDefinition)

Example 14 with ArrayImpl

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;
}
Also used : Array(lucee.runtime.type.Array) Closure(lucee.runtime.type.Closure) ArrayImpl(lucee.runtime.type.ArrayImpl) FunctionException(lucee.runtime.exp.FunctionException)

Example 15 with ArrayImpl

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;
}
Also used : Array(lucee.runtime.type.Array) ArrayImpl(lucee.runtime.type.ArrayImpl)

Aggregations

ArrayImpl (lucee.runtime.type.ArrayImpl)100 Array (lucee.runtime.type.Array)79 Struct (lucee.runtime.type.Struct)33 StructImpl (lucee.runtime.type.StructImpl)24 PageException (lucee.runtime.exp.PageException)14 Entry (java.util.Map.Entry)13 Key (lucee.runtime.type.Collection.Key)12 ArgumentIntKey (lucee.runtime.type.scope.ArgumentIntKey)8 IOException (java.io.IOException)7 Iterator (java.util.Iterator)7 ArrayList (java.util.ArrayList)6 ListIterator (java.util.ListIterator)6 FunctionException (lucee.runtime.exp.FunctionException)6 ForEachQueryIterator (lucee.runtime.type.it.ForEachQueryIterator)6 ApplicationException (lucee.runtime.exp.ApplicationException)5 ExpressionException (lucee.runtime.exp.ExpressionException)5 Query (lucee.runtime.type.Query)5 QueryImpl (lucee.runtime.type.QueryImpl)5 ListAsArray (lucee.runtime.type.wrap.ListAsArray)5 NodeList (org.w3c.dom.NodeList)5