001package gudusoft.gsqlparser.nodes.snowflake; 002 003import gudusoft.gsqlparser.nodes.TCreateTableOption; 004import gudusoft.gsqlparser.nodes.TObjectName; 005import gudusoft.gsqlparser.nodes.TParseTreeNode; 006 007/** 008 * Parse tree node for CREATE SEMANTIC VIEW statement. 009 */ 010public class TCreateSemanticViewSqlNode extends TParseTreeNode { 011 012 private TObjectName viewName; 013 private TSemanticViewClauseList semanticClauses; 014 private TCreateTableOption commentClause; 015 016 public TObjectName getViewName() { 017 return viewName; 018 } 019 020 public void setViewName(TObjectName viewName) { 021 this.viewName = viewName; 022 } 023 024 public TSemanticViewClauseList getSemanticClauses() { 025 return semanticClauses; 026 } 027 028 public void setSemanticClauses(TSemanticViewClauseList semanticClauses) { 029 this.semanticClauses = semanticClauses; 030 } 031 032 public TCreateTableOption getCommentClause() { 033 return commentClause; 034 } 035 036 public void setCommentClause(TCreateTableOption commentClause) { 037 this.commentClause = commentClause; 038 } 039 040 public void init(Object arg1) { 041 viewName = (TObjectName) arg1; 042 } 043 044 public void init(Object arg1, Object arg2) { 045 init(arg1); 046 if (arg2 instanceof TSemanticViewClauseList) { 047 semanticClauses = (TSemanticViewClauseList) arg2; 048 } 049 } 050 051 public void init(Object arg1, Object arg2, Object arg3) { 052 init(arg1, arg2); 053 if (arg3 instanceof TCreateTableOption) { 054 commentClause = (TCreateTableOption) arg3; 055 } 056 } 057 058 /** 059 * Get the TABLES clause if present. 060 */ 061 public TSemanticViewClause getTablesClause() { 062 return getClauseByType(ESemanticViewClauseType.TABLES); 063 } 064 065 /** 066 * Get the RELATIONSHIPS clause if present. 067 */ 068 public TSemanticViewClause getRelationshipsClause() { 069 return getClauseByType(ESemanticViewClauseType.RELATIONSHIPS); 070 } 071 072 /** 073 * Get the FACTS clause if present. 074 */ 075 public TSemanticViewClause getFactsClause() { 076 return getClauseByType(ESemanticViewClauseType.FACTS); 077 } 078 079 /** 080 * Get the DIMENSIONS clause if present. 081 */ 082 public TSemanticViewClause getDimensionsClause() { 083 return getClauseByType(ESemanticViewClauseType.DIMENSIONS); 084 } 085 086 /** 087 * Get the METRICS clause if present. 088 */ 089 public TSemanticViewClause getMetricsClause() { 090 return getClauseByType(ESemanticViewClauseType.METRICS); 091 } 092 093 private TSemanticViewClause getClauseByType(ESemanticViewClauseType type) { 094 if (semanticClauses == null) return null; 095 for (TSemanticViewClause clause : semanticClauses) { 096 if (clause.getClauseType() == type) { 097 return clause; 098 } 099 } 100 return null; 101 } 102}