001package gudusoft.gsqlparser.dlineage.dataflow.model.xml;
002
003import java.util.ArrayList;
004import java.util.List;
005
006import javax.xml.bind.annotation.XmlElement;
007import javax.xml.bind.annotation.XmlRootElement;
008import javax.xml.bind.annotation.XmlTransient;
009import javax.xml.bind.annotation.XmlType;
010
011import gudusoft.gsqlparser.sqlenv.IdentifierProfile;
012
013@XmlRootElement(name = "dlineage")
014@XmlType(propOrder = { "packages", "procedures", "databases", "schemas", "stages", "sequences", "datasources", "streams", "paths", "variables", "processes", "tables", "views",
015                "resultsets", "relationships", "errors", "orientation", "commentBindings" })
016public class dataflow {
017
018    private IdentifierProfile identifierPolicy;
019
020    /**
021     * The identifier configuration the analysis that produced this result ran under — same-run
022     * provenance, supplied by the producer.
023     *
024     * <p>Transient on purpose: it is a JVM object, not a wire value, and the published XML format
025     * is unchanged. So it is present on a dataflow held in memory and <strong>absent after an XML
026     * round-trip</strong>, where the policy simply cannot be recovered from the document. A merge
027     * that needs the policy must therefore be told it explicitly on that path rather than
028     * inferring one, and must never fall back to comparing display names.
029     *
030     * @return the producing analysis's profile, or null when unknown (a round-tripped document, or
031     *         a dataflow built by a caller that stated none)
032     */
033    @XmlTransient
034    public IdentifierProfile getIdentifierPolicy() {
035        return identifierPolicy;
036    }
037
038    public void setIdentifierPolicy(IdentifierProfile identifierPolicy) {
039        this.identifierPolicy = identifierPolicy;
040    }
041
042    private gudusoft.gsqlparser.dlineage.comment.CommentBindingBundle commentBindings;
043    @XmlElement(required = false)
044    public gudusoft.gsqlparser.dlineage.comment.CommentBindingBundle getCommentBindings() {
045        return commentBindings;
046    }
047    public void setCommentBindings(gudusoft.gsqlparser.dlineage.comment.CommentBindingBundle value) {
048        commentBindings = value;
049    }
050
051        private List<oraclePackage> packages;
052        
053        private List<procedure> procedures;
054        
055        private List<table> databases;
056
057        private List<table> schemas;
058
059        private List<table> datasources;
060        
061        private List<table> stages;
062
063        private List<table> sequences;
064        
065        private List<table> streams;
066
067        private List<table> paths;
068
069        private List<table> variables;
070
071        private List<process> processes;
072
073        private List<table> tables;
074
075        private List<table> views;
076
077        private List<table> resultsets;
078
079        private List<relationship> relationships;
080
081        private List<error> errors;
082
083        private String orientation;
084
085        public dataflow() {
086        }
087
088        @XmlElement(name = "package", required = false)
089        public List<oraclePackage> getPackages() {
090                if (this.packages == null) {
091                        this.packages = new ArrayList<oraclePackage>();
092                }
093                return this.packages;
094        }
095
096        public void setPackages(List<oraclePackage> packages) {
097                this.packages = packages;
098        }
099
100        @XmlElement(name = "procedure", required = false)
101        public List<procedure> getProcedures() {
102                if (this.procedures == null) {
103                        this.procedures = new ArrayList<procedure>();
104                }
105                return this.procedures;
106        }
107
108        @XmlElement(name = "database", required = false)
109        public List<table> getDatabases() {
110                if (this.databases == null) {
111                        this.databases = new ArrayList<table>();
112                }
113                return this.databases;
114        }
115        
116        @XmlElement(name = "schema", required = false)
117        public List<table> getSchemas() {
118                if (this.schemas == null) {
119                        this.schemas = new ArrayList<table>();
120                }
121                return this.schemas;
122        }
123        
124        @XmlElement(name = "stage", required = false)
125        public List<table> getStages() {
126                if (this.stages == null) {
127                        this.stages = new ArrayList<table>();
128                }
129                return this.stages;
130        }
131
132        @XmlElement(name = "sequence", required = false)
133        public List<table> getSequences() {
134                if (this.sequences == null) {
135                        this.sequences = new ArrayList<table>();
136                }
137                return this.sequences;
138        }
139        
140        @XmlElement(name = "datasource", required = false)
141        public List<table> getDatasources() {
142                if (this.datasources == null) {
143                        this.datasources = new ArrayList<table>();
144                }
145                return this.datasources;
146        }
147
148        @XmlElement(name = "stream", required = false)
149        public List<table> getStreams() {
150                if (this.streams == null) {
151                        this.streams = new ArrayList<table>();
152                }
153                return this.streams;
154        }
155
156        @XmlElement(name = "path", required = false)
157        public List<table> getPaths() {
158                if (this.paths == null) {
159                        this.paths = new ArrayList<table>();
160                }
161                return this.paths;
162        }
163
164        public void setPaths(List<table> paths) {
165                this.paths = paths;
166        }
167
168        @XmlElement(name = "variable", required = false)
169        public List<table> getVariables() {
170                if (this.variables == null) {
171                        this.variables = new ArrayList<table>();
172                }
173                return this.variables;
174        }
175
176        @XmlElement(name = "process", required = false)
177        public List<process> getProcesses() {
178                if (this.processes == null) {
179                        this.processes = new ArrayList<process>();
180                }
181                return this.processes;
182        }
183
184        @XmlElement(name = "table", required = false)
185        public List<table> getTables() {
186                if (this.tables == null) {
187                        this.tables = new ArrayList<table>();
188                }
189                return this.tables;
190        }
191
192        @XmlElement(name = "view", required = false)
193        public List<table> getViews() {
194                if (this.views == null) {
195                        this.views = new ArrayList<table>();
196                }
197                return this.views;
198        }
199
200        @XmlElement(name = "resultset", required = false)
201        public List<table> getResultsets() {
202                if (this.resultsets == null) {
203                        this.resultsets = new ArrayList<table>();
204                }
205                return this.resultsets;
206        }
207
208        @XmlElement(name = "relationship", required = false)
209        public List<relationship> getRelationships() {
210                if (this.relationships == null) {
211                        this.relationships = new ArrayList<relationship>();
212                }
213                return this.relationships;
214        }
215
216        @XmlElement(name = "error", required = false)
217        public List<error> getErrors() {
218                if (this.errors == null) {
219                        this.errors = new ArrayList<error>();
220                }
221                return errors;
222        }
223
224        public void setErrors(List<error> errors) {
225                this.errors = errors;
226        }
227
228        public void setRelationships(List<relationship> relationships) {
229                this.relationships = relationships;
230        }
231
232        public void setProcesses(List<process> processes) {
233                this.processes = processes;
234        }
235
236        public void setTables(List<table> tables) {
237                this.tables = tables;
238        }
239
240        public void setViews(List<table> views) {
241                this.views = views;
242        }
243
244        public void setStages(List<table> stages) {
245                this.stages = stages;
246        }
247
248        public void setSequences(List<table> sequences) {
249                this.sequences = sequences;
250        }
251
252        public void setDatasources(List<table> datasources) {
253                this.datasources = datasources;
254        }
255        
256        public void setSchemas(List<table> schemas) {
257                this.schemas = schemas;
258        }
259        
260        public void setDatabases(List<table> databases) {
261                this.databases = databases;
262        }
263
264        public void setVariables(List<table> variables) {
265                this.variables = variables;
266        }
267
268        public void setResultsets(List<table> resultsets) {
269                this.resultsets = resultsets;
270        }
271
272        public void setProcedures(List<procedure> procedures) {
273                this.procedures = procedures;
274        }
275        
276        public void setStreams(List<table> streams) {
277                this.streams = streams;
278        }
279
280        @XmlElement(name = "orientation", required = false)
281        public String getOrientation() {
282                return orientation;
283        }
284
285        public void setOrientation(String orientation) {
286                this.orientation = orientation;
287        }
288
289        public static List<table> getAllTables(dataflow dataflow) {
290                List<table> allTables = new ArrayList<>();
291                if (dataflow != null) {
292                        if (dataflow.getDatabases() != null) allTables.addAll(dataflow.getDatabases());
293                        if (dataflow.getSchemas() != null) allTables.addAll(dataflow.getSchemas());
294                        if (dataflow.getDatasources() != null) allTables.addAll(dataflow.getDatasources());
295                        if (dataflow.getStages() != null) allTables.addAll(dataflow.getStages());
296                        if (dataflow.getSequences() != null) allTables.addAll(dataflow.getSequences());
297                        if (dataflow.getStreams() != null) allTables.addAll(dataflow.getStreams());
298                        if (dataflow.getPaths() != null) allTables.addAll(dataflow.getPaths());
299                        if (dataflow.getVariables() != null) allTables.addAll(dataflow.getVariables());
300                        if (dataflow.getTables() != null) allTables.addAll(dataflow.getTables());
301                        if (dataflow.getViews() != null) allTables.addAll(dataflow.getViews());
302                        if (dataflow.getResultsets() != null) allTables.addAll(dataflow.getResultsets());
303                }
304                return allTables;
305        }
306}