package org.ts.ddcs.Worker;


import org.ts.ddcs.DataTemplate.TemplateLineNode;
import org.ts.ddcs.Log.LogHelper;

import java.util.concurrent.Callable;


/**
 * 数据永久化处理工作线程
 *
 * @author dylan
 */
public class DataSaveProcess implements Callable<Integer> {
    private TemplateLineNode templateLineNode;

    DataSaveProcess(TemplateLineNode templateLineNode) {
        this.templateLineNode = templateLineNode;
    }

    @Override
    public Integer call() {
        try {
            if (null != this.templateLineNode.getDataSaveProcess()) {
                this.templateLineNode.getDataSaveProcess().Save(this.templateLineNode.getDataTemplate());
            }
        } catch (Exception e) {
            LogHelper.error(e);
        }
        return 0;
    }
}
