use of jp.ossc.nimbus.service.journal.RequestJournal 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;
}
Aggregations