package com.yihu.hos.crawler.format;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.hos.crawler.model.adapter.AdapterDataSet;
import com.yihu.hos.crawler.model.patient.Patient;
import com.yihu.hos.crawler.model.transform.TransformType;

import java.io.IOException;
import java.util.Map;

/**
 * Created by Administrator on 2015/10/15.
 */
public class DocumentTransformer implements IDataTransformer  {
    private JsonNode jsonObject;
    protected AdapterScheme adapterScheme;
    protected Patient patient;

    public DocumentTransformer(AdapterScheme adapterScheme) {
        this.adapterScheme = adapterScheme;
    }

    @Override
    public Patient getPatient() {
        return patient;
    }

    /**
     * 非结构化的不需要转换
     *
     * @return
     */
    public boolean transfer(Map<String, AdapterDataSet> dataSetMap) {
        return true;
    }

    public JsonNode getJsonObject() {
        return jsonObject;
    }

    public String getData() {
        return jsonObject.asText();
    }

    public void setData(JsonNode data) {
        jsonObject = data;
    }

    public TransformType getTransformType() {
        return TransformType.DOCUMENT;
    }
}
