package com.testApp.server;

import com.isomorphic.datasource.DSRequest;
import com.isomorphic.datasource.DSResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by Ivan Hu on 1/7/16.
 */
public class TestBean {

	private static final Logger LOGGER = LoggerFactory.getLogger(TestBean.class);

	public DSResponse fetch(DSRequest request){
		long timestamp = System.currentTimeMillis();
		LOGGER.info("Fetch called with timestamp " + timestamp);
		DSResponse response = new DSResponse();

		Map<String, Object> record = new HashMap<String, Object>();
		record.put("field1", ""+timestamp);

		List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
		results.add(record);

		response.setData(results);
		return response;
	}

}
