Search in sources :

Example 1 with JournalEditor

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

the class ObjectMappedEditorFinderService method startService.

/* (非 Javadoc)
	 * @see jp.ossc.nimbus.core.ServiceBaseSupport#startService()
	 */
public void startService() throws Exception {
    // 上位リポジトリの取得
    if (mFinderServiceName != null) {
        this.mParentFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(this.mFinderServiceName);
    }
    ServiceNameEditor editor = new ServiceNameEditor();
    editor.setServiceManagerName(getServiceManagerName());
    // 自分が管理するエディターサービスの設定
    Iterator iterator = mEditorMap.keySet().iterator();
    while (iterator.hasNext()) {
        String classAndKey = (String) iterator.next();
        String key = null;
        String clsName = null;
        final int index = classAndKey.indexOf(',');
        if (index == -1) {
            clsName = classAndKey;
        } else {
            clsName = classAndKey.substring(0, index);
            if (index != classAndKey.length() - 1) {
                key = classAndKey.substring(index + 1);
            }
        }
        Class cls = convertStringToClass(clsName);
        JournalEditor journalEditor = null;
        Object value = mEditorMap.get(classAndKey);
        if (value instanceof String) {
            String serviceName = (String) value;
            editor.setAsText(serviceName);
            ServiceName name = (ServiceName) editor.getValue();
            journalEditor = (JournalEditor) ServiceManagerFactory.getServiceObject(name);
        } else if (value instanceof JournalEditor) {
            journalEditor = (JournalEditor) value;
        }
        Map keyEditorMap = (Map) mEditorRepository.getValueOf(cls);
        if (keyEditorMap == null) {
            keyEditorMap = new HashMap();
            mEditorRepository.add(cls, keyEditorMap);
        }
        keyEditorMap.put(key, journalEditor);
    }
}
Also used : ServiceNameEditor(jp.ossc.nimbus.beans.ServiceNameEditor) ServiceName(jp.ossc.nimbus.core.ServiceName) HashMap(java.util.HashMap) Iterator(java.util.Iterator) JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with JournalEditor

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

the class DebugService method getParameterString.

/**
 * Object→String変換を行う。<p>
 * このメソッドには、以下の実装が行われている。<br>
 * <ol>
 *   <li>対応するエディタを取得する</li>
 *   <li>エディタを使用してStringに変換する</li>
 * </ol>
 */
private String getParameterString(Object param) {
    if (param != null) {
        // 対応するエディタを取得して文字列に変換する
        final JournalEditor editor = mEditorFinder.findEditor(param.getClass());
        final String str = (String) editor.toObject(mEditorFinder, null, param);
        // @変換に引っかからないように$に変換する
        if (str != null)
            str.replace('@', ATMARK_REPLACE_CHAR);
        return str;
    } else {
        return "null";
    }
}
Also used : JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor)

Example 3 with JournalEditor

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

the class JSONJournalEditorService method appendUnknownValue.

protected StringBuilder appendUnknownValue(StringBuilder buf, EditorFinder finder, Class type, Object value) {
    JournalEditor editor = finder.findEditor(value);
    if (editor != null && editor != this) {
        value = editor.toObject(finder, null, value);
        if (editor instanceof JSONJournalEditorService) {
            buf.append(value.toString());
        } else {
            buf.append(STRING_ENCLOSURE);
            buf.append(escape(value.toString()));
            buf.append(STRING_ENCLOSURE);
        }
    } else {
        buf.append(STRING_ENCLOSURE);
        buf.append(escape(value.toString()));
        buf.append(STRING_ENCLOSURE);
    }
    return buf;
}
Also used : JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor)

Example 4 with JournalEditor

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

the class DynaPropertyCSVJournalEditorService 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 5 with JournalEditor

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

the class ServletResponseCSVJournalEditorService 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)

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