001package gudusoft.gsqlparser.dlineage.dataflow.model.xml; 002 003import java.util.ArrayList; 004import java.util.HashSet; 005import java.util.List; 006import java.util.Objects; 007import java.util.Set; 008 009import javax.xml.bind.annotation.XmlAttribute; 010import javax.xml.bind.annotation.XmlElement; 011import javax.xml.bind.annotation.XmlType; 012 013@XmlType(propOrder = {"id", "type", "function", "effectType", "partition", "clause", "joinType", "target", "caller", "sources", "callees", "processId", "processType", "procedureId", "sqlHash", "sqlComment", "condition", "timestampMin", "timestampMax", "callStmt", "callCoordinate"}) 014public class relationship implements Cloneable { 015 016 private String id; 017 018 private String type; 019 020 private String function; 021 022 private String effectType; 023 024 private String clause; 025 026 private String joinType; 027 028 private targetColumn target; 029 030 private targetColumn caller; 031 032 private List<sourceColumn> sources; 033 034 private List<sourceColumn> callees; 035 036 private String processId; 037 038 private String processType; 039 040 private String partition; 041 042 private String condition; 043 044 private String sqlHash; 045 046 private String sqlComment; 047 048 private String procedureId; 049 050 private String timestampMin; 051 052 private String timestampMax; 053 054 private Boolean builtIn; 055 056 private String callStmt; 057 058 private String callCoordinate; 059 060 @XmlAttribute(required = false) 061 public String getId() { 062 return id; 063 } 064 065 public void setId(String id) { 066 this.id = id; 067 } 068 069 @XmlAttribute(required = false) 070 public String getType() { 071 return type; 072 } 073 074 public void setType(String type) { 075 this.type = type; 076 } 077 078 @XmlElement(name = "target", required = false) 079 public targetColumn getTarget() { 080 return target; 081 } 082 083 public void setTarget(targetColumn target) { 084 this.target = target; 085 } 086 087 @XmlElement(name = "source", required = false) 088 public List<sourceColumn> getSources() { 089 if (this.sources == null) { 090 this.sources = new ArrayList<sourceColumn>(); 091 } 092 return sources; 093 } 094 095 public void setSources(List<sourceColumn> sources) { 096 this.sources = sources; 097 } 098 099 @XmlAttribute(required = false) 100 public String getClause() { 101 return clause; 102 } 103 104 public void setClause(String clause) { 105 this.clause = clause; 106 } 107 108 @XmlAttribute(required = false) 109 public String getCondition() { 110 return condition; 111 } 112 113 public void setCondition(String condition) { 114 this.condition = condition; 115 } 116 117 @XmlAttribute(required = false) 118 public String getJoinType() { 119 return joinType; 120 } 121 122 public void setJoinType(String joinType) { 123 this.joinType = joinType; 124 } 125 126 public boolean isDataFlow() { 127 return "fdd".equals(type); 128 } 129 130 @XmlAttribute(required = false) 131 public String getFunction() { 132 return function; 133 } 134 135 public void setFunction(String function) { 136 this.function = function; 137 } 138 139 @XmlAttribute(required = false) 140 public String getEffectType() { 141 return effectType; 142 } 143 144 public void setEffectType(String effectType) { 145 this.effectType = effectType; 146 } 147 148 @XmlAttribute(required = false) 149 public String getPartition() { 150 return partition; 151 } 152 153 public void setPartition(String partition) { 154 this.partition = partition; 155 } 156 157 @Override 158 public Object clone() throws CloneNotSupportedException { 159 return super.clone(); 160 } 161 162 @XmlAttribute(required = false) 163 public String getProcessId() { 164 return processId; 165 } 166 167 public void setProcessId(String processId) { 168 this.processId = processId; 169 } 170 171 @XmlAttribute(required = false) 172 public String getProcessType() { 173 return processType; 174 } 175 176 public void setProcessType(String processType) { 177 this.processType = processType; 178 } 179 180 @XmlAttribute(required = false) 181 public String getProcedureId() { 182 return procedureId; 183 } 184 185 public void setProcedureId(String procedureId) { 186 this.procedureId = procedureId; 187 } 188 189 @XmlAttribute(required = false) 190 public String getSqlHash() { 191 return sqlHash; 192 } 193 194 public void setSqlHash(String sqlHash) { 195 this.sqlHash = sqlHash; 196 } 197 198 @XmlAttribute(required = false) 199 public String getSqlComment() { 200 return sqlComment; 201 } 202 203 public void setSqlComment(String sqlComment) { 204 this.sqlComment = sqlComment; 205 } 206 207 @XmlAttribute(required = false) 208 public String getTimestampMin() { 209 return timestampMin; 210 } 211 212 public void setTimestampMin(String timestampMin) { 213 this.timestampMin = timestampMin; 214 } 215 216 @XmlAttribute(required = false) 217 public String getTimestampMax() { 218 return timestampMax; 219 } 220 221 public void setTimestampMax(String timestampMax) { 222 this.timestampMax = timestampMax; 223 } 224 225 @XmlElement(name = "caller", required = false) 226 public targetColumn getCaller() { 227 return caller; 228 } 229 230 public void setCaller(targetColumn caller) { 231 this.caller = caller; 232 } 233 234 @XmlElement(name = "callee", required = false) 235 public List<sourceColumn> getCallees() { 236 if (this.callees == null) { 237 this.callees = new ArrayList<sourceColumn>(); 238 } 239 return callees; 240 } 241 242 public void setCallees(List<sourceColumn> callees) { 243 this.callees = callees; 244 } 245 246 @Override 247 public boolean equals(Object o) { 248 if (this == o) return true; 249 if (o == null || getClass() != o.getClass()) return false; 250 relationship that = (relationship) o; 251 return id.equals(that.id); 252 } 253 254 @Override 255 public int hashCode() { 256 return Objects.hash(id); 257 } 258 259 private Set<String> sourceIds = new HashSet<String>(); 260 public void addSource(sourceColumn source) { 261 if(sourceIds.contains(source.getId())) { 262 return; 263 } 264 getSources().add(source); 265 sourceIds.add(source.getId()); 266 } 267 268 @XmlAttribute(required = false) 269 public Boolean getBuiltIn() { 270 return builtIn; 271 } 272 273 public void setBuiltIn(Boolean builtIn) { 274 this.builtIn = builtIn; 275 } 276 277 @XmlAttribute(required = false) 278 public String getCallStmt() { 279 return callStmt; 280 } 281 282 public void setCallStmt(String callStmt) { 283 this.callStmt = callStmt; 284 } 285 286 @XmlAttribute(required = false) 287 public String getCallCoordinate() { 288 return callCoordinate; 289 } 290 291 public void setCallCoordinate(String callCoordinate) { 292 this.callCoordinate = callCoordinate; 293 } 294 295}