-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add relationships and reactive support to custom entity packages. (#1…
- Loading branch information
Showing
21 changed files
with
263 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ jobs: | |
id: build | ||
uses: ./.github/actions/build-matrix | ||
applications: | ||
name: ${{ matrix.app-sample }} | ||
name: ${{ matrix.suite }} | ||
runs-on: ${{ matrix.os }} | ||
needs: build-matrix | ||
defaults: | ||
|
@@ -80,59 +80,70 @@ jobs: | |
matrix: | ||
os: [ubuntu-20.04] | ||
cache: [angular] | ||
app-sample: | ||
suite: | ||
- webflux-mongodb | ||
- webflux-mongodb-es-session | ||
- webflux-mongodb-oauth2 | ||
- webflux-gateway-jwt | ||
- webflux-gateway-oauth2 | ||
- webflux-psql | ||
- webflux-psql-additional | ||
- webflux-mariadb-gradle | ||
- webflux-couchbase | ||
include: | ||
- app-sample: webflux-mongodb | ||
- suite: webflux-mongodb | ||
app-sample: webflux-mongodb | ||
entity: mongodb | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 1 | ||
- app-sample: webflux-mongodb-es-session | ||
- suite: webflux-mongodb-es-session | ||
app-sample: webflux-mongodb-es-session | ||
entity: mongodb | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 1 | ||
- app-sample: webflux-mongodb-oauth2 | ||
- suite: webflux-mongodb-oauth2 | ||
app-sample: webflux-mongodb-oauth2 | ||
entity: mongodb | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 1 | ||
- app-sample: webflux-gateway-jwt | ||
- suite: webflux-gateway-jwt | ||
app-sample: webflux-gateway-jwt | ||
entity: none | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 0 | ||
- app-sample: webflux-gateway-oauth2 | ||
- suite: webflux-gateway-oauth2 | ||
app-sample: webflux-gateway-oauth2 | ||
entity: none | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 1 | ||
- app-sample: webflux-psql | ||
- suite: webflux-psql | ||
app-sample: webflux-psql | ||
entity: sql | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 0 | ||
- app-sample: webflux-mariadb-gradle | ||
- suite: webflux-psql-additional | ||
jdl-sample: webflux-psql,custom-domain | ||
- suite: webflux-mariadb-gradle | ||
app-sample: webflux-mariadb-gradle | ||
entity: sqllight | ||
environment: prod | ||
war: 0 | ||
e2e: 1 | ||
testcontainers: 0 | ||
- app-sample: webflux-couchbase | ||
- suite: webflux-couchbase | ||
app-sample: webflux-couchbase | ||
entity: couchbase | ||
environment: prod | ||
war: 0 | ||
|
@@ -151,11 +162,12 @@ jobs: | |
id: setup | ||
uses: ./generator-jhipster/.github/actions/setup | ||
with: | ||
entities-sample: ${{ matrix.entity }} | ||
application-sample: ${{ matrix.app-sample }} | ||
application-environment: ${{ matrix.environment }} | ||
entities-sample: ${{ matrix.entity || 'none' }} | ||
jdl-sample: ${{ matrix.jdl-sample || '' }} | ||
application-sample: ${{ matrix.app-sample || 'jdl' }} | ||
application-environment: ${{ matrix.environment || 'prod' }} | ||
application-packaging: ${{ (matrix.war == 1 && 'war') || 'jar' }} | ||
enable-testcontainers: ${{ matrix.testcontainers == 1 }} | ||
enable-testcontainers: ${{ matrix.testcontainers != 0 }} | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: ${{ steps.setup.outputs.node-version }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ntity-server/templates/src/main/java/package/repository/EntitySqlHelper_reactive.java.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<%# | ||
Copyright 2013-2021 the original author or authors from the JHipster project. | ||
|
||
This file is part of the JHipster project, see https://www.jhipster.tech/ | ||
for more information. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
-%> | ||
package <%= entityAbsolutePackage %>.repository; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.springframework.data.relational.core.sql.Column; | ||
import org.springframework.data.relational.core.sql.Expression; | ||
import org.springframework.data.relational.core.sql.Table; | ||
|
||
public class <%= entityClass %>SqlHelper { | ||
|
||
public static List<Expression> getColumns(Table table, String columnPrefix) { | ||
List<Expression> columns = new ArrayList<>(); | ||
<%_ fields.forEach(function(field) { | ||
let col = field.fieldNameAsDatabaseColumn; | ||
_%> | ||
columns.add(Column.aliased("<%= col %>", table, columnPrefix + "_<%= col %>")); | ||
<%_ if ((field.fieldTypeBinary) && !field.blobContentTypeText) { _%> | ||
columns.add(Column.aliased("<%= col %>_content_type", table, columnPrefix + "_<%= col %>_content_type")); | ||
<%_ } _%> | ||
<%_ }); _%> | ||
|
||
<%_ reactiveRegularEagerRelations.forEach(function(rel) { _%> | ||
columns.add(Column.aliased("<%= getColumnName(rel.relationshipName) %>_id", table, columnPrefix + "_<%= getColumnName(rel.relationshipName) %>_id")); | ||
<%_ }); _%> | ||
return columns; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright 2013-2021 the original author or authors from the JHipster project. | ||
* | ||
* This file is part of the JHipster project, see https://www.jhipster.tech/ | ||
* for more information. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const { SERVER_MAIN_SRC_DIR } = require('../generator-constants'); | ||
|
||
const sqlFiles = { | ||
reactiveJavaUserManagement: [ | ||
{ | ||
condition: generator => generator.reactive && (!generator.skipUserManagement || generator.authenticationTypeOauth2), | ||
path: SERVER_MAIN_SRC_DIR, | ||
templates: [ | ||
{ | ||
file: 'package/repository/UserSqlHelper.java', | ||
renameTo: generator => `${generator.javaDir}repository/UserSqlHelper.java`, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
function writeSqlFiles() { | ||
return { | ||
async writeSqlFiles() { | ||
if (!this.databaseTypeSql) return; | ||
|
||
await this.writeFiles({ | ||
sections: sqlFiles, | ||
rootTemplatesPath: ['sql/reactive', 'sql'], | ||
}); | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
sqlFiles, | ||
writeSqlFiles, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.