diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java index afe1ba0de2..9be303dd72 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java @@ -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()) { diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java b/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java index ab8620b93b..bc3cf63423 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java @@ -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 unusedForcedTypes = new HashSet<>(); private List configuredEmbeddables = new ArrayList<>(); private Set unusedEmbeddables = new HashSet<>(); + private List configuredSyntheticIdentities = new ArrayList<>(); + private Set unusedSyntheticIdentities = new HashSet<>(); + private List configuredSyntheticPrimaryKeys = new ArrayList<>(); + private Set unusedSyntheticPrimaryKeys = new HashSet<>(); + private List configuredSyntheticUniqueKeys = new ArrayList<>(); + private Set unusedSyntheticUniqueKeys = new HashSet<>(); + private List configuredSyntheticForeignKeys = new ArrayList<>(); + private Set unusedSyntheticForeignKeys = new HashSet<>(); private SchemaVersionProvider schemaVersionProvider; private CatalogVersionProvider catalogVersionProvider; private Comparator 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 configuration element has been deprecated in jOOQ 3.14. Use 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 configuration element has been deprecated in jOOQ 3.14. Use only, instead."); + return new String[0]; } @Override @@ -2571,6 +2586,10 @@ public abstract class AbstractDatabase implements Database { return Collections.unmodifiableList(all); } + protected final List filterExcludeInclude(List definitions, String e, String i, List f) { + return filterExcludeInclude(definitions, new String[] { e }, new String[] { i }, f); + } + protected final List filterExcludeInclude(List definitions, String[] e, String[] i, List f) { List 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 getConfiguredSyntheticIdentities() { + if (configuredSyntheticIdentities == null) + configuredSyntheticIdentities = new ArrayList<>(); + + return configuredSyntheticIdentities; + } + + @Override + public List getConfiguredSyntheticPrimaryKeys() { + if (configuredSyntheticPrimaryKeys == null) + configuredSyntheticPrimaryKeys = new ArrayList<>(); + + return configuredSyntheticPrimaryKeys; + } + + @Override + public List getConfiguredSyntheticUniqueKeys() { + if (configuredSyntheticUniqueKeys == null) + configuredSyntheticUniqueKeys = new ArrayList<>(); + + return configuredSyntheticUniqueKeys; + } + + @Override + public List 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 getUnusedSyntheticIdentities() { + return new ArrayList<>(unusedSyntheticIdentities); + } + + @Override + public List getUnusedSyntheticPrimaryKeys() { + return new ArrayList<>(unusedSyntheticPrimaryKeys); + } + + @Override + public List getUnusedSyntheticUniqueKeys() { + return new ArrayList<>(unusedSyntheticUniqueKeys); + } + + @Override + public List 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 syntheticKeys = new ArrayList<>(); - for (SchemaDefinition schema : getSchemata()) { - for (TableDefinition table : schema.getTables()) { - List columns = filterExcludeInclude(table.getColumns(), null, getSyntheticPrimaryKeys(), filters); + for (TableDefinition table : getTables()) { + List 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 allKeys = r.getUniqueKeys(); - List filteredKeys = filterExcludeInclude(allKeys, null, overridePrimaryKeys, filters); - - log.info("Overriding primary keys", fetchedSize(allKeys, filteredKeys)); - - for (UniqueKeyDefinition key : filteredKeys) { - r.overridePrimaryKey(key); - } } @Override diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/Database.java b/jOOQ-meta/src/main/java/org/jooq/meta/Database.java index f4b8c52032..a808ed1fe4 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/Database.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/Database.java @@ -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 getConfiguredSyntheticIdentities(); + + /** + * Get the configured synthetic primary keys. + */ + List getConfiguredSyntheticPrimaryKeys(); + + /** + * Get the configured synthetic unique keys. + */ + List getConfiguredSyntheticUniqueKeys(); + + /** + * Get the configured synthetic foreign keys. + */ + List getConfiguredSyntheticForeignKeys(); + + /** + * Mark a synthetic identity as used. + */ + void markUsed(SyntheticIdentityType identity); + + /** + * Retrieve the not-yet used synthetic identities. + */ + List getUnusedSyntheticIdentities(); + + /** + * Mark a synthetic primary key as used. + */ + void markUsed(SyntheticPrimaryKeyType primaryKey); + + /** + * Retrieve the not-yet used synthetic primary keys. + */ + List getUnusedSyntheticPrimaryKeys(); + + /** + * Mark a synthetic unique key as used. + */ + void markUsed(SyntheticUniqueKeyType uniqueKey); + + /** + * Retrieve the not-yet used synthetic unique keys. + */ + List getUnusedSyntheticUniqueKeys(); + + /** + * Mark a synthetic foreign key as used. + */ + void markUsed(SyntheticForeignKeyType foreignKey); + + /** + * Retrieve the not-yet used synthetic foreign keys. + */ + List getUnusedSyntheticForeignKeys(); + /** * Get the dialect for this database. */ diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/DefaultRelations.java b/jOOQ-meta/src/main/java/org/jooq/meta/DefaultRelations.java index 531d6696d2..6d3fa3ef02 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/DefaultRelations.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/DefaultRelations.java @@ -66,6 +66,10 @@ public class DefaultRelations implements Relations { private transient Map> foreignKeysByColumn; private transient Map> checkConstraintsByTable; + public void promoteUniqueKey(UniqueKeyDefinition uk) { + + } + public void addPrimaryKey(String keyName, TableDefinition table, ColumnDefinition column) { addPrimaryKey(keyName, table, column, true); } diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java index 2d9dcb58d3..e2fbc431c0 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java @@ -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. *

@@ -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. *

@@ -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())); diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/ObjectFactory.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/ObjectFactory.java index db1fb55d75..c85fbf68ce 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/ObjectFactory.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/ObjectFactory.java @@ -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 } * diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java new file mode 100644 index 0000000000..3184aba223 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java @@ -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; + + +/** + *

Java class for SyntheticForeignKeyType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SyntheticForeignKeyType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <all>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="referencedTable" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="referencedFields" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="referencedKey" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </all>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@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; + } + +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java new file mode 100644 index 0000000000..a1949cae89 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java @@ -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; + + +/** + *

Java class for SyntheticIdentityType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SyntheticIdentityType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <all>
+ *         <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </all>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@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; + } + +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticKeysType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticKeysType.java new file mode 100644 index 0000000000..ea7a497d4d --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticKeysType.java @@ -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 identities; + @XmlElementWrapper(name = "primaryKeys") + @XmlElement(name = "primaryKey") + protected List primaryKeys; + @XmlElementWrapper(name = "uniqueKeys") + @XmlElement(name = "uniqueKey") + protected List uniqueKeys; + @XmlElementWrapper(name = "foreignKeys") + @XmlElement(name = "primaryKey") + protected List foreignKeys; + + public List getIdentities() { + if (identities == null) { + identities = new ArrayList(); + } + return identities; + } + + public void setIdentities(List identities) { + this.identities = identities; + } + + public List getPrimaryKeys() { + if (primaryKeys == null) { + primaryKeys = new ArrayList(); + } + return primaryKeys; + } + + public void setPrimaryKeys(List primaryKeys) { + this.primaryKeys = primaryKeys; + } + + public List getUniqueKeys() { + if (uniqueKeys == null) { + uniqueKeys = new ArrayList(); + } + return uniqueKeys; + } + + public void setUniqueKeys(List uniqueKeys) { + this.uniqueKeys = uniqueKeys; + } + + public List getForeignKeys() { + if (foreignKeys == null) { + foreignKeys = new ArrayList(); + } + return foreignKeys; + } + + public void setForeignKeys(List 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 values) { + if (values!= null) { + getIdentities().addAll(values); + } + return this; + } + + public SyntheticKeysType withIdentities(List 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 values) { + if (values!= null) { + getPrimaryKeys().addAll(values); + } + return this; + } + + public SyntheticKeysType withPrimaryKeys(List 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 values) { + if (values!= null) { + getUniqueKeys().addAll(values); + } + return this; + } + + public SyntheticKeysType withUniqueKeys(List 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 values) { + if (values!= null) { + getForeignKeys().addAll(values); + } + return this; + } + + public SyntheticKeysType withForeignKeys(List 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; + } + +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java new file mode 100644 index 0000000000..e5d6587142 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java @@ -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; + + +/** + *

Java class for SyntheticPrimaryKeyType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SyntheticPrimaryKeyType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <all>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </all>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@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; + } + +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java new file mode 100644 index 0000000000..f591c346aa --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java @@ -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; + + +/** + *

Java class for SyntheticUniqueKeyType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SyntheticUniqueKeyType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <all>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </all>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@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; + } + +} diff --git a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd index 6296ee215c..ff33599d8a 100644 --- a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd +++ b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd @@ -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.]]> + + + + @@ -910,6 +914,131 @@ for Oracle.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +