Search in sources :

Example 31 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetComponentMappings.

private void doGetComponentMappings() throws PageException {
    Mapping[] mappings = config.getComponentMappings();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "archive", "strarchive", "physical", "strphysical", "virtual", "hidden", "physicalFirst", "readonly", "inspect" }, mappings.length, "query");
    for (int i = 0; i < mappings.length; i++) {
        MappingImpl m = (MappingImpl) mappings[i];
        int row = i + 1;
        qry.setAt("archive", row, m.getArchive());
        qry.setAt("strarchive", row, m.getStrArchive());
        qry.setAt("physical", row, m.getPhysical());
        qry.setAt("strphysical", row, m.getStrPhysical());
        qry.setAt("virtual", row, m.getVirtual());
        qry.setAt("hidden", row, Caster.toBoolean(m.isHidden()));
        qry.setAt("physicalFirst", row, Caster.toBoolean(m.isPhysicalFirst()));
        qry.setAt("readonly", row, Caster.toBoolean(m.isReadonly()));
        qry.setAt("inspect", row, ConfigWebUtil.inspectTemplate(m.getInspectTemplateRaw(), ""));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Mapping(lucee.runtime.Mapping) MappingImpl(lucee.runtime.MappingImpl) Query(lucee.runtime.type.Query)

Example 32 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetMailServers.

private void doGetMailServers() throws PageException {
    Server[] servers = config.getMailServers();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "id", "hostname", "password", "passwordEncrypted", "username", "port", "authentication", "readonly", "tls", "ssl", "life", "idle", "type" }, servers.length, "query");
    for (int i = 0; i < servers.length; i++) {
        Server s = servers[i];
        int row = i + 1;
        qry.setAt("id", row, s instanceof ServerImpl ? ((ServerImpl) s).getId() : -1);
        qry.setAt("hostname", row, s.getHostName());
        qry.setAt("password", row, s.isReadOnly() ? "" : s.getPassword());
        qry.setAt("passwordEncrypted", row, s.isReadOnly() ? "" : ConfigWebUtil.encrypt(s.getPassword()));
        qry.setAt("username", row, s.isReadOnly() ? "" : s.getUsername());
        qry.setAt("port", row, Caster.toInteger(s.getPort()));
        qry.setAt("readonly", row, Caster.toBoolean(s.isReadOnly()));
        qry.setAt("authentication", row, Caster.toBoolean(s.hasAuthentication()));
        qry.setAt("ssl", row, Caster.toBoolean(s.isSSL()));
        qry.setAt("tls", row, Caster.toBoolean(s.isTLS()));
        if (s instanceof ServerImpl) {
            ServerImpl si = (ServerImpl) s;
            qry.setAt("type", row, si.getType() == ServerImpl.TYPE_GLOBAL ? "global" : "local");
            qry.setAt("life", row, (si.getLifeTimeSpan() / 1000));
            qry.setAt("idle", row, (si.getIdleTimeSpan() / 1000));
        }
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) ConfigServer(lucee.runtime.config.ConfigServer) Server(lucee.runtime.net.mail.Server) ServerImpl(lucee.runtime.net.mail.ServerImpl) ConfigServerImpl(lucee.runtime.config.ConfigServerImpl) Query(lucee.runtime.type.Query)

Example 33 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetExtensionProviders.

private void doGetExtensionProviders() throws PageException {
    ExtensionProvider[] providers = config.getExtensionProviders();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "url", "isReadOnly" }, providers.length, "query");
    ExtensionProvider provider;
    for (int i = 0; i < providers.length; i++) {
        provider = providers[i];
        int row = i + 1;
        // qry.setAt("name",row,provider.getName());
        qry.setAt(KeyConstants._url, row, provider.getUrlAsString());
        qry.setAt("isReadOnly", row, Caster.toBoolean(provider.isReadOnly()));
    // qry.setAt("cacheTimeout",row,Caster.toDouble(provider.getCacheTimeout()/1000));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) RHExtensionProvider(lucee.runtime.extension.RHExtensionProvider) ExtensionProvider(lucee.runtime.extension.ExtensionProvider) Query(lucee.runtime.type.Query)

Example 34 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetFLDs.

/**
 * @throws PageException
 */
private void doGetFLDs() throws PageException {
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "displayname", "namespace", "namespaceseparator", "shortname", "description", "uri", "source" }, new String[] { "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar" }, 0, "tlds");
    int dialect = "lucee".equalsIgnoreCase(getString("dialect", "cfml")) ? CFMLEngine.DIALECT_LUCEE : CFMLEngine.DIALECT_CFML;
    FunctionLib[] libs = config.getFLDs(dialect);
    for (int i = 0; i < libs.length; i++) {
        qry.addRow();
        qry.setAt("displayname", i + 1, libs[i].getDisplayName());
        // TODO support for namespace
        qry.setAt("namespace", i + 1, "");
        qry.setAt("namespaceseparator", i + 1, "");
        qry.setAt("shortname", i + 1, libs[i].getShortName());
        qry.setAt("description", i + 1, libs[i].getDescription());
        qry.setAt("uri", i + 1, Caster.toString(libs[i].getUri()));
        qry.setAt("source", i + 1, StringUtil.emptyIfNull(libs[i].getSource()));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) FunctionLib(lucee.transformer.library.function.FunctionLib) Query(lucee.runtime.type.Query)

Example 35 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetExtensions.

private void doGetExtensions() throws PageException {
    Extension[] extensions = config.getExtensions();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "type", "provider", "id", "config", "version", "category", "description", "image", "label", "name", "author", "codename", "video", "support", "documentation", "forum", "mailinglist", "network", "created" }, 0, "query");
    String provider = getString("provider", null);
    String id = getString("id", null);
    Extension extension;
    String extProvider, extId;
    int row = 0;
    for (int i = 0; i < extensions.length; i++) {
        extension = extensions[i];
        if (!extension.getType().equalsIgnoreCase("all") && toType(extension.getType(), false) != type)
            continue;
        extProvider = extension.getProvider();
        extId = extension.getId();
        if (provider != null && !provider.equalsIgnoreCase(extProvider))
            continue;
        if (id != null && !id.equalsIgnoreCase(extId))
            continue;
        qry.addRow();
        row++;
        qry.setAt("provider", row, extProvider);
        qry.setAt(KeyConstants._id, row, extId);
        qry.setAt(KeyConstants._config, row, extension.getConfig(pageContext));
        qry.setAt(KeyConstants._version, row, extension.getVersion());
        qry.setAt("category", row, extension.getCategory());
        qry.setAt(KeyConstants._description, row, extension.getDescription());
        qry.setAt("image", row, extension.getImage());
        qry.setAt(KeyConstants._label, row, extension.getLabel());
        qry.setAt(KeyConstants._name, row, extension.getName());
        qry.setAt(KeyConstants._author, row, extension.getAuthor());
        qry.setAt("codename", row, extension.getCodename());
        qry.setAt("video", row, extension.getVideo());
        qry.setAt("support", row, extension.getSupport());
        qry.setAt("documentation", row, extension.getDocumentation());
        qry.setAt("forum", row, extension.getForum());
        qry.setAt("mailinglist", row, extension.getMailinglist());
        qry.setAt("network", row, extension.getNetwork());
        qry.setAt(KeyConstants._created, row, extension.getCreated());
        qry.setAt(KeyConstants._type, row, extension.getType());
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : Extension(lucee.runtime.extension.Extension) RHExtension(lucee.runtime.extension.RHExtension) QueryImpl(lucee.runtime.type.QueryImpl) Query(lucee.runtime.type.Query)

Aggregations

QueryImpl (lucee.runtime.type.QueryImpl)82 Query (lucee.runtime.type.Query)65 Collection (lucee.runtime.type.Collection)17 Struct (lucee.runtime.type.Struct)16 StructImpl (lucee.runtime.type.StructImpl)13 PageException (lucee.runtime.exp.PageException)12 Key (lucee.runtime.type.Collection.Key)12 Iterator (java.util.Iterator)11 Map (java.util.Map)10 ApplicationException (lucee.runtime.exp.ApplicationException)10 Array (lucee.runtime.type.Array)10 DatabaseException (lucee.runtime.exp.DatabaseException)9 Stopwatch (lucee.runtime.timer.Stopwatch)9 HashMap (java.util.HashMap)8 Resource (lucee.commons.io.res.Resource)7 BundleCollection (lucee.loader.osgi.BundleCollection)7 Entry (java.util.Map.Entry)6 IOException (java.io.IOException)5 ResultSet (java.sql.ResultSet)5 ArrayImpl (lucee.runtime.type.ArrayImpl)5