001package gudusoft.gsqlparser.nodes;
002/*
003 * Date: 13-8-9
004 */
005
006import gudusoft.gsqlparser.EAlterIndexOption;
007import gudusoft.gsqlparser.EDbObjectType;
008import gudusoft.gsqlparser.nodes.hive.THiveKeyValueProperty;
009
010public class TAlterIndexSqlNode extends TParseTreeNode {
011
012    private TObjectName indexName;
013    private TObjectName onIndexName;
014    private EAlterIndexOption alterIndexOption;
015    private TPTNodeList <THiveKeyValueProperty> indexProperties;
016    private TPartitionExtensionClause partitionSpec;
017    private TObjectName tablespaceName;
018    private TObjectName partitionName;
019    private TObjectName newIndexName;
020
021    public TObjectName getTablespaceName() {
022        return tablespaceName;
023    }
024
025    public TObjectName getPartitionName() {
026        return partitionName;
027    }
028
029    public TObjectName getNewIndexName() {
030        return newIndexName;
031    }
032
033    public TObjectName getOnIndexName() {
034        return onIndexName;
035    }
036
037    public EAlterIndexOption getAlterIndexOption() {
038        return alterIndexOption;
039    }
040
041    public TPTNodeList<THiveKeyValueProperty> getIndexProperties() {
042        return indexProperties;
043    }
044
045    public TPartitionExtensionClause getPartitionSpec() {
046        return partitionSpec;
047    }
048
049    public TObjectName getIndexName() {
050        return indexName;
051    }
052
053    public void init(Object arg1){
054        if (arg1 instanceof EAlterIndexOption){
055            alterIndexOption = (EAlterIndexOption)arg1;
056        }else if (arg1 instanceof TObjectName){
057            indexName = (TObjectName)arg1;
058        }
059    }
060
061    public void init(Object arg1,Object arg2){
062        alterIndexOption = (EAlterIndexOption)arg1;
063        indexName = (TObjectName)arg2;
064        indexName.setDbObjectTypeDirectly(EDbObjectType.index);
065    }
066
067    public void init(Object arg1,Object arg2,Object arg3){
068        init(arg1,arg2);
069        switch (alterIndexOption){
070            case setTablespace:
071                tablespaceName = (TObjectName)arg3;
072                break;
073            case attachPartition:
074                partitionName = (TObjectName)arg3;
075                break;
076            case rename:
077                onIndexName = (TObjectName)arg3;
078                break;
079            default:
080                onIndexName = (TObjectName)arg3;
081                break;
082        }
083    }
084
085    public void init(Object arg1,Object arg2,Object arg3,Object arg4){
086        init(arg1,arg2,arg3);
087        switch (alterIndexOption){
088            case setProperties:
089                indexProperties = (TPTNodeList)arg4;
090                break;
091            case rebuild:
092                partitionSpec = (TPartitionExtensionClause)arg4;
093                break;
094        }
095    }
096
097    public void init(Object arg1,Object arg2,Object arg3,Object arg4,Object arg5){
098        init(arg1,arg2,arg3,arg4);
099        partitionSpec = (TPartitionExtensionClause)arg5;
100
101    }
102
103    public void setIndexName(TObjectName indexName) {
104        this.indexName = indexName;
105    }
106
107    public void setOnIndexName(TObjectName onIndexName) {
108        this.onIndexName = onIndexName;
109    }
110
111    public void setAlterIndexOption(EAlterIndexOption alterIndexOption) {
112        this.alterIndexOption = alterIndexOption;
113    }
114
115    public void setIndexProperties(TPTNodeList<THiveKeyValueProperty> indexProperties) {
116        this.indexProperties = indexProperties;
117    }
118
119    public void setPartitionSpec(TPartitionExtensionClause partitionSpec) {
120        this.partitionSpec = partitionSpec;
121    }
122}