Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isTable, isView and isNameEqualsI adapter props #34

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Modify your pom.xml as bellow and adjust necessary parameters:
<plugin>
<groupId>org.db2code</groupId>
<artifactId>java-pojo-generator-mojo</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
<configuration>
<jdbcUrl>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;INIT=RUNSCRIPT FROM '${project.basedir}/init.sql'</jdbcUrl>
<jdbcClassName>org.h2.Driver</jdbcClassName>
Expand Down Expand Up @@ -206,23 +206,28 @@ For example TABLE_SCHEM in metadata result set is available as tableSchem attrib
#### For CLASS_PER_TABLE strategy
- package
- className
- isTable
- isView
- properties
- isInTable
- isInView
- isNameEqualsId
- rawColumn - Data grabbed from ResultSetMetadata.getColumns Consult JDBC javadoc: https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getColumns-java.lang.String-java.lang.String-java.lang.String-java.lang.String-
- tableCat, tableSchem, tableName
- String columnName
- Integer dataType
- String typeName
- Integer columnSize
- Integer decimalDigits
- Integer numPrecRadix
- Integer nullable
- String remarks
- String columnDef
- Integer sqlDataType
- Integer sqlDatetimeSub
- Integer charOctetLength
- Integer ordinalPosition
- String isNullable
- tableCat, tableSchem, tableName
- String columnName
- Integer dataType
- String typeName
- Integer columnSize
- Integer decimalDigits
- Integer numPrecRadix
- Integer nullable
- String remarks
- String columnDef
- Integer sqlDataType
- Integer sqlDatetimeSub
- Integer charOctetLength
- Integer ordinalPosition
- String isNullable
- propertyType as resolved using typeMapFile configuration
- propertyName
- methodName
Expand Down Expand Up @@ -305,7 +310,7 @@ For example TABLE_SCHEM in metadata result set is available as tableSchem attrib
- parameters in case of procedure
- singleParameterReturn , parameter in case of procedure
- inputParameters in case of procedure
-

#### For SINGLE_FILE strategy
- targetPackage
- classes - see above all CLASS_PER_TABLE object is exposed
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</parent>

<artifactId>core</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions java-pojo-generator-abstract-tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</parent>

<properties>
Expand All @@ -22,7 +22,7 @@
<dependency>
<groupId>org.db2code</groupId>
<artifactId>java-pojo-generator</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
4 changes: 2 additions & 2 deletions java-pojo-generator-cmd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</parent>

<artifactId>java-pojo-generator-cmd</artifactId>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>org.db2code</groupId>
<artifactId>java-pojo-generator-abstract-tool</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions java-pojo-generator-mojo-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</parent>

<artifactId>java-pojo-generator-mojo-example</artifactId>
Expand Down Expand Up @@ -66,7 +66,7 @@
<plugin>
<groupId>org.db2code</groupId>
<artifactId>java-pojo-generator-mojo</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
<executions>
<execution>
<id>exportMetadata</id>
Expand Down
6 changes: 3 additions & 3 deletions java-pojo-generator-mojo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</parent>

<properties>
Expand All @@ -22,7 +22,7 @@
<dependency>
<groupId>org.db2code</groupId>
<artifactId>java-pojo-generator</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand All @@ -48,7 +48,7 @@
<dependency>
<groupId>org.db2code</groupId>
<artifactId>java-pojo-generator-abstract-tool</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions java-pojo-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
</parent>

<artifactId>java-pojo-generator</artifactId>
Expand Down Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>org.db2code</groupId>
<artifactId>core</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ public String getPackage() {
return targetPackage;
}

public Boolean getIsView() {
return rawTable.getTableType().equalsIgnoreCase("VIEW");
}

public Boolean getIsTable() {
return rawTable.getTableType().equalsIgnoreCase("TABLE");
}

public Collection<PropertyAdapter> getProperties() {
return properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ public boolean getIsId() {
return primaryKeyColumns.contains(rawColumn.getColumnName());
}

public boolean getIsNameEqualsId() {
return rawColumn.getColumnName().equalsIgnoreCase("ID");
}

public Boolean getIsInView() {
return rawTable.getTableType().equalsIgnoreCase("VIEW");
}

public Boolean getIsInTable() {
return rawTable.getTableType().equalsIgnoreCase("TABLE");
}

public Boolean getIsNullable() {
return "YES".equals(rawColumn.getIsNullable())
? Boolean.TRUE
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>org.db2code</groupId>
<artifactId>DB2Code</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>
<packaging>pom</packaging>
<name>DB2Code - code generator from database metadata</name>
<description>Puts database metadata into intermediate objects and invokes mustache template to generate code,
Expand Down
Loading