Search in sources :

Example 16 with SimpleDumpData

use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.

the class DumpStruct method call.

public static Struct call(PageContext pc, Object object, double maxLevel, String show, String hide, double keys, boolean metainfo, boolean showUDFs, String label) {
    if (show != null && "all".equalsIgnoreCase(show.trim()))
        show = null;
    if (hide != null && "all".equalsIgnoreCase(hide.trim()))
        hide = null;
    Set<String> setShow = (show != null) ? ListUtil.listToSet(show.toLowerCase(), ",", true) : null;
    Set<String> setHide = (hide != null) ? ListUtil.listToSet(hide.toLowerCase(), ",", true) : null;
    DumpProperties properties = new DumpProperties((int) maxLevel, setShow, setHide, (int) keys, metainfo, showUDFs);
    DumpData dd = DumpUtil.toDumpData(object, pc, (int) maxLevel, properties);
    if (!StringUtil.isEmpty(label)) {
        DumpTable table = new DumpTable("#ffffff", "#cccccc", "#000000");
        table.appendRow(1, new SimpleDumpData(label));
        table.appendRow(0, dd);
        dd = table;
    }
    RefBoolean hasReference = new RefBooleanImpl(false);
    Struct sct = toStruct(dd, object, hasReference);
    sct.setEL("hasReference", hasReference.toBoolean());
    addMetaData(sct, object);
    return sct;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) RefBoolean(lucee.commons.lang.types.RefBoolean) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpProperties(lucee.runtime.dump.DumpProperties) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpData(lucee.runtime.dump.DumpData) Struct(lucee.runtime.type.Struct)

Example 17 with SimpleDumpData

use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.

the class DumpStruct method toStruct.

private static Struct toStruct(DumpData dd, Object object, RefBoolean hasReference) {
    DumpTable table;
    if (dd instanceof DumpTable)
        table = (DumpTable) dd;
    else {
        if (dd == null)
            dd = new SimpleDumpData("null");
        table = new DumpTable("#ffffff", "#cccccc", "#000000");
        table.appendRow(1, dd);
    }
    return toCFML(table, object, hasReference, null);
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 18 with SimpleDumpData

use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.

the class QueryUtil method toDumpData.

public static DumpData toDumpData(Query query, PageContext pageContext, int maxlevel, DumpProperties dp) {
    maxlevel--;
    Collection.Key[] keys = CollectionUtil.keys(query);
    DumpData[] heads = new DumpData[keys.length + 1];
    // int tmp=1;
    heads[0] = new SimpleDumpData("");
    for (int i = 0; i < keys.length; i++) {
        heads[i + 1] = new SimpleDumpData(keys[i].getString());
    }
    StringBuilder comment = new StringBuilder();
    // table.appendRow(1, new SimpleDumpData("SQL"), new SimpleDumpData(sql.toString()));
    String template = query.getTemplate();
    if (!StringUtil.isEmpty(template))
        comment.append("Template: ").append(template).append("\n");
    // table.appendRow(1, new SimpleDumpData("Template"), new SimpleDumpData(template));
    // in Query dump maxlevel is used as Top
    int top = dp.getMaxlevel();
    comment.append("Execution Time: ").append(Caster.toString(FormatUtil.formatNSAsMSDouble(query.getExecutionTime()))).append(" ms \n");
    comment.append("Record Count: ").append(Caster.toString(query.getRecordcount()));
    if (query.getRecordcount() > top)
        comment.append(" (showing top ").append(Caster.toString(top)).append(")");
    comment.append("\n");
    comment.append("Cached: ").append(query.isCached() ? "Yes\n" : "No\n");
    if (query.isCached() && query instanceof Query) {
        comment.append("Cache Type: ").append(query.getCacheType()).append("\n");
    }
    comment.append("Lazy: ").append(query instanceof SimpleQuery ? "Yes\n" : "No\n");
    SQL sql = query.getSql();
    if (sql != null)
        comment.append("SQL: ").append("\n").append(StringUtil.suppressWhiteSpace(sql.toString().trim())).append("\n");
    // table.appendRow(1, new SimpleDumpData("Execution Time (ms)"), new SimpleDumpData(exeTime));
    // table.appendRow(1, new SimpleDumpData("recordcount"), new SimpleDumpData(getRecordcount()));
    // table.appendRow(1, new SimpleDumpData("cached"), new SimpleDumpData(isCached()?"Yes":"No"));
    DumpTable recs = new DumpTable("query", "#cc99cc", "#ffccff", "#000000");
    recs.setTitle("Query");
    if (dp.getMetainfo())
        recs.setComment(comment.toString());
    recs.appendRow(new DumpRow(-1, heads));
    // body
    DumpData[] items;
    int recordcount = query.getRecordcount();
    int columncount = query.getColumnNames().length;
    for (int i = 0; i < recordcount; i++) {
        items = new DumpData[columncount + 1];
        items[0] = new SimpleDumpData(i + 1);
        for (int y = 0; y < keys.length; y++) {
            try {
                Object o = query.getAt(keys[y], i + 1);
                if (o instanceof String)
                    items[y + 1] = new SimpleDumpData(o.toString());
                else if (o instanceof Number)
                    items[y + 1] = new SimpleDumpData(Caster.toString(((Number) o)));
                else if (o instanceof Boolean)
                    items[y + 1] = new SimpleDumpData(((Boolean) o).booleanValue());
                else if (o instanceof Date)
                    items[y + 1] = new SimpleDumpData(Caster.toString(o));
                else if (o instanceof Clob)
                    items[y + 1] = new SimpleDumpData(Caster.toString(o));
                else
                    items[y + 1] = DumpUtil.toDumpData(o, pageContext, maxlevel, dp);
            } catch (PageException e) {
                items[y + 1] = new SimpleDumpData("[empty]");
            }
        }
        recs.appendRow(new DumpRow(1, items));
        if (i == top - 1)
            break;
    }
    if (!dp.getMetainfo())
        return recs;
    // table.appendRow(1, new SimpleDumpData("result"), recs);
    return recs;
}
Also used : PageException(lucee.runtime.exp.PageException) Query(lucee.runtime.type.Query) SimpleQuery(lucee.runtime.type.query.SimpleQuery) SimpleQuery(lucee.runtime.type.query.SimpleQuery) DumpRow(lucee.runtime.dump.DumpRow) DumpData(lucee.runtime.dump.DumpData) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Date(java.util.Date) SQL(lucee.runtime.db.SQL) DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Clob(java.sql.Clob) Key(lucee.runtime.type.Collection.Key)

Example 19 with SimpleDumpData

use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.

the class StructUtil method toDumpTable.

public static DumpTable toDumpTable(Struct sct, String title, PageContext pageContext, int maxlevel, DumpProperties dp) {
    Key[] keys = CollectionUtil.keys(sct);
    if (!(sct instanceof StructSupport) || ((StructSupport) sct).getType() != Struct.TYPE_LINKED)
        keys = order(sct, CollectionUtil.keys(sct));
    // "#9999ff","#ccccff","#000000"
    DumpTable table = new DumpTable("struct", "#9999ff", "#ccccff", "#000000");
    int maxkeys = dp.getMaxKeys();
    if (maxkeys < sct.size()) {
        table.setComment("Entries: " + sct.size() + " (showing top " + maxkeys + ")");
    } else if (sct.size() > 10 && dp.getMetainfo()) {
        table.setComment("Entries: " + sct.size());
    }
    if (!StringUtil.isEmpty(title))
        table.setTitle(title);
    maxlevel--;
    int index = 0;
    for (int i = 0; i < keys.length; i++) {
        if (DumpUtil.keyValid(dp, maxlevel, keys[i])) {
            if (maxkeys <= index++)
                break;
            table.appendRow(1, new SimpleDumpData(keys[i].toString()), DumpUtil.toDumpData(sct.get(keys[i], null), pageContext, maxlevel, dp));
        }
    }
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Key(lucee.runtime.type.Collection.Key)

Example 20 with SimpleDumpData

use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.

the class ArgumentImpl method toDumpData.

@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    DumpTable htmlBox = new DumpTable("struct", "#9999ff", "#ccccff", "#000000");
    htmlBox.setTitle("Scope Arguments");
    if (size() > 10 && dp.getMetainfo())
        htmlBox.setComment("Entries:" + size());
    maxlevel--;
    // Map mapx=getMap();
    // mapx.keySet().iterator();
    Iterator<Key> it = keyIterator();
    int count = 0;
    Collection.Key key;
    int maxkeys = dp.getMaxKeys();
    int index = 0;
    while (it.hasNext()) {
        // it.next();
        key = it.next();
        if (DumpUtil.keyValid(dp, maxlevel, key)) {
            if (maxkeys <= index++)
                break;
            htmlBox.appendRow(3, new SimpleDumpData(key.getString()), new SimpleDumpData(++count), DumpUtil.toDumpData(get(key, null), pageContext, maxlevel, dp));
        }
    }
    return htmlBox;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Collection(lucee.runtime.type.Collection)

Aggregations

DumpTable (lucee.runtime.dump.DumpTable)39 SimpleDumpData (lucee.runtime.dump.SimpleDumpData)39 DumpData (lucee.runtime.dump.DumpData)5 PageException (lucee.runtime.exp.PageException)4 Collection (lucee.runtime.type.Collection)4 Key (lucee.runtime.type.Collection.Key)4 DumpRow (lucee.runtime.dump.DumpRow)3 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)3 Struct (lucee.runtime.type.Struct)3 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 Binding (javax.wsdl.Binding)2 BindingOperation (javax.wsdl.BindingOperation)2 Operation (javax.wsdl.Operation)2 Port (javax.wsdl.Port)2 QName (javax.xml.namespace.QName)2 DumpProperties (lucee.runtime.dump.DumpProperties)2 DumpWriter (lucee.runtime.dump.DumpWriter)2 ExpressionException (lucee.runtime.exp.ExpressionException)2 Array (lucee.runtime.type.Array)2