generator-jhipster 8.0.0-rc.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/cli/environment-builder.mjs +3 -3
- package/dist/cli/jhipster-command.mjs +7 -3
- package/dist/cli/program.mjs +1 -1
- package/dist/generators/angular/generator.mjs +8 -7
- package/dist/generators/angular/resources/package.json +10 -9
- package/dist/generators/angular/templates/package.json.ejs +4 -8
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +6 -10
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/service/_entityFile_.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/navbar.component.scss.ejs +1 -1
- package/dist/generators/angular/templates/webpack/webpack.microfrontend.js.ejs +48 -126
- package/dist/generators/app/support/config.mjs +3 -3
- package/dist/generators/base/generator.mjs +0 -3
- package/dist/generators/base/support/config.mjs +6 -6
- package/dist/generators/base/support/jhipster7-context.mjs +3 -3
- package/dist/generators/base-application/generator.mjs +2 -2
- package/dist/generators/base-application/support/enum.mjs +1 -1
- package/dist/generators/base-application/support/prepare-entity.mjs +14 -10
- package/dist/generators/base-application/support/prepare-field.mjs +11 -7
- package/dist/generators/base-application/support/prepare-relationship.mjs +12 -14
- package/dist/generators/base-workspaces/internal/docker-prompts.mjs +13 -12
- package/dist/generators/bootstrap/generator.mjs +64 -43
- package/dist/generators/bootstrap/support/auto-crlf-transform.mjs +34 -21
- package/dist/generators/bootstrap/support/eslint-transform.mjs +2 -5
- package/dist/generators/bootstrap/support/java-unused-imports-transform.mjs +2 -2
- package/dist/generators/bootstrap/support/multi-step-transform/index.mjs +17 -28
- package/dist/generators/bootstrap/support/multi-step-transform/template-file-fs.mjs +12 -6
- package/dist/generators/bootstrap/support/multi-step-transform/template-file.mjs +1 -0
- package/dist/generators/bootstrap/support/prettier-support.mjs +2 -2
- package/dist/generators/bootstrap-application/generator.mjs +10 -3
- package/dist/generators/bootstrap-application-base/generator.mjs +9 -6
- package/dist/generators/bootstrap-application-server/generator.mjs +2 -2
- package/dist/generators/client/resources/package.json +3 -3
- package/dist/generators/client/templates/src/main/webapp/content/css/loading.css.ejs +1 -1
- package/dist/generators/client/templates/webpack/webpack.microfrontend.js.jhi.ejs +14 -1
- package/dist/generators/common/files.mjs +1 -1
- package/dist/generators/common/generator.mjs +29 -7
- package/dist/generators/common/resources/package.json +3 -3
- package/dist/generators/common/templates/.lintstagedrc.cjs.ejs +21 -0
- package/dist/generators/common/templates/.prettierrc.ejs +1 -1
- package/dist/generators/common/templates/README.md.jhi.ejs +2 -0
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/settings-page.cy.ts.ejs +3 -0
- package/dist/generators/entity/prompts.mjs +123 -306
- package/dist/generators/generator-constants.mjs +5 -5
- package/dist/generators/heroku/generator.mjs +318 -595
- package/dist/generators/heroku/templates/Procfile.ejs +1 -1
- package/dist/generators/heroku/templates/application-heroku.yml.ejs +0 -12
- package/dist/generators/info/generator.mjs +6 -4
- package/dist/generators/init/generator.mjs +2 -2
- package/dist/generators/java/entity-files.mjs +1 -1
- package/dist/generators/java/generator.mjs +12 -13
- package/dist/generators/java/support/package-info-transform.mjs +20 -6
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +24 -28
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/enumeration/_enumName_.java.ejs +3 -3
- package/dist/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +86 -8
- package/dist/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_TestSamples.java.ejs +85 -0
- package/dist/generators/jdl/generator.mjs +14 -5
- package/dist/generators/kubernetes/templates/ingress.yml.ejs +0 -1
- package/dist/generators/languages/command.mjs +5 -0
- package/dist/generators/languages/generator.mjs +20 -13
- package/dist/generators/languages/translation-data.mjs +8 -13
- package/dist/generators/liquibase/generator.mjs +7 -3
- package/dist/generators/project-name/generator.mjs +1 -1
- package/dist/generators/react/generator.mjs +18 -10
- package/dist/generators/react/resources/package.json +19 -18
- package/dist/generators/react/templates/package.json.ejs +4 -5
- package/dist/generators/react/templates/src/main/webapp/app/config/icon-loader.ts.ejs +35 -33
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +7 -2
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/modules/home/home.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/routes.tsx.ejs +9 -2
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header-components.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs +5 -4
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/menus/entities.tsx.ejs +10 -1
- package/dist/generators/react/templates/tsconfig.test.json.ejs +1 -1
- package/dist/generators/react/templates/webpack/webpack.microfrontend.js.jhi.react.ejs +13 -58
- package/dist/generators/server/generator.mjs +13 -4
- package/dist/generators/server/resources/Dockerfile +7 -7
- package/dist/generators/server/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/server/resources/pom.xml +11 -11
- package/dist/generators/server/support/config.mjs +4 -4
- package/dist/generators/server/support/prepare-entity.mjs +5 -5
- package/dist/generators/server/support/prepare-field.mjs +20 -0
- package/dist/generators/server/support/relationship.mjs +2 -1
- package/dist/generators/server/support/templates/field-values.mjs +5 -2
- package/dist/generators/server/templates/README.md.jhi.spring-boot.ejs +0 -1
- package/dist/generators/server/templates/package.json.ejs +0 -5
- package/dist/generators/server/templates/pom.xml.ejs +1 -8
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/_partials_entity_/get_all_template.ejs +3 -3
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/dto/_dtoClass_.java.ejs +2 -2
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/web/rest/_entityClass_Resource.java.ejs +11 -11
- package/dist/generators/server/templates/src/main/java/_package_/config/JacksonConfiguration.java.ejs +2 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +2 -0
- package/dist/generators/server/templates/src/main/java/_package_/service/MailService.java.ejs +10 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/PublicUserResource.java.ejs +3 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/UserResource.java.ejs +0 -2
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/errors/ExceptionTranslator.java.ejs +4 -7
- package/dist/generators/server/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +3 -3
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +4 -4
- package/dist/generators/spring-data-elasticsearch/templates/src/main/java/_package_/_entityPackage_/repository/search/_entityClass_SearchRepository.java.ejs +0 -2
- package/dist/generators/spring-data-neo4j/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.spring_data_neo4j.ejs +3 -37
- package/dist/generators/vue/generator.mjs +25 -16
- package/dist/generators/vue/resources/package.json +17 -16
- package/dist/generators/vue/templates/package.json.ejs +3 -5
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +10 -3
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +3 -4
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +12 -0
- package/dist/generators/vue/templates/src/main/webapp/app/router/index.ts.ejs +8 -1
- package/dist/generators/vue/templates/webpack/webpack.microfrontend.js.jhi.vue.ejs +19 -34
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-option-converter.js +2 -2
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js +1 -1
- package/dist/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +1 -1
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/application-converter.js +1 -17
- package/dist/jdl/exporters/applications/jhipster-application-formatter.js +17 -1
- package/dist/jdl/exporters/config.js +11 -0
- package/dist/jdl/exporters/export-utils.js +2 -13
- package/dist/jdl/index.js +1 -0
- package/dist/jdl/jdl-importer.js +6 -2
- package/dist/jdl/models/jdl-application-configuration-factory.js +34 -2
- package/dist/jdl/models/jdl-application-configuration.js +6 -3
- package/dist/jdl/models/jdl-application-factory.js +2 -2
- package/dist/jdl/models/jdl-application.js +12 -3
- package/dist/jdl/parsing/jdl-ast-builder-visitor.js +63 -7
- package/dist/jdl/parsing/jdl-parser.js +52 -6
- package/dist/jdl/parsing/lexer/application-tokens.js +1 -1
- package/dist/jdl/validators/entity-validator.js +4 -2
- package/dist/jdl/validators/enum-validator.js +4 -2
- package/dist/jdl/validators/jdl-with-application-validator.js +18 -8
- package/dist/jdl/validators/jdl-without-application-validator.js +30 -29
- package/dist/jdl/validators/validator.js +1 -1
- package/dist/types/generators/base/support/config.d.mts +3 -3
- package/dist/types/generators/base-application/support/prepare-entity.d.mts +6 -1
- package/dist/types/generators/bootstrap/support/auto-crlf-transform.d.mts +3 -2
- package/dist/types/generators/bootstrap/support/multi-step-transform/index.d.mts +3 -20
- package/dist/types/generators/bootstrap/support/multi-step-transform/template-file-fs.d.mts +15 -9
- package/dist/types/generators/bootstrap/support/multi-step-transform/template-file.d.mts +1 -0
- package/dist/types/generators/generator-constants.d.mts +3 -3
- package/dist/types/generators/java/support/package-info-transform.d.mts +1 -4
- package/dist/types/generators/server/support/templates/field-values.d.mts +1 -1
- package/dist/types/jdl/exporters/config.d.ts +1 -0
- package/dist/types/jdl/index.d.ts +1 -0
- package/dist/types/jdl/jdl-importer.d.ts +1 -0
- package/dist/types/jdl/models/jdl-application-configuration-factory.d.ts +1 -0
- package/dist/types/jdl/models/jdl-application-configuration-option.d.ts +2 -2
- package/dist/types/jdl/models/jdl-application-configuration.d.ts +8 -6
- package/dist/types/jdl/models/jdl-application-factory.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application.d.ts +8 -4
- package/dist/types/jdl/models/jdl-object.d.ts +1 -1
- package/dist/types/jdl/models/list-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/parsing/jdl-ast-builder-visitor.d.ts +10 -0
- package/dist/types/jdl/parsing/jdl-parser.d.ts +3 -0
- package/dist/types/jdl/parsing/lexer/application-tokens.d.ts +1 -0
- package/dist/types/jdl/validators/entity-validator.d.ts +2 -2
- package/dist/types/jdl/validators/enum-validator.d.ts +2 -2
- package/dist/types/jdl/validators/validator.d.ts +4 -1
- package/package.json +31 -31
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
See the License for the specific language governing permissions and
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
|
-
web: java $JAVA_OPTS <% if (applicationTypeGateway || dynoSize === '
|
|
19
|
+
web: java $JAVA_OPTS <% if (applicationTypeGateway || dynoSize === 'Basic') { %>-Xmx256m<% } %> -jar <% if (buildToolMaven) { %>target<% } %><% if (buildToolGradle) { %>build/libs<% } %>/*.jar --spring.profiles.active=prod,heroku<% if (databaseTypeMongodb) { %> --spring.data.mongodb.database=$(echo "$MONGODB_URI" | sed "s/^.*:[0-9]*\///g")<% } %>
|
|
@@ -78,17 +78,5 @@ spring:
|
|
|
78
78
|
elasticsearch:
|
|
79
79
|
uris: ${BONSAI_URL}
|
|
80
80
|
<%_ } _%>
|
|
81
|
-
<%_ if (useOkta) { _%>
|
|
82
|
-
security:
|
|
83
|
-
oauth2:
|
|
84
|
-
client:
|
|
85
|
-
provider:
|
|
86
|
-
oidc:
|
|
87
|
-
issuer-uri: ${OKTA_OAUTH2_ISSUER}
|
|
88
|
-
registration:
|
|
89
|
-
oidc:
|
|
90
|
-
client-id: ${OKTA_OAUTH2_CLIENT_ID_WEB}
|
|
91
|
-
client-secret: ${OKTA_OAUTH2_CLIENT_SECRET_WEB}
|
|
92
|
-
<%_ } _%>
|
|
93
81
|
server:
|
|
94
82
|
port: ${PORT:8080}
|
|
@@ -25,13 +25,14 @@ import JSONToJDLEntityConverter from '../../jdl/converters/json-to-jdl-entity-co
|
|
|
25
25
|
import JSONToJDLOptionConverter from '../../jdl/converters/json-to-jdl-option-converter.js';
|
|
26
26
|
import { YO_RC_FILE } from '../generator-constants.mjs';
|
|
27
27
|
import { replaceSensitiveConfig } from './support/utils.mjs';
|
|
28
|
+
const isInfoCommand = commandName => commandName === 'info' || undefined;
|
|
28
29
|
export default class InfoGenerator extends BaseApplicationGenerator {
|
|
29
30
|
constructor(args, options, features) {
|
|
30
31
|
super(args, options, {
|
|
31
32
|
jhipsterBootstrap: false,
|
|
32
33
|
storeJHipsterVersion: false,
|
|
33
|
-
customInstallTask: options.commandName
|
|
34
|
-
customCommitTask:
|
|
34
|
+
customInstallTask: isInfoCommand(options.commandName),
|
|
35
|
+
customCommitTask: isInfoCommand(options.commandName),
|
|
35
36
|
...features,
|
|
36
37
|
});
|
|
37
38
|
}
|
|
@@ -55,8 +56,9 @@ export default class InfoGenerator extends BaseApplicationGenerator {
|
|
|
55
56
|
else {
|
|
56
57
|
console.log('\n##### **JHipster configuration not found**\n');
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const packages = this.jhipsterConfig.appsFolders ?? this.jhipsterConfig.packages ?? [];
|
|
60
|
+
if (packages.length > 0) {
|
|
61
|
+
for (const pkg of packages) {
|
|
60
62
|
const yoRc = this.readDestinationJSON(this.destinationPath(pkg, YO_RC_FILE));
|
|
61
63
|
if (yoRc) {
|
|
62
64
|
const result = JSON.stringify(replaceSensitiveConfig(yoRc), null, 2);
|
|
@@ -96,8 +96,8 @@ export default class InitGenerator extends BaseApplicationGenerator {
|
|
|
96
96
|
addPrettierDependencies({ application }) {
|
|
97
97
|
this.packageJson.merge({
|
|
98
98
|
scripts: {
|
|
99
|
-
'prettier-check': 'prettier --check "{
|
|
100
|
-
'prettier-format': 'prettier --write "{
|
|
99
|
+
'prettier-check': 'prettier --check "{,**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java}"',
|
|
100
|
+
'prettier-format': 'prettier --write "{,**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java}"',
|
|
101
101
|
},
|
|
102
102
|
devDependencies: {
|
|
103
103
|
prettier: application.nodeDependencies.prettier,
|
|
@@ -7,7 +7,7 @@ export const entityServerFiles = {
|
|
|
7
7
|
],
|
|
8
8
|
modelTestFiles: [
|
|
9
9
|
javaTestPackageTemplatesBlock({
|
|
10
|
-
templates: ['_entityPackage_/domain/_persistClass_Test.java'],
|
|
10
|
+
templates: ['_entityPackage_/domain/_persistClass_Test.java', '_entityPackage_/domain/_persistClass_TestSamples.java'],
|
|
11
11
|
}),
|
|
12
12
|
],
|
|
13
13
|
server: [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { isFileStateModified } from 'mem-fs-editor/state';
|
|
20
20
|
import BaseApplicationGenerator from '../base-application/index.mjs';
|
|
21
21
|
import { GENERATOR_JAVA, GENERATOR_BOOTSTRAP_APPLICATION } from '../generator-list.mjs';
|
|
22
22
|
import writeTask from './files.mjs';
|
|
@@ -59,18 +59,22 @@ export default class JavaGenerator extends BaseApplicationGenerator {
|
|
|
59
59
|
return this.asDefaultTaskGroup({
|
|
60
60
|
generatedAnnotation({ application }) {
|
|
61
61
|
if (this.jhipsterConfig.withGeneratedFlag) {
|
|
62
|
-
this.queueTransformStream(
|
|
62
|
+
this.queueTransformStream({
|
|
63
63
|
name: 'adding @GeneratedByJHipster annotations',
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
filter: file => isFileStateModified(file) && file.path.startsWith(this.destinationPath()) && file.path.endsWith('.java'),
|
|
65
|
+
refresh: false,
|
|
66
|
+
}, generatedAnnotationTransform(application.packageName));
|
|
66
67
|
}
|
|
67
68
|
},
|
|
68
69
|
generatedPackageInfo({ application }) {
|
|
69
70
|
const mainPackageMatch = matchMainJavaFiles(application.srcMainJava);
|
|
70
71
|
if (this.packageInfoFile) {
|
|
71
|
-
this.queueTransformStream(
|
|
72
|
+
this.queueTransformStream({
|
|
73
|
+
name: 'adding package-info.java files',
|
|
74
|
+
filter: file => isFileStateModified(file) && file.path.startsWith(this.destinationPath()) && mainPackageMatch.match(file.path),
|
|
75
|
+
refresh: true,
|
|
76
|
+
}, packageInfoTransform({
|
|
72
77
|
javaRoots: [this.destinationPath(application.srcMainJava)],
|
|
73
|
-
editor: this.fs,
|
|
74
78
|
javadocs: {
|
|
75
79
|
...Object.fromEntries(application.packageInfoJavadocs.map(doc => [doc.packageName, doc.documentation])),
|
|
76
80
|
[`${application.packageName}`]: 'Application root.',
|
|
@@ -80,12 +84,7 @@ export default class JavaGenerator extends BaseApplicationGenerator {
|
|
|
80
84
|
[`${application.packageName}.service`]: 'Service layer.',
|
|
81
85
|
[`${application.packageName}.web.rest`]: 'Rest layer.',
|
|
82
86
|
},
|
|
83
|
-
})
|
|
84
|
-
name: 'adding package-info.java files',
|
|
85
|
-
streamOptions: {
|
|
86
|
-
filter: file => isFilePending(file) && !file.path.endsWith('package-info.java') && mainPackageMatch.match(file.path),
|
|
87
|
-
},
|
|
88
|
-
});
|
|
87
|
+
}));
|
|
89
88
|
}
|
|
90
89
|
},
|
|
91
90
|
});
|
|
@@ -116,7 +115,7 @@ export default class JavaGenerator extends BaseApplicationGenerator {
|
|
|
116
115
|
}
|
|
117
116
|
},
|
|
118
117
|
async writeEnumFiles({ application, entities }) {
|
|
119
|
-
if (!this.generateEnums
|
|
118
|
+
if (!this.generateEnums)
|
|
120
119
|
return;
|
|
121
120
|
for (const entity of entities.filter(entity => !entity.skipServer)) {
|
|
122
121
|
for (const field of entity.fields.filter(field => field.fieldIsEnum)) {
|
|
@@ -17,24 +17,38 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { dirname, join, relative } from 'path';
|
|
20
|
-
import { passthrough } from '
|
|
20
|
+
import { passthrough } from 'p-transform';
|
|
21
|
+
import { loadFile } from 'mem-fs';
|
|
21
22
|
import { Minimatch } from 'minimatch';
|
|
23
|
+
import { setModifiedFileState } from 'mem-fs-editor/state';
|
|
22
24
|
const DEFAULT_DOC = 'This package file was generated by JHipster';
|
|
23
|
-
const packageInfoTransform = ({ javaRoots,
|
|
25
|
+
const packageInfoTransform = ({ javaRoots, javadocs }) => {
|
|
26
|
+
const existingPackageInfoFiles = [];
|
|
24
27
|
return passthrough(function (file) {
|
|
28
|
+
if (file.path.endsWith('package-info.java')) {
|
|
29
|
+
existingPackageInfoFiles.push(file.path);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
25
32
|
for (const root of javaRoots) {
|
|
26
33
|
if (file.path.startsWith(root)) {
|
|
27
34
|
const directory = dirname(file.path);
|
|
28
35
|
const packageName = relative(root, directory).replaceAll(/[/\\]/g, '.');
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
const packageInfoFilePath = join(directory, 'package-info.java');
|
|
37
|
+
if (existingPackageInfoFiles.includes(packageInfoFilePath)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const packageInfoFile = loadFile(packageInfoFilePath);
|
|
41
|
+
if (!packageInfoFile.contents) {
|
|
42
|
+
const packageJavadoc = javadocs?.[packageName] ?? DEFAULT_DOC;
|
|
43
|
+
packageInfoFile.contents = Buffer.from(`/**
|
|
33
44
|
* ${packageJavadoc}
|
|
34
45
|
*/
|
|
35
46
|
package ${packageName};
|
|
36
47
|
`);
|
|
48
|
+
setModifiedFileState(packageInfoFile);
|
|
49
|
+
this.push(packageInfoFile);
|
|
37
50
|
}
|
|
51
|
+
existingPackageInfoFiles.push(packageInfoFilePath);
|
|
38
52
|
}
|
|
39
53
|
}
|
|
40
54
|
});
|
|
@@ -54,7 +54,7 @@ package <%= entityAbsolutePackage %>.domain;
|
|
|
54
54
|
<%_ if (relationshipsContainOtherSideIgnore) { _%>
|
|
55
55
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
56
56
|
<%_ } _%>
|
|
57
|
-
<%_ if (!dtoMapstruct && (
|
|
57
|
+
<%_ if (!dtoMapstruct && (entityApiDescription || importApiModelProperty)) { _%>
|
|
58
58
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
59
59
|
<%_ } _%>
|
|
60
60
|
|
|
@@ -85,15 +85,15 @@ import <%= entityAbsolutePackage %>.domain.enumeration.<%= element %>;
|
|
|
85
85
|
import <%= otherEntity.entityAbsoluteClass %>;
|
|
86
86
|
<%_ } _%>
|
|
87
87
|
|
|
88
|
-
<%_ if (
|
|
88
|
+
<%_ if (entityJavadoc) { _%>
|
|
89
|
+
<%- entityJavadoc %>
|
|
90
|
+
<%_ } else { _%>
|
|
89
91
|
/**
|
|
90
92
|
* A <%= persistClass %>.
|
|
91
93
|
*/
|
|
92
|
-
<%_ }
|
|
93
|
-
|
|
94
|
-
<%_ if (!dtoMapstruct) { _%>
|
|
94
|
+
<%_ } _%>
|
|
95
|
+
<%_ if (!dtoMapstruct && entityApiDescription) { _%>
|
|
95
96
|
@Schema(description = "<%- entityApiDescription %>")
|
|
96
|
-
<%_ } _%>
|
|
97
97
|
<%_ } _%>
|
|
98
98
|
<&- fragments.annotationSection() -&>
|
|
99
99
|
@SuppressWarnings("common-java:DuplicatedBlocks")
|
|
@@ -111,10 +111,10 @@ public class <%= persistClass %> <&- fragments.extendsSection() -&>implements Se
|
|
|
111
111
|
<%_ for (const field of fields.filter(field => !field.javaInherited && !field.transient && (embedded || !field.id || !primaryKey.composite))) { _%>
|
|
112
112
|
<&- fragments.field<%- field.fieldNameCapitalized %>CustomDeclarationSection() -&>
|
|
113
113
|
<&_ if (!fragments.field<%- field.fieldNameCapitalized %>CustomDeclarationSection()) { -&>
|
|
114
|
-
<%_ if (
|
|
114
|
+
<%_ if (field.fieldJavadoc) { _%>
|
|
115
115
|
<%- field.fieldJavadoc %>
|
|
116
116
|
<%_ } _%>
|
|
117
|
-
<%_ if (!dtoMapstruct &&
|
|
117
|
+
<%_ if (!dtoMapstruct && field.fieldApiDescription) { _%>
|
|
118
118
|
@Schema(description = "<%- field.fieldApiDescription %>"<% if (field.fieldValidationRequired) { %>, required = true<% } %>)
|
|
119
119
|
<%_ } _%>
|
|
120
120
|
<&- fragments.field<%- field.fieldNameCapitalized %>AnnotationSection() -&>
|
|
@@ -132,9 +132,9 @@ public class <%= persistClass %> <&- fragments.extendsSection() -&>implements Se
|
|
|
132
132
|
<%_
|
|
133
133
|
// An embedded entity should not reference entities that embed it, unless the other entities are also embedded
|
|
134
134
|
for (relationship of relationships.filter(relationship => !relationship.embedded || relationship.otherEntity.embedded || relationship.ownerSide)) {
|
|
135
|
-
if (typeof relationship.
|
|
135
|
+
if (typeof relationship.fieldApiDescription) { _%>
|
|
136
136
|
<%- relationship.relationshipJavadoc %>
|
|
137
|
-
<%_ if (!dtoMapstruct) { _%>
|
|
137
|
+
<%_ if (!dtoMapstruct && relationship.relationshipyApiDescription) { _%>
|
|
138
138
|
@Schema(description = "<%- relationship.relationshipyApiDescription %>")
|
|
139
139
|
<%_ } _%>
|
|
140
140
|
<%_ } _%>
|
|
@@ -240,16 +240,16 @@ _%>
|
|
|
240
240
|
<&_ if (!fragments.relationship<%- relationship.relationshipNameCapitalized %>CustomSetSection()) { -&>
|
|
241
241
|
<%_ if (relationship.collection) { _%>
|
|
242
242
|
public void set<%= relationship.relationshipNameCapitalizedPlural %>(Set<<%= relationship.otherEntity.persistClass %>> <%= relationship.otherEntityNamePlural %>) {
|
|
243
|
-
<%_ if (relationship.otherRelationship &&
|
|
243
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference) { _%>
|
|
244
244
|
if (this.<%= relationship.relationshipFieldNamePlural %> != null) {
|
|
245
|
-
<%_ if (relationship.otherRelationship.
|
|
245
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
246
246
|
this.<%= relationship.relationshipFieldNamePlural %>.forEach(i -> i.remove<%= relationship.otherRelationship.relationshipNameCapitalized %>(this));
|
|
247
247
|
<%_ } else { _%>
|
|
248
248
|
this.<%= relationship.relationshipFieldNamePlural %>.forEach(i -> i.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(null));
|
|
249
249
|
<%_ } _%>
|
|
250
250
|
}
|
|
251
251
|
if (<%= relationship.otherEntityNamePlural %> != null) {
|
|
252
|
-
<%_ if (relationship.otherRelationship.
|
|
252
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
253
253
|
<%= relationship.otherEntityNamePlural %>.forEach(i -> i.add<%= relationship.otherRelationship.relationshipNameCapitalized %>(this));
|
|
254
254
|
<%_ } else { _%>
|
|
255
255
|
<%= relationship.otherEntityNamePlural %>.forEach(i -> i.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(this));
|
|
@@ -260,16 +260,16 @@ _%>
|
|
|
260
260
|
}
|
|
261
261
|
<%_ } else { _%>
|
|
262
262
|
public void set<%= relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistClass %> <%= relationship.otherEntityName %>) {
|
|
263
|
-
<%_ if (relationship.otherRelationship &&
|
|
263
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference) { _%>
|
|
264
264
|
if (this.<%= relationship.relationshipFieldName %> != null) {
|
|
265
|
-
<%_ if (relationship.otherRelationship.
|
|
265
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
266
266
|
this.<%= relationship.relationshipFieldName %>.remove<%= relationship.otherRelationship.relationshipNameCapitalized %>(this);
|
|
267
267
|
<%_ } else { _%>
|
|
268
268
|
this.<%= relationship.relationshipFieldName %>.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(null);
|
|
269
269
|
<%_ } _%>
|
|
270
270
|
}
|
|
271
271
|
if (<%= relationship.otherEntityName %> != null) {
|
|
272
|
-
<%_ if (relationship.otherRelationship.
|
|
272
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
273
273
|
<%= relationship.otherEntityName %>.add<%= relationship.otherRelationship.relationshipNameCapitalized %>(this);
|
|
274
274
|
<%_ } else { _%>
|
|
275
275
|
<%= relationship.otherEntityName %>.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(this);
|
|
@@ -292,13 +292,11 @@ _%>
|
|
|
292
292
|
<&_ if (!fragments.relationship<%- relationship.relationshipNameCapitalized %>CustomAddSection()) { -&>
|
|
293
293
|
public <%= persistClass %> add<%= relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistClass %> <%= relationship.otherEntityName %>) {
|
|
294
294
|
this.<%= relationship.relationshipFieldNamePlural %>.add(<%= relationship.otherEntityName %>);
|
|
295
|
-
<%_ if (
|
|
296
|
-
<%_ if (relationship.otherRelationship) { _%>
|
|
297
|
-
<%_ if (!relationship.otherRelationship.collection) { _%>
|
|
298
|
-
<%= relationship.otherEntityName %>.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(this);
|
|
299
|
-
<%_ } else if (relationship.otherRelationship.relationshipNamePlural && !relationship.otherEntityUser && relationship.otherRelationship.collection) { _%>
|
|
295
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference) { _%>
|
|
296
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
300
297
|
<%= relationship.otherEntityName %>.get<%= relationship.otherRelationship.relationshipNameCapitalizedPlural %>().add(this);
|
|
301
|
-
|
|
298
|
+
<%_ } else { _%>
|
|
299
|
+
<%= relationship.otherEntityName %>.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(this);
|
|
302
300
|
<%_ } _%>
|
|
303
301
|
<%_ } _%>
|
|
304
302
|
return this;
|
|
@@ -309,13 +307,11 @@ _%>
|
|
|
309
307
|
<&_ if (!fragments.relationship<%- relationship.relationshipNameCapitalized %>CustomRemoveSection()) { -&>
|
|
310
308
|
public <%= persistClass %> remove<%= relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistClass %> <%= relationship.otherEntityName %>) {
|
|
311
309
|
this.<%= relationship.relationshipFieldNamePlural %>.remove(<%= relationship.otherEntityName %>);
|
|
312
|
-
<%_ if (
|
|
313
|
-
<%_ if (relationship.otherRelationship) { _%>
|
|
314
|
-
<%_ if (!relationship.otherRelationship.collection) { _%>
|
|
315
|
-
<%= relationship.otherEntityName %>.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(null);
|
|
316
|
-
<%_ } else if (!relationship.otherEntityUser && relationship.otherRelationship.collection) { _%>
|
|
310
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference) { _%>
|
|
311
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
317
312
|
<%= relationship.otherEntityName %>.get<%= relationship.otherRelationship.relationshipNameCapitalizedPlural %>().remove(this);
|
|
318
|
-
|
|
313
|
+
<%_ } else { _%>
|
|
314
|
+
<%= relationship.otherEntityName %>.set<%= relationship.otherRelationship.relationshipNameCapitalized %>(null);
|
|
319
315
|
<%_ } _%>
|
|
320
316
|
<%_ } _%>
|
|
321
317
|
return this;
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= entityAbsolutePackage %>.domain.enumeration;
|
|
20
20
|
|
|
21
|
-
<%_ if (
|
|
21
|
+
<%_ if (enumJavadoc) { _%>
|
|
22
|
+
<%- enumJavadoc %>
|
|
23
|
+
<%_ } else { _%>
|
|
22
24
|
/**
|
|
23
25
|
* The <%= enumName %> enumeration.
|
|
24
26
|
*/
|
|
25
|
-
<%_ } else { _%>
|
|
26
|
-
<%= javadoc %>
|
|
27
27
|
<%_ } _%>
|
|
28
28
|
public enum <%= enumName %> {
|
|
29
29
|
<%_ if (withoutCustomValues) { _%>
|
|
@@ -18,12 +18,20 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= entityAbsolutePackage %>.domain;
|
|
20
20
|
|
|
21
|
+
import static <%= entityAbsolutePackage %>.domain.<%= persistClass %>TestSamples.*;
|
|
22
|
+
<%_ for (const otherEntity of otherEntities.filter(otherEntity => !otherEntity.builtIn)) { _%>
|
|
23
|
+
import static <%= otherEntity.entityAbsolutePackage %>.domain.<%= otherEntity.persistClass %>TestSamples.*;
|
|
24
|
+
<%_ } _%>
|
|
25
|
+
<%_ for (const otherEntity of otherEntities.filter(otherEntity => entityPackage !== otherEntity.entityPackage)) { _%>
|
|
26
|
+
import <%= otherEntity.entityAbsolutePackage %>.domain.<%= otherEntity.persistClass %>;
|
|
27
|
+
<%_ } _%>
|
|
28
|
+
<%_ if (relationships.some(relationship => relationship.collection)) { _%>
|
|
29
|
+
import java.util.HashSet;
|
|
30
|
+
import java.util.Set;
|
|
31
|
+
<%_ } _%>
|
|
21
32
|
import org.junit.jupiter.api.Test;
|
|
22
33
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
23
34
|
import <%= packageName %>.web.rest.TestUtil;
|
|
24
|
-
<%_ if (primaryKey && primaryKey.hasUUID) { _%>
|
|
25
|
-
import java.util.UUID;
|
|
26
|
-
<%_ } _%>
|
|
27
35
|
|
|
28
36
|
class <%= persistClass %>Test {
|
|
29
37
|
|
|
@@ -31,15 +39,85 @@ class <%= persistClass %>Test {
|
|
|
31
39
|
void equalsVerifier() throws Exception {
|
|
32
40
|
TestUtil.equalsVerifier(<%= persistClass %>.class);
|
|
33
41
|
<%_if (!embedded) { _%>
|
|
34
|
-
<%= persistClass %> <%= persistInstance %>1 =
|
|
35
|
-
<%= persistInstance %>1.set<%= primaryKey.nameCapitalized %>(<% if (primaryKey.typeInteger) { %>1<% } else if (primaryKey.typeLong) { %>1L<% } else if (primaryKey.typeString) { %>"id1"<% } else if (primaryKey.typeUUID) { %>UUID.randomUUID()<% } %>);
|
|
42
|
+
<%= persistClass %> <%= persistInstance %>1 = get<%= persistClass %>Sample1();
|
|
36
43
|
<%= persistClass %> <%= persistInstance %>2 = new <%= persistClass %>();
|
|
44
|
+
assertThat(<%= persistInstance %>1).isNotEqualTo(<%= persistInstance %>2);
|
|
45
|
+
|
|
37
46
|
<%= persistInstance %>2.set<%= primaryKey.nameCapitalized %>(<%= persistInstance %>1.get<%= primaryKey.nameCapitalized %>());
|
|
38
47
|
assertThat(<%= persistInstance %>1).isEqualTo(<%= persistInstance %>2);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<%= persistInstance %>1.set<%= primaryKey.nameCapitalized %>(null);
|
|
48
|
+
|
|
49
|
+
<%= persistInstance %>2 = get<%= persistClass %>Sample2();
|
|
42
50
|
assertThat(<%= persistInstance %>1).isNotEqualTo(<%= persistInstance %>2);
|
|
43
51
|
<%_} _%>
|
|
44
52
|
}
|
|
53
|
+
<%_ for (const relationship of relationships.filter(relationship => !relationship.otherEntity.builtIn)) { _%>
|
|
54
|
+
|
|
55
|
+
@Test
|
|
56
|
+
void <%- relationship.relationshipName %>Test() throws Exception {
|
|
57
|
+
<%= persistClass %> <%= persistInstance %> = get<%= persistClass %>RandomSampleGenerator();
|
|
58
|
+
<%= relationship.otherEntity.persistClass %> <%= relationship.otherEntity.persistInstance %>Back = get<%= relationship.otherEntity.persistClass %>RandomSampleGenerator();
|
|
59
|
+
<%_ if (relationship.collection) { _%>
|
|
60
|
+
|
|
61
|
+
<%= persistInstance %>.add<%- relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistInstance %>Back);
|
|
62
|
+
assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).containsOnly(<%= relationship.otherEntity.persistInstance %>Back);
|
|
63
|
+
<%_ } else { _%>
|
|
64
|
+
|
|
65
|
+
<%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(<%= relationship.otherEntity.persistInstance %>Back);
|
|
66
|
+
assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).isEqualTo(<%= relationship.otherEntity.persistInstance %>Back);
|
|
67
|
+
<%_ } _%>
|
|
68
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference && !relationship.otherEntity.embedded) { _%>
|
|
69
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
70
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).containsOnly(<%= persistInstance %>);
|
|
71
|
+
<%_ } else { _%>
|
|
72
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).isEqualTo(<%= persistInstance %>);
|
|
73
|
+
<%_ } _%>
|
|
74
|
+
<%_ } _%>
|
|
75
|
+
<%_ if (relationship.collection) { _%>
|
|
76
|
+
|
|
77
|
+
<%= persistInstance %>.remove<%- relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistInstance %>Back);
|
|
78
|
+
assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).doesNotContain(<%= relationship.otherEntity.persistInstance %>Back);
|
|
79
|
+
<%_ } else { _%>
|
|
80
|
+
|
|
81
|
+
<%_ if (fluentMethods) { _%>
|
|
82
|
+
<%= persistInstance %>.<%- relationship.propertyName %>(null);
|
|
83
|
+
<%_ } else { _%>
|
|
84
|
+
<%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(null);
|
|
85
|
+
<%_ } _%>
|
|
86
|
+
assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).isNull();
|
|
87
|
+
<%_ } _%>
|
|
88
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference && !relationship.otherEntity.embedded) { _%>
|
|
89
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
90
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).doesNotContain(<%= persistInstance %>);
|
|
91
|
+
<%_ } else { _%>
|
|
92
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).isNull();
|
|
93
|
+
<%_ } _%>
|
|
94
|
+
<%_ } _%>
|
|
95
|
+
<%_ if (relationship.collection) { _%>
|
|
96
|
+
|
|
97
|
+
<%_ if (fluentMethods) { _%>
|
|
98
|
+
<%= persistInstance %>.<%- relationship.propertyName %>(new HashSet<>(Set.of(<%= relationship.otherEntity.persistInstance %>Back)));
|
|
99
|
+
<%_ } else { _%>
|
|
100
|
+
<%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(new HashSet<>(Set.of(<%= relationship.otherEntity.persistInstance %>Back)));
|
|
101
|
+
<%_ } _%>
|
|
102
|
+
assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).containsOnly(<%= relationship.otherEntity.persistInstance %>Back);
|
|
103
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference && !relationship.otherEntity.embedded) { _%>
|
|
104
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
105
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).containsOnly(<%= persistInstance %>);
|
|
106
|
+
<%_ } else { _%>
|
|
107
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).isEqualTo(<%= persistInstance %>);
|
|
108
|
+
<%_ } _%>
|
|
109
|
+
<%_ } _%>
|
|
110
|
+
|
|
111
|
+
<%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(new HashSet<>());
|
|
112
|
+
assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).doesNotContain(<%= relationship.otherEntity.persistInstance %>Back);
|
|
113
|
+
<%_ if (relationship.otherRelationship && relationship.relationshipUpdateBackReference && !relationship.otherEntity.embedded) { _%>
|
|
114
|
+
<%_ if (relationship.otherRelationship.collection) { _%>
|
|
115
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).doesNotContain(<%= persistInstance %>);
|
|
116
|
+
<%_ } else { _%>
|
|
117
|
+
assertThat(<%= relationship.otherEntity.persistInstance %>Back.get<%- relationship.otherRelationship.propertyNameCapitalized %>()).isNull();
|
|
118
|
+
<%_ } _%>
|
|
119
|
+
<%_ } _%>
|
|
120
|
+
<%_ } _%>
|
|
121
|
+
}
|
|
122
|
+
<%_ } _%>
|
|
45
123
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2023 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
package <%= entityAbsolutePackage %>.domain;
|
|
20
|
+
|
|
21
|
+
import org.junit.jupiter.api.Test;
|
|
22
|
+
import static org.assertj.core.api.Assertions.assertThat;
|
|
23
|
+
import <%= packageName %>.web.rest.TestUtil;
|
|
24
|
+
<%_ if (fields.some(field => field.fieldTypeString) || fields.some(field => field.fieldTypeUUID)) { _%>
|
|
25
|
+
import java.util.UUID;
|
|
26
|
+
<%_ } _%>
|
|
27
|
+
<%_ if (fields.some(field => field.fieldTypeLong || field.fieldTypeInteger)) { _%>
|
|
28
|
+
import java.util.Random;
|
|
29
|
+
<%_ } _%>
|
|
30
|
+
<%_ if (fields.some(field => field.fieldTypeLong)) { _%>
|
|
31
|
+
import java.util.concurrent.atomic.AtomicLong;
|
|
32
|
+
<%_ } _%>
|
|
33
|
+
<%_ if (fields.some(field => field.fieldTypeInteger)) { _%>
|
|
34
|
+
import java.util.concurrent.atomic.AtomicInteger;
|
|
35
|
+
<%_ } _%>
|
|
36
|
+
|
|
37
|
+
<%_ const sampleFields = fields.filter(field => !field.mapstructExpression && (field.fieldTypeInteger || field.fieldTypeLong || field.fieldTypeString || field.fieldTypeUUID)); _%>
|
|
38
|
+
public class <%= persistClass %>TestSamples {
|
|
39
|
+
|
|
40
|
+
<%_ if (fields.some(field => field.fieldTypeLong || field.fieldTypeInteger)) { _%>
|
|
41
|
+
private static final Random random = new Random();
|
|
42
|
+
<%_ } _%>
|
|
43
|
+
<%_ if (fields.some(field => field.fieldTypeLong)) { _%>
|
|
44
|
+
private static final AtomicLong longCount = new AtomicLong(random.nextInt() + ( 2 * Integer.MAX_VALUE ));
|
|
45
|
+
<%_ } _%>
|
|
46
|
+
<%_ if (fields.some(field => field.fieldTypeInteger)) { _%>
|
|
47
|
+
private static final AtomicInteger intCount = new AtomicInteger(random.nextInt() + ( 2 * Short.MAX_VALUE ));
|
|
48
|
+
<%_ } _%>
|
|
49
|
+
|
|
50
|
+
public static <%= persistClass %> get<%= persistClass %>Sample1() {
|
|
51
|
+
<%_ if (fluentMethods) { _%>
|
|
52
|
+
return new <%= persistClass %>()<% sampleFields.forEach(field => { %>.<%- field.fieldName %>(<%- field.javaValueSample1 %>)<% }) %>;
|
|
53
|
+
<%_ } else { _%>
|
|
54
|
+
<%= persistClass %> <%= persistInstance %> = new <%= persistClass %>();
|
|
55
|
+
<%_ for (const field of sampleFields) { _%>
|
|
56
|
+
<%= persistInstance %>.set<%= field.fieldNameCapitalized %>(<%- field.javaValueSample1 %>);
|
|
57
|
+
<%_ } _%>
|
|
58
|
+
return <%= persistInstance %>;
|
|
59
|
+
<%_ } _%>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public static <%= persistClass %> get<%= persistClass %>Sample2() {
|
|
63
|
+
<%_ if (fluentMethods) { _%>
|
|
64
|
+
return new <%= persistClass %>()<% sampleFields.forEach(field => { %>.<%- field.fieldName %>(<%- field.javaValueSample2 %>)<% }) %>;
|
|
65
|
+
<%_ } else { _%>
|
|
66
|
+
<%= persistClass %> <%= persistInstance %> = new <%= persistClass %>();
|
|
67
|
+
<%_ for (const field of sampleFields) { _%>
|
|
68
|
+
<%= persistInstance %>.set<%= field.fieldNameCapitalized %>(<%- field.javaValueSample2 %>);
|
|
69
|
+
<%_ } _%>
|
|
70
|
+
return <%= persistInstance %>;
|
|
71
|
+
<%_ } _%>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public static <%= persistClass %> get<%= persistClass %>RandomSampleGenerator() {
|
|
75
|
+
<%_ if (fluentMethods) { _%>
|
|
76
|
+
return new <%= persistClass %>()<% sampleFields.forEach(field => { %>.<%- field.fieldName %>(<%- field.javaValueGenerator %>)<% }) %>;
|
|
77
|
+
<%_ } else { _%>
|
|
78
|
+
<%= persistClass %> <%= persistInstance %> = new <%= persistClass %>();
|
|
79
|
+
<%_ for (const field of sampleFields) { _%>
|
|
80
|
+
<%= persistInstance %>.set<%= field.fieldNameCapitalized %>(<%- field.javaValueGenerator %>);
|
|
81
|
+
<%_ } _%>
|
|
82
|
+
return <%= persistInstance %>;
|
|
83
|
+
<%_ } _%>
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -31,6 +31,8 @@ import { createImporterFromContent } from '../../jdl/jdl-importer.js';
|
|
|
31
31
|
import { GENERATOR_JHIPSTER, JHIPSTER_CONFIG_DIR } from '../generator-constants.mjs';
|
|
32
32
|
import statistics from '../statistics.mjs';
|
|
33
33
|
import { addApplicationIndex, allNewApplications, customizeForMicroservices } from './internal/index.mjs';
|
|
34
|
+
import { mergeYoRcContent } from '../../jdl/index.js';
|
|
35
|
+
import { normalizeBlueprintName } from '../base/internal/blueprint.mjs';
|
|
34
36
|
const { upperFirst } = _;
|
|
35
37
|
/**
|
|
36
38
|
* Add jdl extension to the file
|
|
@@ -270,16 +272,23 @@ export default class JdlGenerator extends BaseGenerator {
|
|
|
270
272
|
}
|
|
271
273
|
writeConfig(...applications) {
|
|
272
274
|
for (const application of applications) {
|
|
273
|
-
const { folder = '',
|
|
275
|
+
const { folder = '', entities = [], sharedFs } = application;
|
|
276
|
+
let { config, namespaceConfigs } = application;
|
|
274
277
|
const appPath = folder ? `${folder}/` : folder;
|
|
275
278
|
const fs = sharedFs ? createMemFsEditor(sharedFs) : this.fs;
|
|
276
279
|
if (config) {
|
|
277
280
|
const configFile = this.destinationPath(`${appPath}.yo-rc.json`);
|
|
278
281
|
const oldConfig = fs.readJSON(configFile, {});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
if (Array.isArray(config.blueprints)) {
|
|
283
|
+
config = {
|
|
284
|
+
...config,
|
|
285
|
+
blueprints: config.blueprints.map(({ name, ...remaining }) => ({ ...remaining, name: normalizeBlueprintName(name) })),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
if (namespaceConfigs) {
|
|
289
|
+
namespaceConfigs = Object.fromEntries(Object.entries(namespaceConfigs).map(([ns, config]) => [normalizeBlueprintName(ns), config]));
|
|
290
|
+
}
|
|
291
|
+
fs.writeJSON(configFile, mergeYoRcContent(oldConfig, { ...namespaceConfigs, [GENERATOR_JHIPSTER]: config }));
|
|
283
292
|
}
|
|
284
293
|
for (const entity of entities) {
|
|
285
294
|
const configFile = this.destinationPath(`${appPath}${JHIPSTER_CONFIG_DIR}/${upperFirst(entity.name)}.json`);
|
|
@@ -24,7 +24,6 @@ metadata:
|
|
|
24
24
|
<%_ if (useKeycloak && ingressTypeGke) { _%>
|
|
25
25
|
annotations:
|
|
26
26
|
kubernetes.io/ingress.allow-http: "true"
|
|
27
|
-
kubernetes.io/ingress.class: gce
|
|
28
27
|
kubernetes.io/ingress.global-static-ip-name: <%= app.baseName.toLowerCase()%>-ip
|
|
29
28
|
cert-manager.io/issuer: letsencrypt-staging
|
|
30
29
|
acme.cert-manager.io/http01-edit-in-place: "true"
|