package com.yihu.hos.standard.service.bo;

import com.yihu.hos.web.framework.constant.SqlConstants;
import com.yihu.hos.common.ObjectVersion;

public class AdapterVersion {
    public static final String FBVersion = "000000000000";
    public final static String DataSetTablePrefix = "adapter_dataset";
    public final static String MetaDataTablePrefix = "adapter_metadata";
    public final static String DictTablePrefix = "adapter_dict";
    public final static String DictEntryTablePrefix = "adapter_dictentry";
    public final static String DatasetRelationTablePrefix = "adapter_dataset_relation";

    private ObjectVersion version;

    public AdapterVersion(String version) {
        this.version = new ObjectVersion(version);
    }

    public static AdapterVersion generateVersion() {
        ObjectVersion objectVersion = new ObjectVersion();

        return new AdapterVersion(objectVersion.toString());
    }

    public String getDataSetTableName() {
        return DataSetTablePrefix + SqlConstants.UNDERLINE + version;
    }

    public String getMetaDataTableName() {
        return MetaDataTablePrefix + SqlConstants.UNDERLINE + version;
    }

    public String getDictTableName() {
        return DictTablePrefix + SqlConstants.UNDERLINE + version;
    }

    public String getDictEntryTableName() {
        return DictEntryTablePrefix + SqlConstants.UNDERLINE + version;
    }

    public String getDatasetRelationTableName() {
        return DatasetRelationTablePrefix + SqlConstants.UNDERLINE + version;
    }

    public String getVersion() {
        return version.toString();
    }

    public void finalize() throws Throwable {
    }
}