Search in sources :

Example 1 with GdbVertex

use of com.alibaba.datax.plugin.writer.gdbwriter.model.GdbVertex in project DataX by alibaba.

the class DefaultGdbMapper method addToProperties.

private static boolean addToProperties(final GdbElement e, final String key, final String value, final String type, final String card) {
    final Object pValue;
    final ValueType valueType = ValueType.fromShortName(type);
    if (valueType == ValueType.STRING) {
        pValue = value;
    } else if (valueType == ValueType.INT || valueType == ValueType.INTEGER) {
        pValue = Integer.valueOf(value);
    } else if (valueType == ValueType.LONG) {
        pValue = Long.valueOf(value);
    } else if (valueType == ValueType.DOUBLE) {
        pValue = Double.valueOf(value);
    } else if (valueType == ValueType.FLOAT) {
        pValue = Float.valueOf(value);
    } else if (valueType == ValueType.BOOLEAN) {
        pValue = Boolean.valueOf(value);
    } else {
        log.error("invalid property key {}, value {}, type {}", key, value, type);
        return false;
    }
    // apply vertexSetProperty
    if (Key.PropertyType.set.name().equals(card) && (e instanceof GdbVertex)) {
        e.addProperty(key, pValue, Key.PropertyType.set);
    } else {
        e.addProperty(key, pValue);
    }
    return true;
}
Also used : GdbVertex(com.alibaba.datax.plugin.writer.gdbwriter.model.GdbVertex) JSONObject(com.alibaba.fastjson.JSONObject)

Aggregations

GdbVertex (com.alibaba.datax.plugin.writer.gdbwriter.model.GdbVertex)1 JSONObject (com.alibaba.fastjson.JSONObject)1