package com.yihu.hos.crawler.model.standard;


import com.yihu.hos.crawler.format.AdapterBase;
import com.yihu.hos.standard.model.standard.StdDictionaryEntryModel;
import com.yihu.hos.standard.model.standard.StdDictionaryModel;

/**
 * @author Air
 * @version 1.0
 * @created 2015.08.11 15:25
 */
public class StdDict extends AdapterBase {
    private StdDictionaryModel stdDictT;

    public StdDict(StdDictionaryModel stdDictT) {
        this.stdDictT = stdDictT;
    }

    public StdDictionaryModel getStdDictT() {
        return stdDictT;
    }

    public String toValue(String code) {
        StdDictionaryEntryModel entryModel=getStdDictEntryService().getStEntryValueByCode(adapterVersion.getVersion(), stdDictT.getId(), code);
        if (entryModel==null){
            return null;
        }else {
            return entryModel.getValue();
        }
    }

    public String toCode(String value) {
        StdDictionaryEntryModel entryModel=getStdDictEntryService().getStEntryValueByCode(adapterVersion.getVersion(), stdDictT.getId(), value);
        if (entryModel==null){
            return null;
        }else {
            return entryModel.getCode();
        }
    }
}
