[#7747] Rename jooq-codegen.xsd Schema, Schemata, Catalog, Catalogs types to have a Type suffix

This commit is contained in:
Lukas Eder 2018-08-10 12:23:04 +02:00
parent 69ae58974d
commit 7373ad1092
12 changed files with 91 additions and 136 deletions

View File

@ -76,14 +76,14 @@ import org.jooq.meta.Database;
import org.jooq.meta.Databases;
import org.jooq.meta.Definition;
import org.jooq.meta.SchemaVersionProvider;
import org.jooq.meta.jaxb.Catalog;
import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.Configuration;
import org.jooq.meta.jaxb.Generate;
import org.jooq.meta.jaxb.Jdbc;
import org.jooq.meta.jaxb.Logging;
import org.jooq.meta.jaxb.Matchers;
import org.jooq.meta.jaxb.Property;
import org.jooq.meta.jaxb.Schema;
import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.meta.jaxb.Strategy;
import org.jooq.meta.jaxb.Target;
// ...
@ -368,15 +368,15 @@ public class GenerationTool {
database = databaseClass.newInstance();
database.setProperties(properties(d.getProperties()));
List<Catalog> catalogs = d.getCatalogs();
List<Schema> schemata = d.getSchemata();
List<CatalogMappingType> catalogs = d.getCatalogs();
List<SchemaMappingType> schemata = d.getSchemata();
boolean catalogsEmpty = catalogs.isEmpty();
boolean schemataEmpty = schemata.isEmpty();
// For convenience, the catalog configuration can be set also directly in the <database/> element
if (catalogsEmpty) {
Catalog catalog = new Catalog();
CatalogMappingType catalog = new CatalogMappingType();
catalog.setInputCatalog(trim(d.getInputCatalog()));
catalog.setOutputCatalog(trim(d.getOutputCatalog()));
catalog.setOutputCatalogToDefault(d.isOutputCatalogToDefault());
@ -388,7 +388,7 @@ public class GenerationTool {
// For convenience and backwards-compatibility, the schema configuration can be set also directly
// in the <database/> element
if (schemataEmpty) {
Schema schema = new Schema();
SchemaMappingType schema = new SchemaMappingType();
schema.setInputSchema(trim(d.getInputSchema()));
schema.setOutputSchema(trim(d.getOutputSchema()));
schema.setOutputSchemaToDefault(d.isOutputSchemaToDefault());
@ -419,7 +419,7 @@ public class GenerationTool {
log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/catalogs and /configuration/generator/database/schemata");
}
for (Catalog catalog : catalogs) {
for (CatalogMappingType catalog : catalogs) {
if ("".equals(catalog.getOutputCatalog()))
log.warn("WARNING: Empty <outputCatalog/> should not be used to model default outputCatalogs. Use <outputCatalogToDefault>true</outputCatalogToDefault>, instead. See also: https://github.com/jOOQ/jOOQ/issues/3018");
@ -434,7 +434,7 @@ public class GenerationTool {
for (Schema schema : catalog.getSchemata()) {
for (SchemaMappingType schema : catalog.getSchemata()) {
if (catalogsEmpty && schemataEmpty && StringUtils.isBlank(schema.getInputSchema())) {
if (!StringUtils.isBlank(j.getSchema()))
log.warn("WARNING: The configuration property jdbc.Schema is deprecated and will be removed in the future. Use /configuration/generator/database/inputSchema instead");

View File

@ -137,27 +137,27 @@
</bindings>
<bindings if-exists="true" scd="~tns:Catalogs">
<bindings if-exists="true" scd="~tns:CatalogMappingsType">
<class ref="org.jooq.meta.jaxb.Catalogs"/>
<class ref="org.jooq.meta.jaxb.CatalogMappingsType"/>
</bindings>
<bindings if-exists="true" scd="~tns:Catalog">
<bindings if-exists="true" scd="~tns:CatalogMappingType">
<class ref="org.jooq.meta.jaxb.Catalog"/>
<class ref="org.jooq.meta.jaxb.CatalogMappingType"/>
</bindings>
<bindings if-exists="true" scd="~tns:Schemata">
<bindings if-exists="true" scd="~tns:SchemaMappingsType">
<class ref="org.jooq.meta.jaxb.Schemata"/>
<class ref="org.jooq.meta.jaxb.SchemaMappingsType"/>
</bindings>
<bindings if-exists="true" scd="~tns:Schema">
<bindings if-exists="true" scd="~tns:SchemaMappingType">
<class ref="org.jooq.meta.jaxb.Schema"/>
<class ref="org.jooq.meta.jaxb.SchemaMappingType"/>
</bindings>

View File

@ -73,13 +73,13 @@ import org.jooq.impl.DSL;
import org.jooq.impl.DefaultExecuteListener;
import org.jooq.impl.DefaultExecuteListenerProvider;
import org.jooq.impl.SQLDataType;
import org.jooq.meta.jaxb.Catalog;
import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.CustomType;
import org.jooq.meta.jaxb.EnumType;
import org.jooq.meta.jaxb.ForcedType;
import org.jooq.meta.jaxb.Nullability;
import org.jooq.meta.jaxb.RegexFlag;
import org.jooq.meta.jaxb.Schema;
import org.jooq.meta.jaxb.SchemaMappingType;
// ...
import org.jooq.tools.JooqLogger;
import org.jooq.tools.StopWatch;
@ -129,8 +129,8 @@ public abstract class AbstractDatabase implements Database {
private boolean supportsUnsignedTypes;
private boolean ignoreProcedureReturnValues;
private boolean dateAsTimestamp;
private List<Catalog> configuredCatalogs = new ArrayList<Catalog>();
private List<Schema> configuredSchemata = new ArrayList<Schema>();
private List<CatalogMappingType> configuredCatalogs = new ArrayList<CatalogMappingType>();
private List<SchemaMappingType> configuredSchemata = new ArrayList<SchemaMappingType>();
private List<CustomType> configuredCustomTypes;
private List<EnumType> configuredEnumTypes;
private List<ForcedType> configuredForcedTypes;
@ -504,7 +504,7 @@ public abstract class AbstractDatabase implements Database {
}
}
else {
for (Catalog catalog : configuredCatalogs) {
for (CatalogMappingType catalog : configuredCatalogs) {
@ -535,7 +535,7 @@ public abstract class AbstractDatabase implements Database {
else if (configuredCatalogs.isEmpty()) {
inputSchemataPerCatalog.put("", inputSchemata);
for (Schema schema : configuredSchemata) {
for (SchemaMappingType schema : configuredSchemata) {
@ -550,8 +550,8 @@ public abstract class AbstractDatabase implements Database {
}
}
else {
for (Catalog catalog : configuredCatalogs) {
for (Schema schema : catalog.getSchemata()) {
for (CatalogMappingType catalog : configuredCatalogs) {
for (SchemaMappingType schema : catalog.getSchemata()) {
String inputSchema;
@ -628,7 +628,7 @@ public abstract class AbstractDatabase implements Database {
@Override
@Deprecated
public String getOutputCatalog(String inputCatalog) {
for (Catalog catalog : configuredCatalogs)
for (CatalogMappingType catalog : configuredCatalogs)
if (inputCatalog.equals(catalog.getInputCatalog()))
return catalog.getOutputCatalog();
@ -638,7 +638,7 @@ public abstract class AbstractDatabase implements Database {
@Override
@Deprecated
public String getOutputSchema(String inputSchema) {
for (Schema schema : configuredSchemata)
for (SchemaMappingType schema : configuredSchemata)
if (inputSchema.equals(schema.getInputSchema()))
return schema.getOutputSchema();
@ -647,9 +647,9 @@ public abstract class AbstractDatabase implements Database {
@Override
public String getOutputSchema(String inputCatalog, String inputSchema) {
for (Catalog catalog : configuredCatalogs)
for (CatalogMappingType catalog : configuredCatalogs)
if (inputCatalog.equals(catalog.getInputCatalog()))
for (Schema schema : catalog.getSchemata())
for (SchemaMappingType schema : catalog.getSchemata())
if (inputSchema.equals(schema.getInputSchema()))
return schema.getOutputSchema();
@ -657,12 +657,12 @@ public abstract class AbstractDatabase implements Database {
}
@Override
public final void setConfiguredCatalogs(List<Catalog> catalogs) {
public final void setConfiguredCatalogs(List<CatalogMappingType> catalogs) {
this.configuredCatalogs = catalogs;
}
@Override
public final void setConfiguredSchemata(List<Schema> schemata) {
public final void setConfiguredSchemata(List<SchemaMappingType> schemata) {
this.configuredSchemata = schemata;
}

View File

@ -47,12 +47,12 @@ import org.jooq.DSLContext;
import org.jooq.Name;
import org.jooq.SQLDialect;
import org.jooq.Table;
import org.jooq.meta.jaxb.Catalog;
import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.CustomType;
import org.jooq.meta.jaxb.EnumType;
import org.jooq.meta.jaxb.ForcedType;
import org.jooq.meta.jaxb.RegexFlag;
import org.jooq.meta.jaxb.Schema;
import org.jooq.meta.jaxb.SchemaMappingType;
/**
* A general database model.
@ -338,12 +338,12 @@ public interface Database extends AutoCloseable {
/**
* The input and output catalogs.
*/
void setConfiguredCatalogs(List<Catalog> catalogs);
void setConfiguredCatalogs(List<CatalogMappingType> catalogs);
/**
* The input and output schemata.
*/
void setConfiguredSchemata(List<Schema> schemata);
void setConfiguredSchemata(List<SchemaMappingType> schemata);
/**
* Database objects matching any of these regular expressions will not be

View File

@ -82,7 +82,7 @@ import org.jooq.meta.firebird.rdb.tables.Rdb$fields;
import org.jooq.meta.firebird.rdb.tables.Rdb$indexSegments;
import org.jooq.meta.firebird.rdb.tables.Rdb$refConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationConstraints;
import org.jooq.meta.jaxb.Schema;
import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.util.firebird.FirebirdDataType;
/**
@ -93,11 +93,11 @@ public class FirebirdDatabase extends AbstractDatabase {
public FirebirdDatabase() {
// Firebird doesn't know schemata
Schema schema = new Schema();
SchemaMappingType schema = new SchemaMappingType();
schema.setInputSchema("");
schema.setOutputSchema("");
List<Schema> schemata = new ArrayList<Schema>();
List<SchemaMappingType> schemata = new ArrayList<SchemaMappingType>();
schemata.add(schema);
setConfiguredSchemata(schemata);

View File

@ -28,13 +28,13 @@ import org.jooq.util.jaxb.tools.StringAdapter;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Catalog", propOrder = {
@XmlType(name = "CatalogMappingType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class Catalog implements Serializable
public class CatalogMappingType implements Serializable
{
private final static long serialVersionUID = 31200L;
@ -47,7 +47,7 @@ public class Catalog implements Serializable
protected Boolean outputCatalogToDefault = false;
@XmlElementWrapper(name = "schemata")
@XmlElement(name = "schema")
protected List<Schema> schemata;
protected List<SchemaMappingType> schemata;
/**
* See also {@link Database#getInputCatalog()}
@ -121,49 +121,49 @@ public class Catalog implements Serializable
this.outputCatalogToDefault = value;
}
public List<Schema> getSchemata() {
public List<SchemaMappingType> getSchemata() {
if (schemata == null) {
schemata = new ArrayList<Schema>();
schemata = new ArrayList<SchemaMappingType>();
}
return schemata;
}
public void setSchemata(List<Schema> schemata) {
public void setSchemata(List<SchemaMappingType> schemata) {
this.schemata = schemata;
}
public Catalog withInputCatalog(String value) {
public CatalogMappingType withInputCatalog(String value) {
setInputCatalog(value);
return this;
}
public Catalog withOutputCatalog(String value) {
public CatalogMappingType withOutputCatalog(String value) {
setOutputCatalog(value);
return this;
}
public Catalog withOutputCatalogToDefault(Boolean value) {
public CatalogMappingType withOutputCatalogToDefault(Boolean value) {
setOutputCatalogToDefault(value);
return this;
}
public Catalog withSchemata(Schema... values) {
public CatalogMappingType withSchemata(SchemaMappingType... values) {
if (values!= null) {
for (Schema value: values) {
for (SchemaMappingType value: values) {
getSchemata().add(value);
}
}
return this;
}
public Catalog withSchemata(Collection<Schema> values) {
public CatalogMappingType withSchemata(Collection<SchemaMappingType> values) {
if (values!= null) {
getSchemata().addAll(values);
}
return this;
}
public Catalog withSchemata(List<Schema> schemata) {
public CatalogMappingType withSchemata(List<SchemaMappingType> schemata) {
setSchemata(schemata);
return this;
}
@ -209,7 +209,7 @@ public class Catalog implements Serializable
if (getClass()!= that.getClass()) {
return false;
}
Catalog other = ((Catalog) that);
CatalogMappingType other = ((CatalogMappingType) that);
if (inputCatalog == null) {
if (other.inputCatalog!= null) {
return false;

View File

@ -132,10 +132,10 @@ public class Database implements Serializable
protected List<Property> properties;
@XmlElementWrapper(name = "catalogs")
@XmlElement(name = "catalog")
protected List<Catalog> catalogs;
protected List<CatalogMappingType> catalogs;
@XmlElementWrapper(name = "schemata")
@XmlElement(name = "schema")
protected List<Schema> schemata;
protected List<SchemaMappingType> schemata;
@XmlElementWrapper(name = "customTypes")
@XmlElement(name = "customType")
protected List<CustomType> customTypes;
@ -1225,25 +1225,25 @@ public class Database implements Serializable
this.properties = properties;
}
public List<Catalog> getCatalogs() {
public List<CatalogMappingType> getCatalogs() {
if (catalogs == null) {
catalogs = new ArrayList<Catalog>();
catalogs = new ArrayList<CatalogMappingType>();
}
return catalogs;
}
public void setCatalogs(List<Catalog> catalogs) {
public void setCatalogs(List<CatalogMappingType> catalogs) {
this.catalogs = catalogs;
}
public List<Schema> getSchemata() {
public List<SchemaMappingType> getSchemata() {
if (schemata == null) {
schemata = new ArrayList<Schema>();
schemata = new ArrayList<SchemaMappingType>();
}
return schemata;
}
public void setSchemata(List<Schema> schemata) {
public void setSchemata(List<SchemaMappingType> schemata) {
this.schemata = schemata;
}
@ -1502,44 +1502,44 @@ public class Database implements Serializable
return this;
}
public Database withCatalogs(Catalog... values) {
public Database withCatalogs(CatalogMappingType... values) {
if (values!= null) {
for (Catalog value: values) {
for (CatalogMappingType value: values) {
getCatalogs().add(value);
}
}
return this;
}
public Database withCatalogs(Collection<Catalog> values) {
public Database withCatalogs(Collection<CatalogMappingType> values) {
if (values!= null) {
getCatalogs().addAll(values);
}
return this;
}
public Database withCatalogs(List<Catalog> catalogs) {
public Database withCatalogs(List<CatalogMappingType> catalogs) {
setCatalogs(catalogs);
return this;
}
public Database withSchemata(Schema... values) {
public Database withSchemata(SchemaMappingType... values) {
if (values!= null) {
for (Schema value: values) {
for (SchemaMappingType value: values) {
getSchemata().add(value);
}
}
return this;
}
public Database withSchemata(Collection<Schema> values) {
public Database withSchemata(Collection<SchemaMappingType> values) {
if (values!= null) {
getSchemata().addAll(values);
}
return this;
}
public Database withSchemata(List<Schema> schemata) {
public Database withSchemata(List<SchemaMappingType> schemata) {
setSchemata(schemata);
return this;
}

View File

@ -149,19 +149,19 @@ public class ObjectFactory {
}
/**
* Create an instance of {@link Catalog }
* Create an instance of {@link CatalogMappingType }
*
*/
public Catalog createCatalog() {
return new Catalog();
public CatalogMappingType createCatalogMappingType() {
return new CatalogMappingType();
}
/**
* Create an instance of {@link Schema }
* Create an instance of {@link SchemaMappingType }
*
*/
public Schema createSchema() {
return new Schema();
public SchemaMappingType createSchemaMappingType() {
return new SchemaMappingType();
}
/**

View File

@ -24,13 +24,13 @@ import org.jooq.util.jaxb.tools.StringAdapter;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Schema", propOrder = {
@XmlType(name = "SchemaMappingType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class Schema implements Serializable
public class SchemaMappingType implements Serializable
{
private final static long serialVersionUID = 31200L;
@ -114,17 +114,17 @@ public class Schema implements Serializable
this.outputSchemaToDefault = value;
}
public Schema withInputSchema(String value) {
public SchemaMappingType withInputSchema(String value) {
setInputSchema(value);
return this;
}
public Schema withOutputSchema(String value) {
public SchemaMappingType withOutputSchema(String value) {
setOutputSchema(value);
return this;
}
public Schema withOutputSchemaToDefault(Boolean value) {
public SchemaMappingType withOutputSchemaToDefault(Boolean value) {
setOutputSchemaToDefault(value);
return this;
}
@ -161,7 +161,7 @@ public class Schema implements Serializable
if (getClass()!= that.getClass()) {
return false;
}
Schema other = ((Schema) that);
SchemaMappingType other = ((SchemaMappingType) that);
if (inputSchema == null) {
if (other.inputSchema!= null) {
return false;

View File

@ -74,7 +74,7 @@ import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.jaxb.Schema;
import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.meta.sqlite.sqlite_master.SQLiteMaster;
/**
@ -87,11 +87,11 @@ public class SQLiteDatabase extends AbstractDatabase {
public SQLiteDatabase() {
// SQLite doesn't know schemata
Schema schema = new Schema();
SchemaMappingType schema = new SchemaMappingType();
schema.setInputSchema("");
schema.setOutputSchema("");
List<Schema> schemata = new ArrayList<Schema>();
List<SchemaMappingType> schemata = new ArrayList<SchemaMappingType>();
schemata.add(schema);
setConfiguredSchemata(schemata);

View File

@ -631,14 +631,14 @@ This will be ignored if {@link #isOutputSchemaToDefault()} is set to true]]></jx
which generates schema-less, unqualified tables, procedures, etc.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="catalogs" type="tns:Catalogs" minOccurs="0" maxOccurs="1">
<element name="catalogs" type="tns:CatalogMappingsType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A configuration element to configure several input and/or output
catalogs for jooq-meta, in case you're using jooq-meta in a multi-catalog environment.
<p>
This configuration element cannot be used at the same time as the {@link #getSchemata()} configuration element.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="schemata" type="tns:Schemata" minOccurs="0" maxOccurs="1">
<element name="schemata" type="tns:SchemaMappingsType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A configuration element to configure several input and/or output
schemata for jooq-meta, in case you're using jooq-meta in a multi-schema environment.
<p>
@ -721,13 +721,13 @@ for Oracle.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</all>
</complexType>
<complexType name="Catalogs">
<complexType name="CatalogMappingsType">
<sequence>
<element name="catalog" type="tns:Catalog" minOccurs="1" maxOccurs="unbounded"/>
<element name="catalog" type="tns:CatalogMappingType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="Catalog">
<complexType name="CatalogMappingType">
<annotation><appinfo><jxb:class><jxb:javadoc><![CDATA[Configuration of an input catalog and its mappings.]]></jxb:javadoc></jxb:class></appinfo></annotation>
<all>
<element name="inputCatalog" type="string" default="" minOccurs="1" maxOccurs="1">
@ -742,19 +742,19 @@ for Oracle.]]></jxb:javadoc></jxb:property></appinfo></annotation>
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[See also {@link Database#isOutputCatalogToDefault()}]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="schemata" type="tns:Schemata" minOccurs="0" maxOccurs="1">
<element name="schemata" type="tns:SchemaMappingsType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The configuration of schemas inside of this catalog, if any.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="Schemata">
<complexType name="SchemaMappingsType">
<sequence>
<element name="schema" type="tns:Schema" minOccurs="1" maxOccurs="unbounded"/>
<element name="schema" type="tns:SchemaMappingType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="Schema">
<complexType name="SchemaMappingType">
<annotation><appinfo><jxb:class><jxb:javadoc><![CDATA[Configuration of an input schema and its mappings.]]></jxb:javadoc></jxb:class></appinfo></annotation>
<all>
<element name="inputSchema" type="string" default="" minOccurs="1" maxOccurs="1">

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:jooq-querypart="http://www.jooq.org/xsd/jooq-querypart-1.6.2.xsd"
targetNamespace="http://www.jooq.org/xsd/jooq-querypart-1.6.2.xsd">
<element name="select" type="jooq-querypart:SelectType"/>
<complexType name="SelectType">
<sequence>
<element name="select" type="jooq-querypart:FieldType" minOccurs="0" maxOccurs="1"/>
<element name="where" type="jooq-querypart:ConditionType" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<complexType name="FieldType">
<choice>
<!-- Framework fields -->
<element name="val" type="string"/>
<element name="literal" type="string"/>
<element name="sql" type="jooq-querypart:SQLType"/>
<!-- Functions -->
<element name="ascii" type="jooq-querypart:FieldType"/>
<element name="bit_count" type="jooq-querypart:FieldType"/>
<element name="ceil" type="jooq-querypart:FieldType"/>
<element name="concat" type="jooq-querypart:FieldType"/>
</choice>
</complexType>
<complexType name="ConditionType">
<choice>
<!-- Combined conditions -->
<element name="and" type="jooq-querypart:ConditionType"/>
</choice>
</complexType>
<complexType name="SQLType">
<sequence>
<element name="val" type="string"/>
</sequence>
<attribute name="sql" type="string"/>
</complexType>
</schema>