[jOOQ/jOOQ#10588] Deprecate <overridePrimaryKeys/>

This commit is contained in:
Lukas Eder 2020-09-04 09:31:19 +02:00
parent 69fe7b2728
commit d5365531c9
12 changed files with 1720 additions and 65 deletions

View File

@ -73,8 +73,6 @@ import org.jooq.meta.Definition;
import org.jooq.meta.SchemaVersionProvider;
import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.Configuration;
import org.jooq.meta.jaxb.EmbeddableDefinitionType;
import org.jooq.meta.jaxb.ForcedType;
import org.jooq.meta.jaxb.Generate;
import org.jooq.meta.jaxb.Jdbc;
import org.jooq.meta.jaxb.Logging;
@ -563,6 +561,7 @@ public class GenerationTool {
database.setConfiguredEnumTypes(d.getEnumTypes());
database.setConfiguredForcedTypes(d.getForcedTypes());
database.setConfiguredEmbeddables(d.getEmbeddables());
database.setConfiguredSyntheticKeys(d.getSyntheticKeys());
database.setEmbeddablePrimaryKeys(TRUE.equals(d.isEmbeddablePrimaryKeys()));
database.setEmbeddableUniqueKeys(TRUE.equals(d.isEmbeddableUniqueKeys()));
database.setEmbeddableDomains(TRUE.equals(d.isEmbeddableDomains()));
@ -872,35 +871,12 @@ public class GenerationTool {
generator.generate(database);
if (!database.getUnusedForcedTypes().isEmpty()) {
log.warn(
"Unused ForcedTypes",
"There are unused forced types, which have not been used by this generation run.\n"
+ "This can be because of misconfigurations, such as, for example:\n"
+ "- case sensitive regular expressions\n"
+ "- regular expressions depending on whitespace (Pattern.COMMENTS is turned on!)\n"
+ "- missing or inadequate object qualification\n"
+ "- the forced type is obsolete\n"
);
for (ForcedType f : database.getUnusedForcedTypes())
log.warn("Unused ForcedType", f);
}
if (!database.getUnusedEmbeddables().isEmpty()) {
log.warn(
"Unused Embeddables",
"There are unused embeddables, which have not been used by this generation run.\n"
+ "This can be because of misconfigurations, such as, for example:\n"
+ "- case sensitive regular expressions\n"
+ "- regular expressions depending on whitespace (Pattern.COMMENTS is turned on!)\n"
+ "- missing or inadequate object qualification\n"
+ "- the embeddable is obsolete\n"
);
for (EmbeddableDefinitionType e : database.getUnusedEmbeddables())
log.warn("Unused Embeddable", e);
}
logUnused("forced type", "forced types", database.getUnusedForcedTypes());
logUnused("embeddable", "embeddables", database.getUnusedEmbeddables());
logUnused("synthetic identity", "synthetic identities", database.getUnusedSyntheticIdentities());
logUnused("synthetic primary key", "synthetic primary keys", database.getUnusedSyntheticPrimaryKeys());
logUnused("synthetic unique key", "synthetic unique keys", database.getUnusedSyntheticUniqueKeys());
logUnused("synthetic foreign key", "synthetic foreign keys", database.getUnusedSyntheticForeignKeys());
}
finally {
if (database != null)
@ -926,6 +902,23 @@ public class GenerationTool {
}
}
private void logUnused(String objectType, String objectTypes, List<?> list) {
if (!list.isEmpty()) {
log.warn(
"Unused " + objectTypes,
"There are unused " + objectTypes + ", which have not been used by this generation run.\n"
+ "This can be because of misconfigurations, such as, for example:\n"
+ "- case sensitive regular expressions\n"
+ "- regular expressions depending on whitespace (Pattern.COMMENTS is turned on!)\n"
+ "- missing or inadequate object qualification\n"
+ "- the " + objectType + " are obsolete\n"
);
for (Object o : list)
log.warn("Unused " + objectType, o);
}
}
private static void setGlobalLoggingThreshold(Configuration configuration) {
if (configuration.getLogging() != null) {
switch (configuration.getLogging()) {

View File

@ -77,6 +77,7 @@ import org.jooq.ExecuteContext;
import org.jooq.ExecuteListenerProvider;
import org.jooq.Log;
import org.jooq.Name;
// ...
import org.jooq.Query;
import org.jooq.Record;
import org.jooq.SQLDialect;
@ -102,6 +103,11 @@ import org.jooq.meta.jaxb.Nullability;
import org.jooq.meta.jaxb.OnError;
import org.jooq.meta.jaxb.RegexFlag;
import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.meta.jaxb.SyntheticForeignKeyType;
import org.jooq.meta.jaxb.SyntheticIdentityType;
import org.jooq.meta.jaxb.SyntheticKeysType;
import org.jooq.meta.jaxb.SyntheticPrimaryKeyType;
import org.jooq.meta.jaxb.SyntheticUniqueKeyType;
// ...
import org.jooq.tools.JooqLogger;
import org.jooq.tools.StopWatch;
@ -157,7 +163,6 @@ public abstract class AbstractDatabase implements Database {
private String[] recordVersionFields;
private String[] recordTimestampFields;
private String[] syntheticPrimaryKeys;
private String[] overridePrimaryKeys;
private String[] syntheticIdentities;
private boolean embeddablePrimaryKeys = false;
private boolean embeddableUniqueKeys = false;
@ -175,6 +180,14 @@ public abstract class AbstractDatabase implements Database {
private Set<ForcedType> unusedForcedTypes = new HashSet<>();
private List<EmbeddableDefinitionType> configuredEmbeddables = new ArrayList<>();
private Set<EmbeddableDefinitionType> unusedEmbeddables = new HashSet<>();
private List<SyntheticIdentityType> configuredSyntheticIdentities = new ArrayList<>();
private Set<SyntheticIdentityType> unusedSyntheticIdentities = new HashSet<>();
private List<SyntheticPrimaryKeyType> configuredSyntheticPrimaryKeys = new ArrayList<>();
private Set<SyntheticPrimaryKeyType> unusedSyntheticPrimaryKeys = new HashSet<>();
private List<SyntheticUniqueKeyType> configuredSyntheticUniqueKeys = new ArrayList<>();
private Set<SyntheticUniqueKeyType> unusedSyntheticUniqueKeys = new HashSet<>();
private List<SyntheticForeignKeyType> configuredSyntheticForeignKeys = new ArrayList<>();
private Set<SyntheticForeignKeyType> unusedSyntheticForeignKeys = new HashSet<>();
private SchemaVersionProvider schemaVersionProvider;
private CatalogVersionProvider catalogVersionProvider;
private Comparator<Definition> orderProvider;
@ -1189,25 +1202,27 @@ public abstract class AbstractDatabase implements Database {
@Override
public String[] getSyntheticPrimaryKeys() {
if (syntheticPrimaryKeys == null) {
if (syntheticPrimaryKeys == null)
syntheticPrimaryKeys = new String[0];
}
return syntheticPrimaryKeys;
}
@Override
@Deprecated
public void setOverridePrimaryKeys(String[] overridePrimaryKeys) {
this.overridePrimaryKeys = overridePrimaryKeys;
if (overridePrimaryKeys != null) {
for (String overridePrimaryKey : overridePrimaryKeys) {
log.warn("DEPRECATION", "The <overridePrimaryKeys/> configuration element has been deprecated in jOOQ 3.14. Use <syntheticKeys/> only, instead.");
getConfiguredSyntheticPrimaryKeys().add(new SyntheticPrimaryKeyType().withKey(overridePrimaryKey));
}
}
}
@Override
public String[] getOverridePrimaryKeys() {
if (overridePrimaryKeys == null) {
overridePrimaryKeys = new String[0];
}
return overridePrimaryKeys;
log.warn("DEPRECATION", "The <overridePrimaryKeys/> configuration element has been deprecated in jOOQ 3.14. Use <syntheticKeys/> only, instead.");
return new String[0];
}
@Override
@ -2571,6 +2586,10 @@ public abstract class AbstractDatabase implements Database {
return Collections.unmodifiableList(all);
}
protected final <T extends Definition> List<T> filterExcludeInclude(List<T> definitions, String e, String i, List<Filter> f) {
return filterExcludeInclude(definitions, new String[] { e }, new String[] { i }, f);
}
protected final <T extends Definition> List<T> filterExcludeInclude(List<T> definitions, String[] e, String[] i, List<Filter> f) {
List<T> result = new ArrayList<>();
@ -2621,7 +2640,7 @@ public abstract class AbstractDatabase implements Database {
* Retrieve ALL relations from the database.
*/
protected final Relations getRelations0() {
final DefaultRelations result = new DefaultRelations();
final DefaultRelations result = relations instanceof DefaultRelations ? (DefaultRelations) relations : new DefaultRelations();
if (getIncludePrimaryKeys()) {
onError(ERROR, "Error while fetching primary keys", new ExceptionRunnable() {
@ -2660,16 +2679,21 @@ public abstract class AbstractDatabase implements Database {
}
if (getIncludePrimaryKeys()) {
onError(ERROR, "Error while generating synthetic primary keys", new ExceptionRunnable() {
@Override
public void run() throws Exception {
syntheticPrimaryKeysLegacy(result);
}
});
onError(ERROR, "Error while generating synthetic primary keys", new ExceptionRunnable() {
@Override
public void run() throws Exception {
syntheticPrimaryKeys(result);
}
});
}
if (getIncludePrimaryKeys()) {
onError(ERROR, "Error while fetching domains", new ExceptionRunnable() {
onError(ERROR, "Error while generating overridden primary keys", new ExceptionRunnable() {
@Override
public void run() throws Exception {
overridePrimaryKeys(result);
@ -2677,6 +2701,28 @@ public abstract class AbstractDatabase implements Database {
});
}
return result;
}
@ -2709,37 +2755,210 @@ public abstract class AbstractDatabase implements Database {
return fetched.size() + " (" + included.size() + " included, " + (fetched.size() - included.size()) + " excluded)";
}
@SuppressWarnings("unused")
@Override
public void setConfiguredSyntheticKeys(SyntheticKeysType configuredSyntheticKeys) {
if (configuredSyntheticKeys != null) {
// [#8512] Some implementation of this database may have already
// configured things programmatically, so we must not set the
// list but append it.
getConfiguredSyntheticIdentities().addAll(configuredSyntheticKeys.getIdentities());
getConfiguredSyntheticPrimaryKeys().addAll(configuredSyntheticKeys.getPrimaryKeys());
getConfiguredSyntheticUniqueKeys().addAll(configuredSyntheticKeys.getUniqueKeys());
getConfiguredSyntheticForeignKeys().addAll(configuredSyntheticKeys.getForeignKeys());
unusedSyntheticIdentities.addAll(configuredSyntheticKeys.getIdentities());
unusedSyntheticPrimaryKeys.addAll(configuredSyntheticKeys.getPrimaryKeys());
unusedSyntheticUniqueKeys.addAll(configuredSyntheticKeys.getUniqueKeys());
unusedSyntheticForeignKeys.addAll(configuredSyntheticKeys.getForeignKeys());
if (!configuredSyntheticKeys.getUniqueKeys().isEmpty())
log.info("Commercial feature", "Synthetic unique keys are a commercial only feature. Please upgrade to the jOOQ Professional Edition");
if (!configuredSyntheticKeys.getForeignKeys().isEmpty())
log.info("Commercial feature", "Synthetic foreign keys are a commercial only feature. Please upgrade to the jOOQ Professional Edition");
}
}
@Override
public List<SyntheticIdentityType> getConfiguredSyntheticIdentities() {
if (configuredSyntheticIdentities == null)
configuredSyntheticIdentities = new ArrayList<>();
return configuredSyntheticIdentities;
}
@Override
public List<SyntheticPrimaryKeyType> getConfiguredSyntheticPrimaryKeys() {
if (configuredSyntheticPrimaryKeys == null)
configuredSyntheticPrimaryKeys = new ArrayList<>();
return configuredSyntheticPrimaryKeys;
}
@Override
public List<SyntheticUniqueKeyType> getConfiguredSyntheticUniqueKeys() {
if (configuredSyntheticUniqueKeys == null)
configuredSyntheticUniqueKeys = new ArrayList<>();
return configuredSyntheticUniqueKeys;
}
@Override
public List<SyntheticForeignKeyType> getConfiguredSyntheticForeignKeys() {
if (configuredSyntheticForeignKeys == null)
configuredSyntheticForeignKeys = new ArrayList<>();
return configuredSyntheticForeignKeys;
}
@Override
public void markUsed(SyntheticIdentityType identity) {
unusedSyntheticIdentities.remove(identity);
}
@Override
public void markUsed(SyntheticPrimaryKeyType primaryKey) {
unusedSyntheticPrimaryKeys.remove(primaryKey);
}
@Override
public void markUsed(SyntheticUniqueKeyType uniqueKey) {
unusedSyntheticUniqueKeys.remove(uniqueKey);
}
@Override
public void markUsed(SyntheticForeignKeyType foreignKey) {
unusedSyntheticForeignKeys.remove(foreignKey);
}
@Override
public List<SyntheticIdentityType> getUnusedSyntheticIdentities() {
return new ArrayList<>(unusedSyntheticIdentities);
}
@Override
public List<SyntheticPrimaryKeyType> getUnusedSyntheticPrimaryKeys() {
return new ArrayList<>(unusedSyntheticPrimaryKeys);
}
@Override
public List<SyntheticUniqueKeyType> getUnusedSyntheticUniqueKeys() {
return new ArrayList<>(unusedSyntheticUniqueKeys);
}
@Override
public List<SyntheticForeignKeyType> getUnusedSyntheticForeignKeys() {
return new ArrayList<>(unusedSyntheticForeignKeys);
}
private final void syntheticPrimaryKeys(DefaultRelations r) {
keyLoop:
for (SyntheticPrimaryKeyType key : getConfiguredSyntheticPrimaryKeys()) {
if (key.getKey() != null)
continue keyLoop;
for (TableDefinition table : filterExcludeInclude(getTables(), null, key.getKeyTables() != null ? key.getKeyTables() : ".*", Collections.emptyList())) {
String keyName = key.getName() != null ? key.getName() : "SYNTHETIC_PK_" + table.getName();
for (ColumnDefinition column : filterExcludeInclude(table.getColumns(), null, key.getKeyFields(), Collections.emptyList())) {
markUsed(key);
r.addPrimaryKey(keyName, table, column);
}
}
}
}
private final void overridePrimaryKeys(DefaultRelations r) {
keyLoop:
for (SyntheticPrimaryKeyType key : getConfiguredSyntheticPrimaryKeys()) {
if (key.getKey() == null)
continue keyLoop;
for (TableDefinition table : filterExcludeInclude(getTables(), null, key.getKeyTables() != null ? key.getKeyTables() : ".*", Collections.emptyList())) {
for (UniqueKeyDefinition uk : filterExcludeInclude(table.getUniqueKeys(), null, key.getKey(), Collections.emptyList())) {
log.info("Overriding primary key", "" + uk);
r.overridePrimaryKey(uk);
markUsed(key);
}
}
}
}
private final void syntheticPrimaryKeysLegacy(DefaultRelations r) {
List<UniqueKeyDefinition> syntheticKeys = new ArrayList<>();
for (SchemaDefinition schema : getSchemata()) {
for (TableDefinition table : schema.getTables()) {
List<ColumnDefinition> columns = filterExcludeInclude(table.getColumns(), null, getSyntheticPrimaryKeys(), filters);
for (TableDefinition table : getTables()) {
List<ColumnDefinition> columns = filterExcludeInclude(table.getColumns(), null, getSyntheticPrimaryKeys(), filters);
if (!columns.isEmpty()) {
DefaultUniqueKeyDefinition syntheticKey = new DefaultUniqueKeyDefinition(schema, "SYNTHETIC_PK_" + table.getName(), table, true);
syntheticKey.getKeyColumns().addAll(columns);
syntheticKeys.add(syntheticKey);
}
if (!columns.isEmpty()) {
DefaultUniqueKeyDefinition syntheticKey = new DefaultUniqueKeyDefinition(table.getSchema(), "SYNTHETIC_PK_" + table.getName(), table, true);
syntheticKey.getKeyColumns().addAll(columns);
syntheticKeys.add(syntheticKey);
}
}
log.info("Synthetic primary keys", fetchedSize(syntheticKeys, syntheticKeys));
for (UniqueKeyDefinition key : syntheticKeys) {
for (UniqueKeyDefinition key : syntheticKeys)
r.overridePrimaryKey(key);
}
}
private final void overridePrimaryKeys(DefaultRelations r) {
List<UniqueKeyDefinition> allKeys = r.getUniqueKeys();
List<UniqueKeyDefinition> filteredKeys = filterExcludeInclude(allKeys, null, overridePrimaryKeys, filters);
log.info("Overriding primary keys", fetchedSize(allKeys, filteredKeys));
for (UniqueKeyDefinition key : filteredKeys) {
r.overridePrimaryKey(key);
}
}
@Override

View File

@ -56,6 +56,11 @@ import org.jooq.meta.jaxb.ForcedType;
import org.jooq.meta.jaxb.OnError;
import org.jooq.meta.jaxb.RegexFlag;
import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.meta.jaxb.SyntheticForeignKeyType;
import org.jooq.meta.jaxb.SyntheticIdentityType;
import org.jooq.meta.jaxb.SyntheticKeysType;
import org.jooq.meta.jaxb.SyntheticPrimaryKeyType;
import org.jooq.meta.jaxb.SyntheticUniqueKeyType;
/**
* A general database model.
@ -759,13 +764,22 @@ public interface Database extends AutoCloseable {
/**
* Unique keys matching these regular expressions will be considered as
* primary keys in generated code.
*
* @deprecated - 3.14.0 - [#10588] - Use
* {@link #setConfiguredSyntheticKeys(SyntheticKeysType)}
* instead.
*/
@Deprecated
void setOverridePrimaryKeys(String[] primaryKeys);
/**
* Unique keys matching these regular expressions will be considered as
* primary keys in generated code.
*
* @deprecated - 3.14.0 - [#10588] - Use
* {@link #getConfiguredSyntheticPrimaryKeys()} instead.
*/
@Deprecated
String[] getOverridePrimaryKeys();
/**
@ -953,6 +967,71 @@ public interface Database extends AutoCloseable {
*/
void setEmbeddableDomains(boolean embeddableDomains);
/**
* Configure the synthetic keys.
*/
void setConfiguredSyntheticKeys(SyntheticKeysType configuredSyntheticKeys);
/**
* Get the configured synthetic identities.
*/
List<SyntheticIdentityType> getConfiguredSyntheticIdentities();
/**
* Get the configured synthetic primary keys.
*/
List<SyntheticPrimaryKeyType> getConfiguredSyntheticPrimaryKeys();
/**
* Get the configured synthetic unique keys.
*/
List<SyntheticUniqueKeyType> getConfiguredSyntheticUniqueKeys();
/**
* Get the configured synthetic foreign keys.
*/
List<SyntheticForeignKeyType> getConfiguredSyntheticForeignKeys();
/**
* Mark a synthetic identity as used.
*/
void markUsed(SyntheticIdentityType identity);
/**
* Retrieve the not-yet used synthetic identities.
*/
List<SyntheticIdentityType> getUnusedSyntheticIdentities();
/**
* Mark a synthetic primary key as used.
*/
void markUsed(SyntheticPrimaryKeyType primaryKey);
/**
* Retrieve the not-yet used synthetic primary keys.
*/
List<SyntheticPrimaryKeyType> getUnusedSyntheticPrimaryKeys();
/**
* Mark a synthetic unique key as used.
*/
void markUsed(SyntheticUniqueKeyType uniqueKey);
/**
* Retrieve the not-yet used synthetic unique keys.
*/
List<SyntheticUniqueKeyType> getUnusedSyntheticUniqueKeys();
/**
* Mark a synthetic foreign key as used.
*/
void markUsed(SyntheticForeignKeyType foreignKey);
/**
* Retrieve the not-yet used synthetic foreign keys.
*/
List<SyntheticForeignKeyType> getUnusedSyntheticForeignKeys();
/**
* Get the dialect for this database.
*/

View File

@ -66,6 +66,10 @@ public class DefaultRelations implements Relations {
private transient Map<ColumnDefinition, List<ForeignKeyDefinition>> foreignKeysByColumn;
private transient Map<TableDefinition, List<CheckConstraintDefinition>> checkConstraintsByTable;
public void promoteUniqueKey(UniqueKeyDefinition uk) {
}
public void addPrimaryKey(String keyName, TableDefinition table, ColumnDefinition column) {
addPrimaryKey(keyName, table, column, true);
}

View File

@ -95,6 +95,7 @@ public class Database implements Serializable, XMLAppendable
@XmlElement(defaultValue = "")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String recordTimestampFields = "";
protected SyntheticKeysType syntheticKeys;
@XmlElement(defaultValue = "")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String syntheticIdentities = "";
@ -929,6 +930,22 @@ public class Database implements Serializable, XMLAppendable
this.recordTimestampFields = value;
}
/**
* The synthetic key configuration.
*
*/
public SyntheticKeysType getSyntheticKeys() {
return syntheticKeys;
}
/**
* The synthetic key configuration.
*
*/
public void setSyntheticKeys(SyntheticKeysType value) {
this.syntheticKeys = value;
}
/**
* A regular expression matching all columns that represent identities.
* <p>
@ -1907,6 +1924,15 @@ public class Database implements Serializable, XMLAppendable
return this;
}
/**
* The synthetic key configuration.
*
*/
public Database withSyntheticKeys(SyntheticKeysType value) {
setSyntheticKeys(value);
return this;
}
/**
* A regular expression matching all columns that represent identities.
* <p>
@ -2324,6 +2350,7 @@ public class Database implements Serializable, XMLAppendable
builder.append("includeInvisibleColumns", includeInvisibleColumns);
builder.append("recordVersionFields", recordVersionFields);
builder.append("recordTimestampFields", recordTimestampFields);
builder.append("syntheticKeys", syntheticKeys);
builder.append("syntheticIdentities", syntheticIdentities);
builder.append("syntheticPrimaryKeys", syntheticPrimaryKeys);
builder.append("overridePrimaryKeys", overridePrimaryKeys);
@ -2627,6 +2654,15 @@ public class Database implements Serializable, XMLAppendable
return false;
}
}
if (syntheticKeys == null) {
if (other.syntheticKeys!= null) {
return false;
}
} else {
if (!syntheticKeys.equals(other.syntheticKeys)) {
return false;
}
}
if (syntheticIdentities == null) {
if (other.syntheticIdentities!= null) {
return false;
@ -2932,6 +2968,7 @@ public class Database implements Serializable, XMLAppendable
result = ((prime*result)+((includeInvisibleColumns == null)? 0 :includeInvisibleColumns.hashCode()));
result = ((prime*result)+((recordVersionFields == null)? 0 :recordVersionFields.hashCode()));
result = ((prime*result)+((recordTimestampFields == null)? 0 :recordTimestampFields.hashCode()));
result = ((prime*result)+((syntheticKeys == null)? 0 :syntheticKeys.hashCode()));
result = ((prime*result)+((syntheticIdentities == null)? 0 :syntheticIdentities.hashCode()));
result = ((prime*result)+((syntheticPrimaryKeys == null)? 0 :syntheticPrimaryKeys.hashCode()));
result = ((prime*result)+((overridePrimaryKeys == null)? 0 :overridePrimaryKeys.hashCode()));

View File

@ -157,6 +157,46 @@ public class ObjectFactory {
return new Database();
}
/**
* Create an instance of {@link SyntheticKeysType }
*
*/
public SyntheticKeysType createSyntheticKeysType() {
return new SyntheticKeysType();
}
/**
* Create an instance of {@link SyntheticIdentityType }
*
*/
public SyntheticIdentityType createSyntheticIdentityType() {
return new SyntheticIdentityType();
}
/**
* Create an instance of {@link SyntheticPrimaryKeyType }
*
*/
public SyntheticPrimaryKeyType createSyntheticPrimaryKeyType() {
return new SyntheticPrimaryKeyType();
}
/**
* Create an instance of {@link SyntheticUniqueKeyType }
*
*/
public SyntheticUniqueKeyType createSyntheticUniqueKeyType() {
return new SyntheticUniqueKeyType();
}
/**
* Create an instance of {@link SyntheticForeignKeyType }
*
*/
public SyntheticForeignKeyType createSyntheticForeignKeyType() {
return new SyntheticForeignKeyType();
}
/**
* Create an instance of {@link CatalogMappingType }
*

View File

@ -0,0 +1,314 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
import org.jooq.util.jaxb.tools.XMLAppendable;
import org.jooq.util.jaxb.tools.XMLBuilder;
/**
* <p>Java class for SyntheticForeignKeyType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="SyntheticForeignKeyType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;all&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="referencedTable" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="referencedFields" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="referencedKey" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SyntheticForeignKeyType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class SyntheticForeignKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31400L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyTables;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyFields;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String referencedTable;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String referencedFields;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String referencedKey;
/**
* The optional foreign key name.
*
*/
public String getName() {
return name;
}
/**
* The optional foreign key name.
*
*/
public void setName(String value) {
this.name = value;
}
/**
* A regular expression matching all tables on which to apply this synthetic foreign key.
*
*/
public String getKeyTables() {
return keyTables;
}
/**
* A regular expression matching all tables on which to apply this synthetic foreign key.
*
*/
public void setKeyTables(String value) {
this.keyTables = value;
}
/**
* A regular expression matching all fields on which to apply this synthetic foreign key.
*
*/
public String getKeyFields() {
return keyFields;
}
/**
* A regular expression matching all fields on which to apply this synthetic foreign key.
*
*/
public void setKeyFields(String value) {
this.keyFields = value;
}
/**
* A regular expression matching a table that is referenced by this synthetic foreign key.
*
*/
public String getReferencedTable() {
return referencedTable;
}
/**
* A regular expression matching a table that is referenced by this synthetic foreign key.
*
*/
public void setReferencedTable(String value) {
this.referencedTable = value;
}
/**
* A regular expression matching fields that are referenced by this synthetic foreign key.
*
*/
public String getReferencedFields() {
return referencedFields;
}
/**
* A regular expression matching fields that are referenced by this synthetic foreign key.
*
*/
public void setReferencedFields(String value) {
this.referencedFields = value;
}
/**
* A regular expression matching a key that is referenced by this synthetic foreign key.
*
*/
public String getReferencedKey() {
return referencedKey;
}
/**
* A regular expression matching a key that is referenced by this synthetic foreign key.
*
*/
public void setReferencedKey(String value) {
this.referencedKey = value;
}
/**
* The optional foreign key name.
*
*/
public SyntheticForeignKeyType withName(String value) {
setName(value);
return this;
}
/**
* A regular expression matching all tables on which to apply this synthetic foreign key.
*
*/
public SyntheticForeignKeyType withKeyTables(String value) {
setKeyTables(value);
return this;
}
/**
* A regular expression matching all fields on which to apply this synthetic foreign key.
*
*/
public SyntheticForeignKeyType withKeyFields(String value) {
setKeyFields(value);
return this;
}
/**
* A regular expression matching a table that is referenced by this synthetic foreign key.
*
*/
public SyntheticForeignKeyType withReferencedTable(String value) {
setReferencedTable(value);
return this;
}
/**
* A regular expression matching fields that are referenced by this synthetic foreign key.
*
*/
public SyntheticForeignKeyType withReferencedFields(String value) {
setReferencedFields(value);
return this;
}
/**
* A regular expression matching a key that is referenced by this synthetic foreign key.
*
*/
public SyntheticForeignKeyType withReferencedKey(String value) {
setReferencedKey(value);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("name", name);
builder.append("keyTables", keyTables);
builder.append("keyFields", keyFields);
builder.append("referencedTable", referencedTable);
builder.append("referencedFields", referencedFields);
builder.append("referencedKey", referencedKey);
}
@Override
public String toString() {
XMLBuilder builder = XMLBuilder.nonFormatting();
appendTo(builder);
return builder.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass()!= that.getClass()) {
return false;
}
SyntheticForeignKeyType other = ((SyntheticForeignKeyType) that);
if (name == null) {
if (other.name!= null) {
return false;
}
} else {
if (!name.equals(other.name)) {
return false;
}
}
if (keyTables == null) {
if (other.keyTables!= null) {
return false;
}
} else {
if (!keyTables.equals(other.keyTables)) {
return false;
}
}
if (keyFields == null) {
if (other.keyFields!= null) {
return false;
}
} else {
if (!keyFields.equals(other.keyFields)) {
return false;
}
}
if (referencedTable == null) {
if (other.referencedTable!= null) {
return false;
}
} else {
if (!referencedTable.equals(other.referencedTable)) {
return false;
}
}
if (referencedFields == null) {
if (other.referencedFields!= null) {
return false;
}
} else {
if (!referencedFields.equals(other.referencedFields)) {
return false;
}
}
if (referencedKey == null) {
if (other.referencedKey!= null) {
return false;
}
} else {
if (!referencedKey.equals(other.referencedKey)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
result = ((prime*result)+((referencedTable == null)? 0 :referencedTable.hashCode()));
result = ((prime*result)+((referencedFields == null)? 0 :referencedFields.hashCode()));
result = ((prime*result)+((referencedKey == null)? 0 :referencedKey.hashCode()));
return result;
}
}

View File

@ -0,0 +1,157 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
import org.jooq.util.jaxb.tools.XMLAppendable;
import org.jooq.util.jaxb.tools.XMLBuilder;
/**
* <p>Java class for SyntheticIdentityType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="SyntheticIdentityType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;all&gt;
* &lt;element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SyntheticIdentityType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class SyntheticIdentityType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31400L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyTables;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyFields;
/**
* A regular expression matching all tables on which to apply this synthetic identity.
*
*/
public String getKeyTables() {
return keyTables;
}
/**
* A regular expression matching all tables on which to apply this synthetic identity.
*
*/
public void setKeyTables(String value) {
this.keyTables = value;
}
/**
* A regular expression matching all fields on which to apply this synthetic identity.
*
*/
public String getKeyFields() {
return keyFields;
}
/**
* A regular expression matching all fields on which to apply this synthetic identity.
*
*/
public void setKeyFields(String value) {
this.keyFields = value;
}
/**
* A regular expression matching all tables on which to apply this synthetic identity.
*
*/
public SyntheticIdentityType withKeyTables(String value) {
setKeyTables(value);
return this;
}
/**
* A regular expression matching all fields on which to apply this synthetic identity.
*
*/
public SyntheticIdentityType withKeyFields(String value) {
setKeyFields(value);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("keyTables", keyTables);
builder.append("keyFields", keyFields);
}
@Override
public String toString() {
XMLBuilder builder = XMLBuilder.nonFormatting();
appendTo(builder);
return builder.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass()!= that.getClass()) {
return false;
}
SyntheticIdentityType other = ((SyntheticIdentityType) that);
if (keyTables == null) {
if (other.keyTables!= null) {
return false;
}
} else {
if (!keyTables.equals(other.keyTables)) {
return false;
}
}
if (keyFields == null) {
if (other.keyFields!= null) {
return false;
}
} else {
if (!keyFields.equals(other.keyFields)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
return result;
}
}

View File

@ -0,0 +1,252 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
import org.jooq.util.jaxb.tools.XMLAppendable;
import org.jooq.util.jaxb.tools.XMLBuilder;
/**
* Synthetic key configuration.
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SyntheticKeysType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class SyntheticKeysType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31400L;
@XmlElementWrapper(name = "identities")
@XmlElement(name = "identity")
protected List<SyntheticIdentityType> identities;
@XmlElementWrapper(name = "primaryKeys")
@XmlElement(name = "primaryKey")
protected List<SyntheticPrimaryKeyType> primaryKeys;
@XmlElementWrapper(name = "uniqueKeys")
@XmlElement(name = "uniqueKey")
protected List<SyntheticUniqueKeyType> uniqueKeys;
@XmlElementWrapper(name = "foreignKeys")
@XmlElement(name = "primaryKey")
protected List<SyntheticForeignKeyType> foreignKeys;
public List<SyntheticIdentityType> getIdentities() {
if (identities == null) {
identities = new ArrayList<SyntheticIdentityType>();
}
return identities;
}
public void setIdentities(List<SyntheticIdentityType> identities) {
this.identities = identities;
}
public List<SyntheticPrimaryKeyType> getPrimaryKeys() {
if (primaryKeys == null) {
primaryKeys = new ArrayList<SyntheticPrimaryKeyType>();
}
return primaryKeys;
}
public void setPrimaryKeys(List<SyntheticPrimaryKeyType> primaryKeys) {
this.primaryKeys = primaryKeys;
}
public List<SyntheticUniqueKeyType> getUniqueKeys() {
if (uniqueKeys == null) {
uniqueKeys = new ArrayList<SyntheticUniqueKeyType>();
}
return uniqueKeys;
}
public void setUniqueKeys(List<SyntheticUniqueKeyType> uniqueKeys) {
this.uniqueKeys = uniqueKeys;
}
public List<SyntheticForeignKeyType> getForeignKeys() {
if (foreignKeys == null) {
foreignKeys = new ArrayList<SyntheticForeignKeyType>();
}
return foreignKeys;
}
public void setForeignKeys(List<SyntheticForeignKeyType> foreignKeys) {
this.foreignKeys = foreignKeys;
}
public SyntheticKeysType withIdentities(SyntheticIdentityType... values) {
if (values!= null) {
for (SyntheticIdentityType value: values) {
getIdentities().add(value);
}
}
return this;
}
public SyntheticKeysType withIdentities(Collection<SyntheticIdentityType> values) {
if (values!= null) {
getIdentities().addAll(values);
}
return this;
}
public SyntheticKeysType withIdentities(List<SyntheticIdentityType> identities) {
setIdentities(identities);
return this;
}
public SyntheticKeysType withPrimaryKeys(SyntheticPrimaryKeyType... values) {
if (values!= null) {
for (SyntheticPrimaryKeyType value: values) {
getPrimaryKeys().add(value);
}
}
return this;
}
public SyntheticKeysType withPrimaryKeys(Collection<SyntheticPrimaryKeyType> values) {
if (values!= null) {
getPrimaryKeys().addAll(values);
}
return this;
}
public SyntheticKeysType withPrimaryKeys(List<SyntheticPrimaryKeyType> primaryKeys) {
setPrimaryKeys(primaryKeys);
return this;
}
public SyntheticKeysType withUniqueKeys(SyntheticUniqueKeyType... values) {
if (values!= null) {
for (SyntheticUniqueKeyType value: values) {
getUniqueKeys().add(value);
}
}
return this;
}
public SyntheticKeysType withUniqueKeys(Collection<SyntheticUniqueKeyType> values) {
if (values!= null) {
getUniqueKeys().addAll(values);
}
return this;
}
public SyntheticKeysType withUniqueKeys(List<SyntheticUniqueKeyType> uniqueKeys) {
setUniqueKeys(uniqueKeys);
return this;
}
public SyntheticKeysType withForeignKeys(SyntheticForeignKeyType... values) {
if (values!= null) {
for (SyntheticForeignKeyType value: values) {
getForeignKeys().add(value);
}
}
return this;
}
public SyntheticKeysType withForeignKeys(Collection<SyntheticForeignKeyType> values) {
if (values!= null) {
getForeignKeys().addAll(values);
}
return this;
}
public SyntheticKeysType withForeignKeys(List<SyntheticForeignKeyType> foreignKeys) {
setForeignKeys(foreignKeys);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("identities", "identity", identities);
builder.append("primaryKeys", "primaryKey", primaryKeys);
builder.append("uniqueKeys", "uniqueKey", uniqueKeys);
builder.append("foreignKeys", "primaryKey", foreignKeys);
}
@Override
public String toString() {
XMLBuilder builder = XMLBuilder.nonFormatting();
appendTo(builder);
return builder.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass()!= that.getClass()) {
return false;
}
SyntheticKeysType other = ((SyntheticKeysType) that);
if (identities == null) {
if (other.identities!= null) {
return false;
}
} else {
if (!identities.equals(other.identities)) {
return false;
}
}
if (primaryKeys == null) {
if (other.primaryKeys!= null) {
return false;
}
} else {
if (!primaryKeys.equals(other.primaryKeys)) {
return false;
}
}
if (uniqueKeys == null) {
if (other.uniqueKeys!= null) {
return false;
}
} else {
if (!uniqueKeys.equals(other.uniqueKeys)) {
return false;
}
}
if (foreignKeys == null) {
if (other.foreignKeys!= null) {
return false;
}
} else {
if (!foreignKeys.equals(other.foreignKeys)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = ((prime*result)+((identities == null)? 0 :identities.hashCode()));
result = ((prime*result)+((primaryKeys == null)? 0 :primaryKeys.hashCode()));
result = ((prime*result)+((uniqueKeys == null)? 0 :uniqueKeys.hashCode()));
result = ((prime*result)+((foreignKeys == null)? 0 :foreignKeys.hashCode()));
return result;
}
}

View File

@ -0,0 +1,235 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
import org.jooq.util.jaxb.tools.XMLAppendable;
import org.jooq.util.jaxb.tools.XMLBuilder;
/**
* <p>Java class for SyntheticPrimaryKeyType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="SyntheticPrimaryKeyType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;all&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SyntheticPrimaryKeyType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31400L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyTables;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyFields;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String key;
/**
* The optional primary key name.
*
*/
public String getName() {
return name;
}
/**
* The optional primary key name.
*
*/
public void setName(String value) {
this.name = value;
}
/**
* A regular expression matching all tables on which to apply this synthetic primary key.
*
*/
public String getKeyTables() {
return keyTables;
}
/**
* A regular expression matching all tables on which to apply this synthetic primary key.
*
*/
public void setKeyTables(String value) {
this.keyTables = value;
}
/**
* A regular expression matching all fields on which to apply this new synthetic primary key.
*
*/
public String getKeyFields() {
return keyFields;
}
/**
* A regular expression matching all fields on which to apply this new synthetic primary key.
*
*/
public void setKeyFields(String value) {
this.keyFields = value;
}
/**
* A regular expression matching all unique keys and unique indexes which should be treated as primary key.
*
*/
public String getKey() {
return key;
}
/**
* A regular expression matching all unique keys and unique indexes which should be treated as primary key.
*
*/
public void setKey(String value) {
this.key = value;
}
/**
* The optional primary key name.
*
*/
public SyntheticPrimaryKeyType withName(String value) {
setName(value);
return this;
}
/**
* A regular expression matching all tables on which to apply this synthetic primary key.
*
*/
public SyntheticPrimaryKeyType withKeyTables(String value) {
setKeyTables(value);
return this;
}
/**
* A regular expression matching all fields on which to apply this new synthetic primary key.
*
*/
public SyntheticPrimaryKeyType withKeyFields(String value) {
setKeyFields(value);
return this;
}
/**
* A regular expression matching all unique keys and unique indexes which should be treated as primary key.
*
*/
public SyntheticPrimaryKeyType withKey(String value) {
setKey(value);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("name", name);
builder.append("keyTables", keyTables);
builder.append("keyFields", keyFields);
builder.append("key", key);
}
@Override
public String toString() {
XMLBuilder builder = XMLBuilder.nonFormatting();
appendTo(builder);
return builder.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass()!= that.getClass()) {
return false;
}
SyntheticPrimaryKeyType other = ((SyntheticPrimaryKeyType) that);
if (name == null) {
if (other.name!= null) {
return false;
}
} else {
if (!name.equals(other.name)) {
return false;
}
}
if (keyTables == null) {
if (other.keyTables!= null) {
return false;
}
} else {
if (!keyTables.equals(other.keyTables)) {
return false;
}
}
if (keyFields == null) {
if (other.keyFields!= null) {
return false;
}
} else {
if (!keyFields.equals(other.keyFields)) {
return false;
}
}
if (key == null) {
if (other.key!= null) {
return false;
}
} else {
if (!key.equals(other.key)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
result = ((prime*result)+((key == null)? 0 :key.hashCode()));
return result;
}
}

View File

@ -0,0 +1,196 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
import org.jooq.util.jaxb.tools.XMLAppendable;
import org.jooq.util.jaxb.tools.XMLBuilder;
/**
* <p>Java class for SyntheticUniqueKeyType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="SyntheticUniqueKeyType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;all&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SyntheticUniqueKeyType", propOrder = {
})
@SuppressWarnings({
"all"
})
public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31400L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyTables;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String keyFields;
/**
* The optional unique key name.
*
*/
public String getName() {
return name;
}
/**
* The optional unique key name.
*
*/
public void setName(String value) {
this.name = value;
}
/**
* A regular expression matching all tables on which to apply this synthetic unique key.
*
*/
public String getKeyTables() {
return keyTables;
}
/**
* A regular expression matching all tables on which to apply this synthetic unique key.
*
*/
public void setKeyTables(String value) {
this.keyTables = value;
}
/**
* A regular expression matching all fields on which to apply this synthetic unique key.
*
*/
public String getKeyFields() {
return keyFields;
}
/**
* A regular expression matching all fields on which to apply this synthetic unique key.
*
*/
public void setKeyFields(String value) {
this.keyFields = value;
}
/**
* The optional unique key name.
*
*/
public SyntheticUniqueKeyType withName(String value) {
setName(value);
return this;
}
/**
* A regular expression matching all tables on which to apply this synthetic unique key.
*
*/
public SyntheticUniqueKeyType withKeyTables(String value) {
setKeyTables(value);
return this;
}
/**
* A regular expression matching all fields on which to apply this synthetic unique key.
*
*/
public SyntheticUniqueKeyType withKeyFields(String value) {
setKeyFields(value);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("name", name);
builder.append("keyTables", keyTables);
builder.append("keyFields", keyFields);
}
@Override
public String toString() {
XMLBuilder builder = XMLBuilder.nonFormatting();
appendTo(builder);
return builder.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass()!= that.getClass()) {
return false;
}
SyntheticUniqueKeyType other = ((SyntheticUniqueKeyType) that);
if (name == null) {
if (other.name!= null) {
return false;
}
} else {
if (!name.equals(other.name)) {
return false;
}
}
if (keyTables == null) {
if (other.keyTables!= null) {
return false;
}
} else {
if (!keyTables.equals(other.keyTables)) {
return false;
}
}
if (keyFields == null) {
if (other.keyFields!= null) {
return false;
}
} else {
if (!keyFields.equals(other.keyFields)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
return result;
}
}

View File

@ -671,6 +671,10 @@ This is a Java regular expression. Use the pipe to separate several expressions.
See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="syntheticKeys" type="tns:SyntheticKeysType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The synthetic key configuration.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="syntheticIdentities" type="string" default="" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all columns that represent identities.
<p>
@ -910,6 +914,131 @@ for Oracle.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="SyntheticKeysType">
<annotation><appinfo><jxb:class><jxb:javadoc><![CDATA[Synthetic key configuration.]]></jxb:javadoc></jxb:class></appinfo></annotation>
<all>
<element name="identities" type="tns:SyntheticIdentitiesType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic identity configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="primaryKeys" type="tns:SyntheticPrimaryKeysType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic primary key configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="uniqueKeys" type="tns:SyntheticUniqueKeysType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic unique key configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="foreignKeys" type="tns:SyntheticForeignKeysType" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic unique key configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="SyntheticIdentitiesType">
<sequence>
<element name="identity" type="tns:SyntheticIdentityType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="SyntheticIdentityType">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic identity configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
<all>
<element name="keyTables" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all tables on which to apply this synthetic identity.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyFields" type="string" minOccurs="1" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all fields on which to apply this synthetic identity.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="SyntheticPrimaryKeysType">
<sequence>
<element name="primaryKey" type="tns:SyntheticPrimaryKeyType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="SyntheticPrimaryKeyType">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic primary key configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
<all>
<element name="name" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The optional primary key name.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyTables" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all tables on which to apply this synthetic primary key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyFields" type="string" minOccurs="1" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all fields on which to apply this new synthetic primary key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="key" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all unique keys and unique indexes which should be treated as primary key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="SyntheticUniqueKeysType">
<sequence>
<element name="uniqueKey" type="tns:SyntheticUniqueKeyType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="SyntheticUniqueKeyType">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic unique key configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
<all>
<element name="name" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The optional unique key name.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyTables" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all tables on which to apply this synthetic unique key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyFields" type="string" minOccurs="1" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all fields on which to apply this synthetic unique key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="SyntheticForeignKeysType">
<sequence>
<element name="primaryKey" type="tns:SyntheticForeignKeyType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="SyntheticForeignKeyType">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Synthetic foreign key configuration]]></jxb:javadoc></jxb:property></appinfo></annotation>
<all>
<element name="name" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The optional foreign key name.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyTables" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all tables on which to apply this synthetic foreign key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="keyFields" type="string" minOccurs="1" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching all fields on which to apply this synthetic foreign key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="referencedTable" type="string" minOccurs="1" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching a table that is referenced by this synthetic foreign key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="referencedFields" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching fields that are referenced by this synthetic foreign key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="referencedKey" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching a key that is referenced by this synthetic foreign key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</all>
</complexType>
<complexType name="CatalogMappingsType">
<sequence>