
org.talend.esb.sam.server.ui.JsonRowMapper Maven / Gradle / Ivy
/*
* #%L
* Service Activity Monitoring :: Server
* %%
* Copyright (C) 2011 - 2012 Talend Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package org.talend.esb.sam.server.ui;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import org.springframework.jdbc.core.ColumnMapRowMapper;
import org.springframework.jdbc.core.RowMapper;
/**
* Intelligent mapper that tries to read all fields
* from {@link ResultSet}.
*
* @author zubairov
*/
public class JsonRowMapper implements RowMapper {
@SuppressWarnings("serial")
private static final Map NAME_MAPPING = new HashMap() {
{
put("ID", "id");
put("MI_FLOW_ID", "flowID");
put("EI_TIMESTAMP", "timestamp");
put("EI_EVENT_TYPE", "type");
put("MI_PORT_TYPE", "port");
put("MI_OPERATION_NAME", "operation");
put("MI_TRANSPORT_TYPE", "transport");
put("ORIG_HOSTNAME", "host");
put("ORIG_IP", "ip");
put("ORIG_CUSTOM_ID", "customID");
put("ORIG_PROCESS_ID", "process");
put("ORIG_PRINCIPAL", "principal");
put("MI_MESSAGE_ID", "messageID");
put("CONTENT_CUT", "contentCut");
put("MESSAGE_CONTENT", "content");
put("CUST_KEY", "custKey");
put("CUST_VALUE", "custValue");
}
};
private final RowMapper
© 2015 - 2025 Weber Informatics LLC | Privacy Policy