[#7343] Add <includePackageConstants>, <includePackageRoutines>, <includePackageUDTs> code generation configuration flags

This commit is contained in:
lukaseder 2018-03-22 16:35:42 +01:00
parent 930cdb0684
commit 0f98ba3e2e
7 changed files with 239 additions and 10 deletions

View File

@ -468,6 +468,9 @@ public class GenerationTool {
database.setIncludeExcludeColumns(TRUE.equals(d.isIncludeExcludeColumns()));
database.setIncludeForeignKeys(!FALSE.equals(d.isIncludeForeignKeys()));
database.setIncludePackages(!FALSE.equals(d.isIncludePackages()));
database.setIncludePackageRoutines(!FALSE.equals(d.isIncludePackageRoutines()));
database.setIncludePackageUDTs(!FALSE.equals(d.isIncludePackageUDTs()));
database.setIncludePackageConstants(!FALSE.equals(d.isIncludePackageConstants()));
database.setIncludeIndexes(!FALSE.equals(d.isIncludeIndexes()));
database.setIncludePrimaryKeys(!FALSE.equals(d.isIncludePrimaryKeys()));
database.setIncludeRoutines(!FALSE.equals(d.isIncludeRoutines()));

View File

@ -15230,6 +15230,9 @@ result.forEach((Object[] entities) -> {
<includeTables>true</includeTables>
<includeRoutines>true</includeRoutines>
<includePackages>true</includePackages>
<includePackageRoutines>true</includePackageRoutines>
<includePackageUDTs>true</includePackageUDTs>
<includePackageConstants>true</includePackageConstants>
<includeUDTs>true</includeUDTs>
<includeSequences>false</includeSequences>
<includePrimaryKeys>false</includePrimaryKeys>
@ -15249,6 +15252,9 @@ result.forEach((Object[] entities) -> {
.withIncludeTables(true)
.withIncludeRoutines(true)
.withIncludePackages(true)
.withIncludePackageRoutines(true)
.withIncludePackageUDTs(true)
.withIncludePackageConstants(true)
.withIncludeUDTs(true)
.withIncludeSequences(false)
.withIncludePrimaryKeys(false)
@ -15265,6 +15271,9 @@ result.forEach((Object[] entities) -> {
includeTables = true
includeRoutines = true
includePackages = true
includePackageRoutines = true
includePackageUDTs = true
includePackageConstants = true
includeUDTs = true
includeSequences = false
includePrimaryKeys = false

View File

@ -111,6 +111,9 @@ public abstract class AbstractDatabase implements Database {
private boolean includeRoutines = true;
private boolean includeTriggerRoutines = false;
private boolean includePackages = true;
private boolean includePackageRoutines = true;
private boolean includePackageUDTs = true;
private boolean includePackageConstants = true;
private boolean includeUDTs = true;
private boolean includeSequences = true;
private boolean includeIndexes = true;
@ -759,6 +762,36 @@ public abstract class AbstractDatabase implements Database {
this.includePackages = includePackages;
}
@Override
public final boolean getIncludePackageRoutines() {
return includePackageRoutines;
}
@Override
public final void setIncludePackageRoutines(boolean includePackageRoutines) {
this.includePackageRoutines = includePackageRoutines;
}
@Override
public final boolean getIncludePackageUDTs() {
return includePackageUDTs;
}
@Override
public final void setIncludePackageUDTs(boolean includePackageUDTs) {
this.includePackageUDTs = includePackageUDTs;
}
@Override
public final boolean getIncludePackageConstants() {
return includePackageConstants;
}
@Override
public final void setIncludePackageConstants(boolean includePackageConstants) {
this.includePackageConstants = includePackageConstants;
}
@Override
public final boolean getIncludeUDTs() {
return includeUDTs;

View File

@ -72,11 +72,13 @@ public abstract class AbstractPackageDefinition extends AbstractDefinition imple
if (routines == null) {
routines = new ArrayList<RoutineDefinition>();
try {
routines = getRoutines0();
}
catch (Exception e) {
log.error("Error while initialising package", e);
if (getDatabase().getIncludePackageRoutines()) {
try {
routines = getRoutines0();
}
catch (Exception e) {
log.error("Error while initialising package", e);
}
}
}
@ -90,11 +92,13 @@ public abstract class AbstractPackageDefinition extends AbstractDefinition imple
if (constants == null) {
constants = new ArrayList<AttributeDefinition>();
try {
constants = getConstants0();
}
catch (Exception e) {
log.error("Error while initialising package", e);
if (getDatabase().getIncludePackageConstants()) {
try {
constants = getConstants0();
}
catch (Exception e) {
log.error("Error while initialising package", e);
}
}
}

View File

@ -451,6 +451,36 @@ public interface Database extends AutoCloseable {
*/
boolean getIncludePackages();
/**
* whether package routines should be included.
*/
void setIncludePackageRoutines(boolean includePackageRoutines);
/**
* whether package routines should be included.
*/
boolean getIncludePackageRoutines();
/**
* whether package UDTs should be included.
*/
void setIncludePackageUDTs(boolean includePackageUDTs);
/**
* whether package UDTs should be included.
*/
boolean getIncludePackageUDTs();
/**
* whether package constants should be included.
*/
void setIncludePackageConstants(boolean includePackageConstants);
/**
* whether package constants should be included.
*/
boolean getIncludePackageConstants();
/**
* whether routines should be included.
*/

View File

@ -63,6 +63,12 @@ public class Database implements Serializable
@XmlElement(defaultValue = "true")
protected Boolean includePackages = true;
@XmlElement(defaultValue = "true")
protected Boolean includePackageRoutines = true;
@XmlElement(defaultValue = "true")
protected Boolean includePackageUDTs = true;
@XmlElement(defaultValue = "true")
protected Boolean includePackageConstants = true;
@XmlElement(defaultValue = "true")
protected Boolean includeUDTs = true;
@XmlElement(defaultValue = "true")
protected Boolean includeSequences = true;
@ -415,6 +421,78 @@ public class Database implements Serializable
this.includePackages = value;
}
/**
* This flag indicates whether routines contained in packages should be included in output produced by this database
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIncludePackageRoutines() {
return includePackageRoutines;
}
/**
* Sets the value of the includePackageRoutines property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIncludePackageRoutines(Boolean value) {
this.includePackageRoutines = value;
}
/**
* This flag indicates whether UDTs contained in packages should be included in output produced by this database
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIncludePackageUDTs() {
return includePackageUDTs;
}
/**
* Sets the value of the includePackageUDTs property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIncludePackageUDTs(Boolean value) {
this.includePackageUDTs = value;
}
/**
* This flag indicates whether constants contained in packages should be included in output produced by this database
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIncludePackageConstants() {
return includePackageConstants;
}
/**
* Sets the value of the includePackageConstants property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIncludePackageConstants(Boolean value) {
this.includePackageConstants = value;
}
/**
* This flag indicates whether udts should be included in output produced by this database
*
@ -1208,6 +1286,21 @@ public class Database implements Serializable
return this;
}
public Database withIncludePackageRoutines(Boolean value) {
setIncludePackageRoutines(value);
return this;
}
public Database withIncludePackageUDTs(Boolean value) {
setIncludePackageUDTs(value);
return this;
}
public Database withIncludePackageConstants(Boolean value) {
setIncludePackageConstants(value);
return this;
}
public Database withIncludeUDTs(Boolean value) {
setIncludeUDTs(value);
return this;
@ -1502,6 +1595,21 @@ public class Database implements Serializable
sb.append(includePackages);
sb.append("</includePackages>");
}
if (includePackageRoutines!= null) {
sb.append("<includePackageRoutines>");
sb.append(includePackageRoutines);
sb.append("</includePackageRoutines>");
}
if (includePackageUDTs!= null) {
sb.append("<includePackageUDTs>");
sb.append(includePackageUDTs);
sb.append("</includePackageUDTs>");
}
if (includePackageConstants!= null) {
sb.append("<includePackageConstants>");
sb.append(includePackageConstants);
sb.append("</includePackageConstants>");
}
if (includeUDTs!= null) {
sb.append("<includeUDTs>");
sb.append(includeUDTs);
@ -1748,6 +1856,33 @@ public class Database implements Serializable
return false;
}
}
if (includePackageRoutines == null) {
if (other.includePackageRoutines!= null) {
return false;
}
} else {
if (!includePackageRoutines.equals(other.includePackageRoutines)) {
return false;
}
}
if (includePackageUDTs == null) {
if (other.includePackageUDTs!= null) {
return false;
}
} else {
if (!includePackageUDTs.equals(other.includePackageUDTs)) {
return false;
}
}
if (includePackageConstants == null) {
if (other.includePackageConstants!= null) {
return false;
}
} else {
if (!includePackageConstants.equals(other.includePackageConstants)) {
return false;
}
}
if (includeUDTs == null) {
if (other.includeUDTs!= null) {
return false;
@ -2034,6 +2169,9 @@ public class Database implements Serializable
result = ((prime*result)+((includeRoutines == null)? 0 :includeRoutines.hashCode()));
result = ((prime*result)+((includeTriggerRoutines == null)? 0 :includeTriggerRoutines.hashCode()));
result = ((prime*result)+((includePackages == null)? 0 :includePackages.hashCode()));
result = ((prime*result)+((includePackageRoutines == null)? 0 :includePackageRoutines.hashCode()));
result = ((prime*result)+((includePackageUDTs == null)? 0 :includePackageUDTs.hashCode()));
result = ((prime*result)+((includePackageConstants == null)? 0 :includePackageConstants.hashCode()));
result = ((prime*result)+((includeUDTs == null)? 0 :includeUDTs.hashCode()));
result = ((prime*result)+((includeSequences == null)? 0 :includeSequences.hashCode()));
result = ((prime*result)+((includeIndexes == null)? 0 :includeIndexes.hashCode()));

View File

@ -452,6 +452,18 @@ Excludes match before includes, i.e. excludes have a higher priority.]]></jxb:ja
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether packages should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includePackageRoutines" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether routines contained in packages should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includePackageUDTs" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether UDTs contained in packages should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includePackageConstants" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether constants contained in packages should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includeUDTs" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether udts should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>