Search in sources :

Example 6 with JournalEditor

use of jp.ossc.nimbus.service.journal.JournalEditor in project nimbus by nimbus-org.

the class DynaBeanCSVJournalEditorService method processCSV.

protected void processCSV(EditorFinder finder, Object key, Object value) {
    for (int i = 0; i < outputElementKeys.length; i++) {
        final JournalEditor editor = findElementEditor(outputElementKeys[i]);
        addElement(editor.toObject(finder, key, value));
    }
}
Also used : JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor)

Example 7 with JournalEditor

use of jp.ossc.nimbus.service.journal.JournalEditor in project nimbus by nimbus-org.

the class DynaClassCSVJournalEditorService method processCSV.

protected void processCSV(EditorFinder finder, Object key, Object value) {
    for (int i = 0; i < outputElementKeys.length; i++) {
        final JournalEditor editor = findElementEditor(outputElementKeys[i]);
        addElement(editor.toObject(finder, key, value));
    }
}
Also used : JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor)

Example 8 with JournalEditor

use of jp.ossc.nimbus.service.journal.JournalEditor in project nimbus by nimbus-org.

the class CSVJournalEditorServiceBase method makeCSVFormat.

protected void makeCSVFormat(EditorFinder finder, Object key, Object value, StringBuilder buf) {
    final List elements = (List) csvElements.get();
    if (elements != null) {
        final StringBuilder tmpBuf = new StringBuilder();
        final Iterator values = elements.iterator();
        while (values.hasNext()) {
            final Object val = values.next();
            final JournalEditor editor = finder.findEditor(key, val);
            tmpBuf.setLength(0);
            makeObjectFormat(finder, key, val, tmpBuf);
            escape(editor, tmpBuf);
            enclose(editor, tmpBuf);
            buf.append(tmpBuf);
            if (values.hasNext()) {
                buf.append(getCSVSeparator());
            }
        }
        elements.clear();
    }
}
Also used : JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor)

Example 9 with JournalEditor

use of jp.ossc.nimbus.service.journal.JournalEditor in project nimbus by nimbus-org.

the class HttpSessionCSVJournalEditorService method processCSV.

protected void processCSV(EditorFinder finder, Object key, Object value) {
    for (int i = 0; i < outputElementKeys.length; i++) {
        final JournalEditor editor = findElementEditor(outputElementKeys[i]);
        addElement(editor.toObject(finder, key, value));
    }
}
Also used : JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor)

Example 10 with JournalEditor

use of jp.ossc.nimbus.service.journal.JournalEditor in project nimbus by nimbus-org.

the class RequestJournalJSONJournalEditorService method appendUnknownValue.

protected StringBuilder appendUnknownValue(StringBuilder buf, EditorFinder finder, Class type, Object value) {
    if (!(value instanceof RequestJournal)) {
        return super.appendUnknownValue(buf, finder, type, value);
    }
    RequestJournal request = (RequestJournal) value;
    buf.append(OBJECT_ENCLOSURE_START);
    boolean isOutput = false;
    if (isOutputProperty(PROPERTY_REQUEST_ID)) {
        appendProperty(buf, finder, PROPERTY_REQUEST_ID, request.getRequestId());
        isOutput = true;
    }
    if (isOutputProperty(PROPERTY_START_TIME)) {
        if (isOutput) {
            buf.append(ARRAY_SEPARATOR);
        }
        appendProperty(buf, finder, PROPERTY_START_TIME, request.getStartTime());
        isOutput = true;
    }
    if (isOutputProperty(PROPERTY_JOURNAL_RECORD)) {
        JournalRecord[] records = request.getParamAry();
        if (records != null && records.length != 0) {
            if (isOutput) {
                buf.append(ARRAY_SEPARATOR);
            }
            appendName(buf, PROPERTY_JOURNAL_RECORD);
            buf.append(PROPERTY_SEPARATOR);
            buf.append(ARRAY_ENCLOSURE_START);
            boolean isOutputPre = false;
            for (int i = 0, imax = records.length; i < imax; i++) {
                JournalRecord record = records[i];
                isOutput = isOutputProperty(record.getKey());
                if (isOutputPre && isOutput) {
                    buf.append(ARRAY_SEPARATOR);
                }
                if (isOutput) {
                    Object infoObj = record.toObject(finder);
                    JournalEditor editor = record.getJournalEditor();
                    if (editor != null && editor instanceof JSONJournalEditorService) {
                        buf.append(infoObj);
                    } else {
                        buf.append(OBJECT_ENCLOSURE_START);
                        appendProperty(buf, finder, record.getKey(), infoObj);
                        buf.append(OBJECT_ENCLOSURE_END);
                    }
                    isOutputPre = isOutput;
                }
            }
            buf.append(ARRAY_ENCLOSURE_END);
            isOutput = true;
        }
    }
    if (isOutputProperty(PROPERTY_END_TIME)) {
        if (isOutput) {
            buf.append(ARRAY_SEPARATOR);
        }
        appendProperty(buf, finder, PROPERTY_END_TIME, request.getEndTime());
        isOutput = true;
    }
    if (isOutputProperty(PROPERTY_PERFORMANCE)) {
        if (isOutput) {
            buf.append(ARRAY_SEPARATOR);
        }
        appendProperty(buf, finder, PROPERTY_PERFORMANCE, new Long(request.getEndTime().getTime() - request.getStartTime().getTime()));
        isOutput = true;
    }
    buf.append(OBJECT_ENCLOSURE_END);
    return buf;
}
Also used : RequestJournal(jp.ossc.nimbus.service.journal.RequestJournal) JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor) JournalRecord(jp.ossc.nimbus.service.journal.JournalRecord)

Aggregations

JournalEditor (jp.ossc.nimbus.service.journal.JournalEditor)13 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Iterator (java.util.Iterator)1 ServiceNameEditor (jp.ossc.nimbus.beans.ServiceNameEditor)1 ServiceName (jp.ossc.nimbus.core.ServiceName)1 JournalRecord (jp.ossc.nimbus.service.journal.JournalRecord)1 RequestJournal (jp.ossc.nimbus.service.journal.RequestJournal)1