Search in sources :

Example 1 with TabExtraMeta

use of com.qlangtech.tis.sql.parser.meta.TabExtraMeta in project tis by qlangtech.

the class ERRules method hasSetTimestampVerColumn.

public boolean hasSetTimestampVerColumn(EntityName tableName) {
    DependencyNode dumpNode = getDumpNode(tableName);
    TabExtraMeta extraMeta = dumpNode.getExtraMeta();
    return extraMeta == null && StringUtils.isNotEmpty(extraMeta.getTimeVerColName());
}
Also used : TabExtraMeta(com.qlangtech.tis.sql.parser.meta.TabExtraMeta) DependencyNode(com.qlangtech.tis.sql.parser.meta.DependencyNode)

Example 2 with TabExtraMeta

use of com.qlangtech.tis.sql.parser.meta.TabExtraMeta in project tis by qlangtech.

the class StreamComponentCodeGeneratorFlink method getERRule.

// @Override
private IERRules getERRule() {
    ERRules erRules = new ERRules() {

        public List<PrimaryTableMeta> getPrimaryTabs() {
            TabExtraMeta tabMeta = new TabExtraMeta();
            PrimaryTableMeta ptab = new PrimaryTableMeta("tabName", tabMeta);
            return Collections.singletonList(ptab);
        }
    };
    return erRules;
}
Also used : PrimaryTableMeta(com.qlangtech.tis.sql.parser.er.PrimaryTableMeta) TabExtraMeta(com.qlangtech.tis.sql.parser.meta.TabExtraMeta) IERRules(com.qlangtech.tis.sql.parser.er.IERRules) ERRules(com.qlangtech.tis.sql.parser.er.ERRules)

Example 3 with TabExtraMeta

use of com.qlangtech.tis.sql.parser.meta.TabExtraMeta in project tis by qlangtech.

the class ERRules method getTimestampVerColumn.

/**
 * 取得表的时间戳生成列
 *
 * @param tableName
 * @return
 */
@Override
public String getTimestampVerColumn(EntityName tableName) {
    if (this.isTriggerIgnore(tableName)) {
        throw new IllegalStateException("tab:" + tableName + " is not monitor in incr process");
    }
    DependencyNode dumpNode = getDumpNode(tableName);
    TabExtraMeta extraMeta = dumpNode.getExtraMeta();
    if (extraMeta == null || StringUtils.isEmpty(extraMeta.getTimeVerColName())) {
        throw new IllegalStateException("table:" + tableName + " can not find 'timeVerColName' prop");
    }
    return extraMeta.getTimeVerColName();
}
Also used : TabExtraMeta(com.qlangtech.tis.sql.parser.meta.TabExtraMeta) DependencyNode(com.qlangtech.tis.sql.parser.meta.DependencyNode)

Example 4 with TabExtraMeta

use of com.qlangtech.tis.sql.parser.meta.TabExtraMeta in project tis by qlangtech.

the class ERRules method createErRule.

public static void createErRule(String topologyName, DependencyNode node, ColumnMetaData pkMeta) throws Exception {
    /**
     *********************************************************
     * 设置TabExtraMeta
     *********************************************************
     */
    Objects.requireNonNull(pkMeta, "param pkMeta can not be null");
    node.setExtraSql(null);
    TabExtraMeta extraMeta = new TabExtraMeta();
    extraMeta.setSharedKey(pkMeta.getKey());
    extraMeta.setMonitorTrigger(true);
    List<PrimaryLinkKey> primaryIndexColumnName = Lists.newArrayList();
    PrimaryLinkKey pk = new PrimaryLinkKey();
    pk.setName(pkMeta.getKey());
    pk.setPk(true);
    primaryIndexColumnName.add(pk);
    extraMeta.setPrimaryIndexColumnNames(primaryIndexColumnName);
    extraMeta.setPrimaryIndexTab(true);
    node.setExtraMeta(extraMeta);
    ERRules erRules = new ERRules();
    erRules.addDumpNode(node);
    erRules.setTimeCharacteristic(TimeCharacteristic.ProcessTime);
    write(topologyName, erRules);
}
Also used : TabExtraMeta(com.qlangtech.tis.sql.parser.meta.TabExtraMeta) PrimaryLinkKey(com.qlangtech.tis.sql.parser.meta.PrimaryLinkKey)

Example 5 with TabExtraMeta

use of com.qlangtech.tis.sql.parser.meta.TabExtraMeta in project tis by qlangtech.

the class TestCoreAction method createMockErRules.

public ERRules createMockErRules(TableMeta totalpayMeta) {
    ERRules erRules = mock("erRules", ERRules.class);
    if (totalpayMeta != null) {
        TabExtraMeta extraMeta = new TabExtraMeta();
        extraMeta.setSharedKey(totalpayMeta.getSharedKey());
        PrimaryTableMeta tabMeta = new PrimaryTableMeta(totalpayMeta.getTabName(), extraMeta);
        EasyMock.expect(erRules.getPrimaryTabs()).andReturn(Lists.newArrayList(tabMeta)).anyTimes();
    } else {
        EasyMock.expect(erRules.getPrimaryTabs()).andReturn(Collections.emptyList()).anyTimes();
    }
    MockERRulesGetter.erRules = erRules;
    return erRules;
}
Also used : PrimaryTableMeta(com.qlangtech.tis.sql.parser.er.PrimaryTableMeta) TabExtraMeta(com.qlangtech.tis.sql.parser.meta.TabExtraMeta) ERRules(com.qlangtech.tis.sql.parser.er.ERRules)

Aggregations

TabExtraMeta (com.qlangtech.tis.sql.parser.meta.TabExtraMeta)5 ERRules (com.qlangtech.tis.sql.parser.er.ERRules)2 PrimaryTableMeta (com.qlangtech.tis.sql.parser.er.PrimaryTableMeta)2 DependencyNode (com.qlangtech.tis.sql.parser.meta.DependencyNode)2 IERRules (com.qlangtech.tis.sql.parser.er.IERRules)1 PrimaryLinkKey (com.qlangtech.tis.sql.parser.meta.PrimaryLinkKey)1