java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/FormatterContext.java
author František Kučera <franta-hg@frantovo.cz>
Tue, 05 Mar 2019 22:03:02 +0100
branchv_0
changeset 246 277c18b48762
parent 238 4a1864c3e867
child 250 aae5009bd0af
permissions -rw-r--r--
support custom relation names in the XML formatter (added --relation CLI option)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * SQL-DK
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 * (at your option) any later version.
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 *
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 * GNU General Public License for more details.
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 *
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
 */
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
package info.globalcode.sql.dk.formatting;
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
104
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    20
import info.globalcode.sql.dk.configuration.Properties;
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
import java.io.OutputStream;
246
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    22
import java.util.List;
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
/**
155
eb3676c6929b more JavaDoc
František Kučera <franta-hg@frantovo.cz>
parents: 104
diff changeset
    25
 * To be passed from the SQL-DK core to the formatter.
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
 *
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
 * @author Ing. František Kučera (frantovo.cz)
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
 */
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
public class FormatterContext {
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	private OutputStream outputStream;
104
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    32
	private Properties properties;
246
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    33
	private List<String> relationNames;
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
246
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    35
	public FormatterContext(OutputStream outputStream, Properties properties, List<String> relationNames) {
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
		this.outputStream = outputStream;
104
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    37
		this.properties = properties;
246
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    38
		this.relationNames = relationNames;
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	}
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	public OutputStream getOutputStream() {
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
		return outputStream;
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
	}
104
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    44
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    45
	public Properties getProperties() {
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    46
		return properties;
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    47
	}
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    48
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    49
	public void setProperties(Properties properties) {
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    50
		this.properties = properties;
245f1b88a3e6 formatter/database properties
František Kučera <franta-hg@frantovo.cz>
parents: 24
diff changeset
    51
	}
246
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    52
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    53
	public List<String> getRelationNames() {
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    54
		return relationNames;
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    55
	}
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    56
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    57
	public void setOutputStream(OutputStream outputStream) {
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    58
		this.outputStream = outputStream;
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    59
	}
277c18b48762 support custom relation names in the XML formatter (added --relation CLI option)
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
    60
24
65e3fffae091 formatter: FormatterContext
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
}