generator-jhipster 7.9.2 → 7.9.3
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/cli/environment-builder.js +15 -1
- package/generators/app/index.js +12 -1
- package/generators/bootstrap/index.js +33 -1
- package/generators/ci-cd/templates/circle.yml.ejs +3 -13
- package/generators/client/files-angular.js +1 -1
- package/generators/client/files-react.js +5 -2
- package/generators/client/files-vue.js +3 -2
- package/generators/client/templates/angular/jest.conf.js.ejs +6 -3
- package/generators/client/templates/angular/package.json +18 -18
- package/generators/client/templates/angular/package.json.ejs +3 -7
- package/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/admin/health/health.model.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts.ejs +17 -15
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/user-management.model.ts.ejs +2 -2
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/user-management.route.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/core/request/request-util.ts.ejs +4 -2
- package/generators/client/templates/angular/src/main/webapp/app/core/util/data-util.service.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/core/util/parse-links.service.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.component.html.ejs +8 -6
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.component.ts.ejs +6 -11
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.model.spec.ts.ejs +227 -25
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.model.ts.ejs +104 -43
- package/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs +8 -0
- package/generators/client/templates/angular/tsconfig.json.ejs +0 -1
- package/generators/client/templates/angular/tsconfig.spec.json.ejs +2 -3
- package/generators/client/templates/angular/webpack/webpack.microfrontend.js.ejs +0 -3
- package/generators/client/templates/common/package.json +4 -4
- package/generators/client/templates/common/src/main/webapp/swagger-ui/index.html.ejs +1 -1
- package/generators/client/templates/react/jest.conf.js.ejs +2 -2
- package/generators/client/templates/react/package.json +23 -23
- package/generators/client/templates/react/package.json.ejs +3 -7
- package/generators/client/templates/react/src/main/webapp/app/config/store.ts.ejs +0 -6
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.spec.ts.ejs +7 -7
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs +6 -6
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/index.tsx.ejs +2 -2
- package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/admin.tsx.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs +17 -8
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.ts.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +176 -19
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.ts.ejs +46 -13
- package/generators/client/templates/react/webpack/webpack.microfrontend.js.jhi.react.ejs +1 -1
- package/generators/client/templates/vue/package.json +17 -17
- package/generators/client/templates/vue/package.json.ejs +3 -7
- package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +2 -1
- package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +1 -1
- package/generators/client/templates/vue/src/main/webapp/app/main.ts.ejs +2 -2
- package/generators/client/templates/vue/src/main/webapp/app/router/admin.ts.ejs +2 -2
- package/generators/client/templates/vue/src/test/javascript/e2e/modules/administration/administration.spec.ts.ejs +1 -1
- package/generators/client/templates/vue/src/test/javascript/e2e/page-objects/administration-page.ts.ejs +1 -1
- package/generators/client/templates/vue/src/test/javascript/e2e/page-objects/navbar-page.ts.ejs +2 -2
- package/generators/client/templates/vue/src/test/javascript/jest.conf.js.ejs +5 -6
- package/generators/client/templates/vue/src/test/javascript/spec/app/account/account.service.spec.ts.ejs +4 -0
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/alert/alert.service.spec.ts.ejs +106 -3
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs +12 -0
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/formatter.spec.ts.ejs +6 -0
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/sort/sorts.spec.ts.ejs +10 -0
- package/generators/client/templates/vue/webpack/webpack.common.js.ejs +1 -1
- package/generators/client/templates/vue/webpack/webpack.dev.js.ejs +2 -2
- package/generators/common/files.js +5 -4
- package/generators/common/templates/package.json +1 -1
- package/generators/common/templates/sonar-project.properties.ejs +19 -11
- package/generators/cypress/index.js +1 -1
- package/generators/docker-compose/templates/README-DOCKER-COMPOSE.md.ejs +3 -3
- package/generators/docker-compose/templates/docker-compose.yml.ejs +1 -1
- package/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +32 -14
- package/generators/entity/index.js +4 -3
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/detail/entity-management-detail.component.html.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.html.ejs +18 -6
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.spec.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.ts.ejs +23 -19
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.spec.ts.ejs +3 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/update/entity-form.service.ts.ejs +1 -1
- package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity.component.ts.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/common/delete_template.ejs +7 -3
- package/generators/entity-server/templates/src/main/java/package/common/get_all_template.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.ejs +15 -5
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_persistable.ejs +8 -1
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryInternalImpl_reactive.java.ejs +5 -0
- package/generators/entity-server/templates/src/main/java/package/service/EntityQueryService.java.ejs +4 -4
- package/generators/entity-server/templates/src/main/java/package/service/EntityService.java.ejs +6 -4
- package/generators/entity-server/templates/src/main/java/package/service/criteria/EntityCriteria.java.ejs +3 -26
- package/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs +1 -0
- package/generators/entity-server/templates/src/main/java/package/service/impl/EntityServiceImpl.java.ejs +1 -1
- package/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs +33 -28
- package/generators/generate-blueprint/constants.mjs +46 -6
- package/generators/generate-blueprint/files.mjs +7 -5
- package/generators/generate-blueprint/generator.mjs +73 -19
- package/generators/generate-blueprint/templates/generators/generator/generator.spec.mjs.ejs +1 -1
- package/generators/generator-base-blueprint.js +23 -1
- package/generators/generator-base-entities.cjs +5 -1
- package/generators/generator-base.js +82 -15
- package/generators/generator-constants.js +17 -23
- package/generators/kubernetes/templates/deployment.yml.ejs +1 -1
- package/generators/kubernetes/templates/ingress.yml.ejs +1 -1
- package/generators/kubernetes/templates/istio/gateway.yml.ejs +1 -1
- package/generators/kubernetes/templates/kustomize/kustomization.yml.ejs +1 -1
- package/generators/kubernetes/templates/service.yml.ejs +1 -1
- package/generators/kubernetes-knative/templates/istio/gateway.yml.ejs +1 -1
- package/generators/kubernetes-knative/templates/service.yml.ejs +3 -3
- package/generators/languages/templates/src/main/webapp/i18n/al/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ar-ly/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/bg/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/bn/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/by/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ca/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/cs/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/da/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/de/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/activate.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/password.json +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/register.json +3 -3
- package/generators/languages/templates/src/main/webapp/i18n/el/tracker.json +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/user-management.json +9 -9
- package/generators/languages/templates/src/main/webapp/i18n/en/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/es/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/et/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/fa/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/fi/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/fr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/gl/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hi/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hu/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hy/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/in/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/it/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ja/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ko/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/mr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/my/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/nl/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pa/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pl/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pt-br/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pt-pt/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ro/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ru/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/si/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/sk/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/sr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/sv/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ta/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/te/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/th/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/tr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ua/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/uz-Latn-uz/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/vi/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/zh-cn/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/zh-tw/health.json.ejs +1 -1
- package/generators/openshift/templates/deployment.yml.ejs +2 -2
- package/generators/server/cleanup-elasticsearch.js +5 -0
- package/generators/server/files.js +17 -8
- package/generators/server/index.js +0 -2
- package/generators/server/templates/build.gradle.ejs +6 -14
- package/generators/server/templates/gradle/profile_dev.gradle.ejs +1 -1
- package/generators/server/templates/gradle/profile_prod.gradle.ejs +1 -1
- package/generators/server/templates/gradle.properties.ejs +6 -4
- package/generators/server/templates/npmw.cmd +31 -29
- package/generators/server/templates/package.json.ejs +2 -2
- package/generators/server/templates/pom.xml.ejs +12 -23
- package/generators/server/templates/sql/common/src/test/java/package/config/MsSqlTestContainer.java.ejs +2 -3
- package/generators/server/templates/src/main/docker/app.yml.ejs +7 -1
- package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs +32 -14
- package/generators/server/templates/src/main/docker/jhipster-control-center.yml.ejs +1 -1
- package/generators/server/templates/src/main/docker/prometheus/prometheus.yml.ejs +1 -1
- package/generators/server/templates/src/main/java/package/Application.java.ejs +11 -4
- package/generators/server/templates/src/main/java/package/config/CRLFLogConverter.java.ejs +57 -0
- package/generators/server/templates/src/main/java/package/config/EurekaWorkaroundConfiguration.java.ejs +49 -0
- package/generators/server/templates/src/main/java/package/config/LoggingConfiguration.java.ejs +4 -4
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +17 -18
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration_reactive.java.ejs +13 -5
- package/generators/server/templates/src/main/java/package/domain/AbstractAuditingEntity.java.ejs +5 -6
- package/generators/server/templates/src/main/java/package/domain/User.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/repository/UserRepository.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/security/oauth2/CustomClaimConverter.java.ejs +13 -6
- package/generators/server/templates/src/main/java/package/service/dto/AdminUserDTO.java.ejs +3 -1
- package/generators/server/templates/src/main/java/package/service/dto/PasswordChangeDTO.java.ejs +5 -1
- package/generators/server/templates/src/main/java/package/service/dto/UserDTO.java.ejs +3 -1
- package/generators/server/templates/src/main/java/package/web/rest/UserResource.java.ejs +15 -42
- package/generators/server/templates/src/main/java/package/web/rest/errors/BadRequestAlertException.java.ejs +1 -0
- package/generators/server/templates/src/main/java/package/web/rest/errors/EmailAlreadyUsedException.java.ejs +1 -0
- package/generators/server/templates/src/main/java/package/web/rest/errors/InvalidPasswordException.java.ejs +1 -0
- package/generators/server/templates/src/main/java/package/web/rest/errors/LoginAlreadyUsedException.java.ejs +1 -0
- package/generators/server/templates/src/main/resources/config/application-dev.yml.ejs +1 -1
- package/generators/server/templates/src/main/resources/config/application-prod.yml.ejs +2 -2
- package/generators/server/templates/src/main/resources/config/application.yml.ejs +4 -2
- package/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs +3 -8
- package/generators/server/templates/src/main/resources/logback-spring.xml.ejs +5 -0
- package/generators/server/templates/src/test/java/package/config/{ElasticsearchReactiveTestConfiguration.java.ejs → ElasticsearchTestConfiguration.java.ejs} +3 -3
- package/generators/server/templates/src/test/java/package/config/ElasticsearchTestContainer.java.ejs +1 -0
- package/generators/server/templates/src/test/java/package/config/JHipsterBlockHoundIntegration.java.ejs +3 -0
- package/generators/server/templates/src/test/java/package/config/TestContainersSpringContextCustomizerFactory.java.ejs +2 -2
- package/generators/sql-constants.js +5 -2
- package/generators/utils.js +43 -3
- package/generators/workspaces/index.js +2 -1
- package/jdl/exporters/jdl-exporter.js +6 -1
- package/jdl/jhipster/application-options.js +2 -1
- package/jdl/jhipster/binary-options.js +2 -2
- package/jdl/jhipster/default-application-options.js +11 -8
- package/jdl/jhipster/entity-options.js +1 -0
- package/jdl/jhipster/search-engine-types.js +1 -0
- package/lib/constants/priorities.cjs +16 -0
- package/lib/constants/priorities.mjs +1 -0
- package/lib/index.js +2 -0
- package/lib/support/base.cjs +2 -1
- package/package.json +7 -6
- package/utils/blueprint.js +10 -0
- package/utils/field.js +3 -1
- package/generators/client/templates/react/src/main/webapp/app/config/translation-middleware.ts.ejs +0 -58
- package/generators/server/templates/.npmrc.ejs +0 -1
|
@@ -855,7 +855,7 @@ class EntityGenerator extends BaseBlueprintGenerator {
|
|
|
855
855
|
*/
|
|
856
856
|
processEagerLoadRelationships() {
|
|
857
857
|
this.context.relationships.forEach(relationship => {
|
|
858
|
-
if (relationship.otherEntity.
|
|
858
|
+
if (!relationship.otherEntity.primaryKey) {
|
|
859
859
|
relationship.bagRelationship = false;
|
|
860
860
|
relationship.relationshipEagerLoad = false;
|
|
861
861
|
return;
|
|
@@ -872,7 +872,7 @@ class EntityGenerator extends BaseBlueprintGenerator {
|
|
|
872
872
|
this.context.relationshipsContainEagerLoad = this.context.relationships.some(relationship => relationship.relationshipEagerLoad);
|
|
873
873
|
this.context.containsBagRelationships = this.context.relationships.some(relationship => relationship.bagRelationship);
|
|
874
874
|
this.context.implementsEagerLoadApis = // Cassandra doesn't provides *WithEagerReationships apis
|
|
875
|
-
![CASSANDRA, COUCHBASE].includes(this.context.databaseType) &&
|
|
875
|
+
![CASSANDRA, COUCHBASE, NEO4J].includes(this.context.databaseType) &&
|
|
876
876
|
// Only sql and mongodb provides *WithEagerReationships apis for imperative implementation
|
|
877
877
|
(this.context.reactive || [SQL, MONGODB].includes(this.context.databaseType)) &&
|
|
878
878
|
this.context.relationshipsContainEagerLoad;
|
|
@@ -1145,7 +1145,8 @@ class EntityGenerator extends BaseBlueprintGenerator {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
1147
|
_checkPersistableInterfaceRequirement() {
|
|
1148
|
-
this.context.requiresPersistableImplementation =
|
|
1148
|
+
this.context.requiresPersistableImplementation =
|
|
1149
|
+
this.context.requiresPersistableImplementation || this.context.fields.some(field => field.requiresPersistableImplementation);
|
|
1149
1150
|
}
|
|
1150
1151
|
}
|
|
1151
1152
|
|
|
@@ -88,7 +88,7 @@ _%>
|
|
|
88
88
|
</span>
|
|
89
89
|
<%_ } else { _%>
|
|
90
90
|
<div *ngIf="<%= entityInstance + '.' + relationshipFieldName %>">
|
|
91
|
-
<a [routerLink]="['/<%= otherEntityStateName %>', <%= entityInstance + '.' + relationshipFieldName + '.' + relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName
|
|
91
|
+
<a [routerLink]="['/<%= otherEntityStateName %>', <%= entityInstance + '.' + relationshipFieldName + '.' + relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName %>.<%= otherEntityField %> }}</a>
|
|
92
92
|
</div>
|
|
93
93
|
<%_ } _%>
|
|
94
94
|
<%_ } _%>
|
|
@@ -61,19 +61,26 @@
|
|
|
61
61
|
<%_ } _%>
|
|
62
62
|
|
|
63
63
|
<%_ if (jpaMetamodelFiltering && paginationPagination) { _%>
|
|
64
|
-
<<%= jhiPrefixDashed %>-filter [filters]="filters"
|
|
64
|
+
<<%= jhiPrefixDashed %>-filter [filters]="filters"></<%= jhiPrefixDashed %>-filter>
|
|
65
65
|
<%_ } _%>
|
|
66
66
|
|
|
67
67
|
<div class="alert alert-warning" id="no-result" *ngIf="<%= entityInstancePlural %>?.length === 0">
|
|
68
68
|
<span <%= jhiPrefix %>Translate="<%= i18nKeyPrefix %>.home.notFound"><%- this._getEntityClientTranslation(i18nKeyPrefix + '.home.notFound') %></span>
|
|
69
69
|
</div>
|
|
70
70
|
|
|
71
|
-
<div class="table-responsive" id="entities" *ngIf="<%= entityInstancePlural %> && <%= entityInstancePlural %>.length > 0">
|
|
71
|
+
<div class="table-responsive table-entities" id="entities" *ngIf="<%= entityInstancePlural %> && <%= entityInstancePlural %>.length > 0">
|
|
72
72
|
<table class="table table-striped" aria-describedby="page-heading">
|
|
73
73
|
<thead>
|
|
74
74
|
<tr <%= jhiPrefix %>Sort [(predicate)]="predicate" [(ascending)]="ascending" (sortChange)="navigateToWithComponentValues()">
|
|
75
75
|
<%_ for (const field of fields.filter(field => !field.hidden)) { _%>
|
|
76
|
-
<th scope="col" <%= jhiPrefix %>SortBy="<%= field.fieldName %>"
|
|
76
|
+
<th scope="col" <%= jhiPrefix %>SortBy="<%= field.fieldName %>">
|
|
77
|
+
<div class="d-flex">
|
|
78
|
+
<span <%= jhiPrefix %>Translate="<%= field.fieldTranslationKey %>"><%- this._getEntityClientTranslation(field.fieldTranslationKey) %></span>
|
|
79
|
+
<%_ if (!field.transient) { _%>
|
|
80
|
+
<fa-icon class="p-1" <% if (searchEngine && !field.fieldTypeBoolean && !field.fieldTypeNumeric && !field.fieldTypeTemporal) { %>*ngIf="!currentSearch" <% } %>icon="sort"></fa-icon>
|
|
81
|
+
<%_ } _%>
|
|
82
|
+
</div>
|
|
83
|
+
</th>
|
|
77
84
|
<%_ } _%>
|
|
78
85
|
<%_ for (const relationship of relationships.filter(rel => !rel.otherEntityIsEmbedded)) { _%>
|
|
79
86
|
<%_ if (relationship.relationshipManyToOne
|
|
@@ -81,13 +88,18 @@
|
|
|
81
88
|
|| (relationship.relationshipManyToMany && relationship.ownerSide && paginationNo)) {
|
|
82
89
|
const fieldName = "." + relationship.otherEntityField;
|
|
83
90
|
_%>
|
|
84
|
-
<th scope="col" <%= jhiPrefix %>SortBy="<%= relationship.relationshipName + (fieldName) %>"
|
|
91
|
+
<th scope="col" <%= jhiPrefix %>SortBy="<%= relationship.relationshipName + (fieldName) %>">
|
|
92
|
+
<div class="d-flex">
|
|
93
|
+
<span <%= jhiPrefix %>Translate="<%= `${i18nKeyPrefix}.${relationship.relationshipName}` %>"><%- this._getEntityClientTranslation(i18nKeyPrefix + '.' + relationship.relationshipName) %></span>
|
|
94
|
+
<fa-icon class="p-1" icon="sort"></fa-icon>
|
|
95
|
+
</div>
|
|
96
|
+
</th>
|
|
85
97
|
<%_ } _%>
|
|
86
98
|
<%_ } _%>
|
|
87
99
|
<th scope="col"></th>
|
|
88
100
|
</tr>
|
|
89
101
|
</thead>
|
|
90
|
-
<tbody<% if (paginationInfiniteScroll) { %> infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0"<% } %>>
|
|
102
|
+
<tbody<% if (paginationInfiniteScroll) { %> infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page - 1 >= links['last']" [infiniteScrollDistance]="0"<% } %>>
|
|
91
103
|
<tr *ngFor="let <%= entityInstance %> of <%= entityInstancePlural %>; trackBy: track<%= primaryKey.nameCapitalized %>" data-cy="entityTable">
|
|
92
104
|
<%_
|
|
93
105
|
const routerLink = ` [routerLink]="['/${ entityPage }', ${entityInstance}.${primaryKey.name}, 'view']"`;
|
|
@@ -146,7 +158,7 @@ _%>
|
|
|
146
158
|
</span>
|
|
147
159
|
<%_ } else { _%>
|
|
148
160
|
<div *ngIf="<%= entityInstance + "." + relationshipFieldName %>">
|
|
149
|
-
<a [routerLink]="['/<%= relationship.otherEntity.entityPage %>', <%= entityInstance %>.<%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName
|
|
161
|
+
<a [routerLink]="['/<%= relationship.otherEntity.entityPage %>', <%= entityInstance %>.<%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName %>.<%= otherEntityField %> }}</a>
|
|
150
162
|
</div>
|
|
151
163
|
<%_ } _%>
|
|
152
164
|
<%_ } _%>
|
|
@@ -166,7 +166,7 @@ describe('<%= entityAngularName %> Management Component', () => {
|
|
|
166
166
|
comp.ngOnInit();
|
|
167
167
|
|
|
168
168
|
// THEN
|
|
169
|
-
expect(service.query).toHaveBeenLastCalledWith(expect.objectContaining({ 'someId.in': 'dc4279ea-cfb9-11ec-9d64-0242ac120002' }));
|
|
169
|
+
expect(service.query).toHaveBeenLastCalledWith(expect.objectContaining({ 'someId.in': ['dc4279ea-cfb9-11ec-9d64-0242ac120002'] }));
|
|
170
170
|
});
|
|
171
171
|
<%_ } _%>
|
|
172
172
|
<%_ } _%>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
const notSortableFieldsAfterSearch = notSortableFieldsAfterSearchArray
|
|
27
27
|
.map(field => `'${field.fieldName}'`)
|
|
28
28
|
.join(', ');
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
const componentName = entityAngularName + 'Component';
|
|
31
31
|
_%>
|
|
32
32
|
import { Component, OnInit } from '@angular/core';
|
|
@@ -34,7 +34,7 @@ import { Component, OnInit } from '@angular/core';
|
|
|
34
34
|
import { HttpHeaders } from '@angular/common/http';
|
|
35
35
|
<%_ } _%>
|
|
36
36
|
import { ActivatedRoute, Data, ParamMap, Router } from '@angular/router';
|
|
37
|
-
import { combineLatest
|
|
37
|
+
import { combineLatest<%_ if (!readOnly) { _%>, filter<%_ } _%>, Observable, switchMap, tap } from 'rxjs';
|
|
38
38
|
<%_ if (!readOnly) { _%>
|
|
39
39
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
40
40
|
<%_ } _%>
|
|
@@ -43,7 +43,9 @@ import { I<%= entityAngularName %> } from '../<%= entityFileName %>.model';
|
|
|
43
43
|
<%_ if (!paginationNo) { %>
|
|
44
44
|
import {
|
|
45
45
|
ITEMS_PER_PAGE,
|
|
46
|
+
<%_ if (paginationPagination) { _%>
|
|
46
47
|
PAGE_HEADER,
|
|
48
|
+
<%_ } _%>
|
|
47
49
|
<%_ if (paginationPagination) { _%>
|
|
48
50
|
TOTAL_COUNT_RESPONSE_HEADER,
|
|
49
51
|
<%_ } _%>
|
|
@@ -53,7 +55,9 @@ import {
|
|
|
53
55
|
ASC,
|
|
54
56
|
DESC,
|
|
55
57
|
SORT,
|
|
58
|
+
<%_ if (!readOnly) { _%>
|
|
56
59
|
ITEM_DELETED_EVENT,
|
|
60
|
+
<%_ } _%>
|
|
57
61
|
DEFAULT_SORT_DATA
|
|
58
62
|
} from 'app/config/navigation.constants';
|
|
59
63
|
import { EntityArrayResponseType, <%= entityAngularName %>Service } from '../service/<%= entityFileName %>.service';
|
|
@@ -67,7 +71,7 @@ import { DataUtils } from 'app/core/util/data-util.service';
|
|
|
67
71
|
import { ParseLinks } from 'app/core/util/parse-links.service';
|
|
68
72
|
<%_ } _%>
|
|
69
73
|
<%_ if (jpaMetamodelFiltering && paginationPagination) { _%>
|
|
70
|
-
import { FilterOptions, IFilterOptions } from 'app/shared/filter/filter.model';
|
|
74
|
+
import { FilterOptions, IFilterOptions, IFilterOption } from 'app/shared/filter/filter.model';
|
|
71
75
|
<%_ } _%>
|
|
72
76
|
<%_ if (paginationNo) { _%>
|
|
73
77
|
import { SortService } from 'app/shared/sort/sort.service';
|
|
@@ -157,6 +161,9 @@ export class <%= componentName %> implements OnInit {
|
|
|
157
161
|
<%_ } _%>
|
|
158
162
|
ngOnInit(): void {
|
|
159
163
|
this.load();
|
|
164
|
+
<% if (jpaMetamodelFiltering && paginationPagination) { %>
|
|
165
|
+
this.filters.filterChanges.subscribe(filterOptions => this.handleNavigation(1, this.predicate, this.ascending, filterOptions));
|
|
166
|
+
<% } %>
|
|
160
167
|
}
|
|
161
168
|
|
|
162
169
|
<%_ if (fieldsContainBlob) { _%>
|
|
@@ -196,12 +203,12 @@ export class <%= componentName %> implements OnInit {
|
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
navigateToWithComponentValues(): void {
|
|
199
|
-
this.handleNavigation(<% if (!paginationNo) { %>this.page, <% } %>this.predicate, this.ascending<% if (jpaMetamodelFiltering && paginationPagination) { %>, this.filters<% } %><% if (searchEngine) { %>, this.currentSearch<% } %>);
|
|
206
|
+
this.handleNavigation(<% if (!paginationNo) { %>this.page, <% } %>this.predicate, this.ascending<% if (jpaMetamodelFiltering && paginationPagination) { %>, this.filters.filterOptions<% } %><% if (searchEngine) { %>, this.currentSearch<% } %>);
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
<%_ if (!paginationNo) { _%>
|
|
203
210
|
navigateToPage(page = this.page): void {
|
|
204
|
-
this.handleNavigation(page, this.predicate, this.ascending<% if (jpaMetamodelFiltering && paginationPagination) { %>, this.filters<% } %><% if (searchEngine) { %>, this.currentSearch<% } %>);
|
|
211
|
+
this.handleNavigation(page, this.predicate, this.ascending<% if (jpaMetamodelFiltering && paginationPagination) { %>, this.filters.filterOptions<% } %><% if (searchEngine) { %>, this.currentSearch<% } %>);
|
|
205
212
|
}
|
|
206
213
|
|
|
207
214
|
<%_ } _%>
|
|
@@ -210,13 +217,13 @@ export class <%= componentName %> implements OnInit {
|
|
|
210
217
|
.pipe(
|
|
211
218
|
tap(([params, data]) => this.fillComponentAttributeFromRoute(params, data)),
|
|
212
219
|
switchMap(() =>
|
|
213
|
-
this.queryBackend(<% if (!paginationNo) { %>this.page, <% } %>this.predicate, this.ascending<% if (jpaMetamodelFiltering && paginationPagination) { %>, this.filters<% } %><% if (searchEngine) { %>, this.currentSearch<% } %>)
|
|
220
|
+
this.queryBackend(<% if (!paginationNo) { %>this.page, <% } %>this.predicate, this.ascending<% if (jpaMetamodelFiltering && paginationPagination) { %>, this.filters.filterOptions<% } %><% if (searchEngine) { %>, this.currentSearch<% } %>)
|
|
214
221
|
)
|
|
215
222
|
);
|
|
216
223
|
}
|
|
217
224
|
|
|
218
225
|
protected fillComponentAttributeFromRoute(params: ParamMap, data: Data): void {
|
|
219
|
-
<%_ if (
|
|
226
|
+
<%_ if (paginationPagination) { _%>
|
|
220
227
|
const page = params.get(PAGE_HEADER);
|
|
221
228
|
this.page = +(page ?? 1);
|
|
222
229
|
<%_ } _%>
|
|
@@ -293,7 +300,7 @@ export class <%= componentName %> implements OnInit {
|
|
|
293
300
|
}
|
|
294
301
|
|
|
295
302
|
<%_ } _%>
|
|
296
|
-
protected queryBackend(<% if (!paginationNo) { %>page?: number, <% } %>predicate?: string, ascending?: boolean<% if (jpaMetamodelFiltering && paginationPagination) { %>,
|
|
303
|
+
protected queryBackend(<% if (!paginationNo) { %>page?: number, <% } %>predicate?: string, ascending?: boolean<% if (jpaMetamodelFiltering && paginationPagination) { %>, filterOptions?: IFilterOption[]<% } %><% if (searchEngine) { %>, currentSearch?: string<% } %>): Observable<EntityArrayResponseType> {
|
|
297
304
|
this.isLoading = true;
|
|
298
305
|
<%_ if (!paginationNo) { _%>
|
|
299
306
|
const pageToLoad: number = page ?? 1;
|
|
@@ -312,11 +319,9 @@ export class <%= componentName %> implements OnInit {
|
|
|
312
319
|
sort: this.getSortQueryParam(predicate, ascending),
|
|
313
320
|
};
|
|
314
321
|
<%_ if (jpaMetamodelFiltering && paginationPagination) { _%>
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
});
|
|
319
|
-
}
|
|
322
|
+
filterOptions?.forEach(filterOption => {
|
|
323
|
+
queryObject[filterOption.name] = filterOption.values;
|
|
324
|
+
});
|
|
320
325
|
<%_ } _%>
|
|
321
326
|
<%_ if (searchEngine) { _%>
|
|
322
327
|
if (this.currentSearch && this.currentSearch !== '') {
|
|
@@ -335,7 +340,7 @@ export class <%= componentName %> implements OnInit {
|
|
|
335
340
|
<%_ } _%>
|
|
336
341
|
}
|
|
337
342
|
|
|
338
|
-
protected handleNavigation(<% if (!paginationNo) { %>page = this.page, <% } %>predicate?: string, ascending?: boolean<% if (jpaMetamodelFiltering && paginationPagination) { %>,
|
|
343
|
+
protected handleNavigation(<% if (!paginationNo) { %>page = this.page, <% } %>predicate?: string, ascending?: boolean<% if (jpaMetamodelFiltering && paginationPagination) { %>, filterOptions?: IFilterOption[]<% } %><% if (searchEngine) { %>, currentSearch?: string<% } %>): void {
|
|
339
344
|
const queryParamsObj<%_ if (jpaMetamodelFiltering && paginationPagination) { _%>: any<%_ } _%> = {
|
|
340
345
|
<%_ if (searchEngine) { _%>
|
|
341
346
|
search: currentSearch,
|
|
@@ -346,12 +351,11 @@ export class <%= componentName %> implements OnInit {
|
|
|
346
351
|
<%_ } _%>
|
|
347
352
|
sort: this.getSortQueryParam(predicate, ascending),
|
|
348
353
|
};
|
|
354
|
+
|
|
349
355
|
<%_ if (jpaMetamodelFiltering && paginationPagination) { _%>
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
});
|
|
354
|
-
}
|
|
356
|
+
filterOptions?.forEach(filterOption => {
|
|
357
|
+
queryParamsObj[filterOption.nameAsQueryParam()] = filterOption.values;
|
|
358
|
+
});
|
|
355
359
|
<%_ } _%>
|
|
356
360
|
|
|
357
361
|
this.router.navigate([ './' ], {
|
|
@@ -124,11 +124,13 @@ describe('<%= entityAngularName %> Service', () => {
|
|
|
124
124
|
|
|
125
125
|
<%_ if (!readOnly) { _%>
|
|
126
126
|
it('should delete a <%= entityAngularName %>', () => {
|
|
127
|
+
const expected = true;
|
|
128
|
+
|
|
127
129
|
service.delete(<%- tsKeyId %>).subscribe(resp => expectedResult = resp.ok);
|
|
128
130
|
|
|
129
131
|
const req = httpMock.expectOne({ method: 'DELETE' });
|
|
130
132
|
req.flush({ status: 200 });
|
|
131
|
-
expect(expectedResult);
|
|
133
|
+
expect(expectedResult).toBe(expected);
|
|
132
134
|
});
|
|
133
135
|
<%_ } _%>
|
|
134
136
|
|
|
@@ -67,7 +67,7 @@ export type EntityArrayResponseType = HttpResponse<I<%= entityAngularName %>[]>;
|
|
|
67
67
|
export class <%= entityAngularName %>Service {
|
|
68
68
|
protected resourceUrl = this.applicationConfigService.getEndpointFor('api/<%= entityApiUrl %>'<% if ((applicationTypeGateway || applicationTypeMicroservice) && locals.microserviceName) { %>, '<%= microserviceName.toLowerCase() %>'<% } %>);
|
|
69
69
|
<%_ if (searchEngine) { _%>
|
|
70
|
-
protected resourceSearchUrl = this.applicationConfigService.getEndpointFor('api/_search/<%= entityApiUrl %>'<% if (applicationTypeGateway && locals.microserviceName) { %>, '<%= microserviceName.toLowerCase() %>'<% } %>);
|
|
70
|
+
protected resourceSearchUrl = this.applicationConfigService.getEndpointFor('api/_search/<%= entityApiUrl %>'<% if ((applicationTypeGateway || applicationTypeMicroservice) && locals.microserviceName) { %>, '<%= microserviceName.toLowerCase() %>'<% } %>);
|
|
71
71
|
<%_ } _%>
|
|
72
72
|
|
|
73
73
|
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
|
|
@@ -192,7 +192,7 @@ _%>
|
|
|
192
192
|
form.reset({
|
|
193
193
|
...<%= entityInstance %>RawValue,
|
|
194
194
|
<%_ for (const field of fields.filter(field => field.id)) { _%>
|
|
195
|
-
<%= field.fieldName %>: { value: <%= entityInstance %>RawValue.<%= field.fieldName %>, disabled: <% if (field.autoGenerate) { %>true<% } else { %><%= entityInstance %>RawValue.<%= fieldName %> !== null<% } %> },
|
|
195
|
+
<%= field.fieldName %>: { value: <%= entityInstance %>RawValue.<%= field.fieldName %>, disabled: <% if (field.autoGenerate) { %>true<% } else { %><%= entityInstance %>RawValue.<%= field.fieldName %> !== null<% } %> },
|
|
196
196
|
<%_ } _%>
|
|
197
197
|
} as any /* cast to workaround https://github.com/angular/angular/issues/46458 */);
|
|
198
198
|
}
|
package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity.component.ts.ejs
CHANGED
|
@@ -111,7 +111,7 @@ export default class <%= entityAngularName %> extends <% if (fieldsContainBlob |
|
|
|
111
111
|
<%_ if (paginationInfiniteScroll) { _%>
|
|
112
112
|
if ((<any>this.$refs.infiniteLoading)) {
|
|
113
113
|
(<any>this.$refs.infiniteLoading).stateChanger.loaded();
|
|
114
|
-
if (this.links !== {} && this.page > this.links['last']) {
|
|
114
|
+
if (JSON.stringify(this.links) !== JSON.stringify({}) && this.page > this.links['last']) {
|
|
115
115
|
(<any>this.$refs.infiniteLoading).stateChanger.complete();
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -144,7 +144,7 @@ export default class <%= entityAngularName %> extends <% if (fieldsContainBlob |
|
|
|
144
144
|
<%_ if (paginationInfiniteScroll) { _%>
|
|
145
145
|
if ((<any>this.$refs.infiniteLoading)) {
|
|
146
146
|
(<any>this.$refs.infiniteLoading).stateChanger.loaded();
|
|
147
|
-
if (this.links !== {} && this.page > this.links['last']) {
|
|
147
|
+
if (JSON.stringify(this.links) !== JSON.stringify({}) && this.page > this.links['last']) {
|
|
148
148
|
(<any>this.$refs.infiniteLoading).stateChanger.complete();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -17,9 +17,13 @@
|
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
19
|
<%_ if (reactive) { _%>
|
|
20
|
-
return <%= entityInstance %><%= viaService ? 'Service.delete' : 'Repository.deleteById' %>(id)
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
return <%= entityInstance %><%= viaService ? 'Service.delete' : 'Repository.deleteById' %>(id)
|
|
21
|
+
<%_ if (!viaService && searchEngineElasticsearch) { %>
|
|
22
|
+
.then(<%= entityInstance %>SearchRepository.deleteById(id))
|
|
23
|
+
<%_ } -%>
|
|
24
|
+
<%_ if (!fromResource) { -%>
|
|
25
|
+
;
|
|
26
|
+
<%_ } _%>
|
|
23
27
|
<%_ } else { _%>
|
|
24
28
|
<%= entityInstance %><%= viaService ? 'Service.delete' : 'Repository.deleteById' %>(id);
|
|
25
29
|
<%_ if (!viaService && searchEngineElasticsearch) { _%>
|
package/generators/entity-server/templates/src/main/java/package/common/get_all_template.ejs
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
_%>
|
|
27
27
|
<%_ if (jpaMetamodelFiltering) { _%>
|
|
28
28
|
public ResponseEntity<List<<%= instanceType %>>> getAll<%= entityClassPlural %>(<%= entityClass %>Criteria criteria<% if (!paginationNo) { %>, @org.springdoc.api.annotations.ParameterObject Pageable pageable<% if (reactive) { %>, ServerHttpRequest request<% } %><% } %>) {
|
|
29
|
-
log.debug("REST request to get <%= entityClassPlural %> by criteria: {}", criteria
|
|
29
|
+
log.debug("REST request to get <%= entityClassPlural %> by criteria: {}", criteria);
|
|
30
30
|
<%_ if (paginationNo) { _%>
|
|
31
31
|
List<<%= instanceType %>> entityList = <%= entityInstance %>QueryService.findByCriteria(criteria);
|
|
32
32
|
return ResponseEntity.ok().body(entityList);
|
|
@@ -45,7 +45,7 @@ _%>
|
|
|
45
45
|
*/
|
|
46
46
|
@GetMapping("/<%= entityApiUrl %>/count")
|
|
47
47
|
public ResponseEntity<Long> count<%= entityClassPlural %>(<%= entityClass %>Criteria criteria) {
|
|
48
|
-
log.debug("REST request to count <%= entityClassPlural %> by criteria: {}", criteria
|
|
48
|
+
log.debug("REST request to count <%= entityClassPlural %> by criteria: {}", criteria);
|
|
49
49
|
return ResponseEntity.ok().body(<%= entityInstance %>QueryService.countByCriteria(criteria));
|
|
50
50
|
}
|
|
51
51
|
<%_ } else { _%>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
importSection: 0,
|
|
23
23
|
staticImportSection: 0,
|
|
24
24
|
annotationSection: 0,
|
|
25
|
+
extendsSection: 1,
|
|
25
26
|
additionalInterfacesSection: 0,
|
|
26
27
|
classStaticFieldsSection: 0,
|
|
27
28
|
classFieldsSection: 0,
|
|
@@ -30,6 +31,8 @@
|
|
|
30
31
|
classAdditionalRelationshipsSection: 0,
|
|
31
32
|
classAdditionalRelationshipsMethodsSection: 0,
|
|
32
33
|
<%_ for (const field of fields) { _%>
|
|
34
|
+
field<%- field.fieldNameCapitalized %>CustomDeclarationSection: 1,
|
|
35
|
+
field<%- field.fieldNameCapitalized %>CustomMethodsSection: 1,
|
|
33
36
|
field<%- field.fieldNameCapitalized %>AnnotationSection: 0,
|
|
34
37
|
<%_ if (field.fieldWithContentType) { _%>
|
|
35
38
|
field<%- field.fieldNameCapitalized %>ContentTypeAnnotationSection: 0,
|
|
@@ -93,7 +96,8 @@ import <%= otherEntity.entityAbsoluteClass %>;
|
|
|
93
96
|
<%_ } _%>
|
|
94
97
|
<%_ } _%>
|
|
95
98
|
<&- fragments.annotationSection() -&>
|
|
96
|
-
|
|
99
|
+
@SuppressWarnings("common-java:DuplicatedBlocks")
|
|
100
|
+
public class <%= persistClass %> <&- fragments.extendsSection() -&>implements Serializable<&- fragments.additionalInterfacesSection() -&> {
|
|
97
101
|
|
|
98
102
|
private static final long serialVersionUID = 1L;
|
|
99
103
|
|
|
@@ -104,7 +108,9 @@ public class <%= persistClass %> implements Serializable<&- fragments.additional
|
|
|
104
108
|
<%_ } _%>
|
|
105
109
|
<&- fragments.classStaticFieldsSection() -&>
|
|
106
110
|
<&- fragments.classFieldsSection() -&>
|
|
107
|
-
<%_ for (const field of fields.filter(field => !field.transient && (embedded || !field.id || !primaryKey.composite))) { _%>
|
|
111
|
+
<%_ for (const field of fields.filter(field => !field.javaInherited && !field.transient && (embedded || !field.id || !primaryKey.composite))) { _%>
|
|
112
|
+
<&- fragments.field<%- field.fieldNameCapitalized %>CustomDeclarationSection() -&>
|
|
113
|
+
<&_ if (!fragments.field<%- field.fieldNameCapitalized %>CustomDeclarationSection()) { -&>
|
|
108
114
|
<%_ if (typeof field.javadoc !== 'undefined') { _%>
|
|
109
115
|
<%- formatAsFieldJavadoc(field.javadoc) %>
|
|
110
116
|
<%_ } _%>
|
|
@@ -119,6 +125,7 @@ public class <%= persistClass %> implements Serializable<&- fragments.additional
|
|
|
119
125
|
private String <%= field.fieldName %>ContentType;
|
|
120
126
|
|
|
121
127
|
<%_ } _%>
|
|
128
|
+
<&_ } -&>
|
|
122
129
|
<%_ } _%>
|
|
123
130
|
<&- fragments.classAdditionalFieldsSection() -&>
|
|
124
131
|
|
|
@@ -170,6 +177,8 @@ for (relationship of relationships.filter(relationship => !relationship.embedded
|
|
|
170
177
|
<&- fragments.classAdditionalRelationshipsSection() -&>
|
|
171
178
|
// jhipster-needle-entity-add-field - JHipster will add fields here
|
|
172
179
|
<%_ for (const field of fields.filter(field => !field.transient && (embedded || !field.id || !primaryKey.composite))) { _%>
|
|
180
|
+
<&- fragments.field<%- field.fieldNameCapitalized %>CustomMethodsSection() -&>
|
|
181
|
+
<&_ if (!fragments.field<%- field.fieldNameCapitalized %>CustomMethodsSection()) { -&>
|
|
173
182
|
|
|
174
183
|
public <%= field.javaFieldType %> get<%= field.fieldInJavaBeanMethod %>() {
|
|
175
184
|
return this.<%= field.fieldName %>;
|
|
@@ -182,12 +191,12 @@ for (relationship of relationships.filter(relationship => !relationship.embedded
|
|
|
182
191
|
}
|
|
183
192
|
<%_ } _%>
|
|
184
193
|
|
|
185
|
-
<&- fragments.field<%- field.fieldNameCapitalized %>CustomSetSection() -&>
|
|
186
|
-
<&_ if (!fragments.field<%- field.fieldNameCapitalized %>CustomSetSection()) { -&>
|
|
194
|
+
<&- fragments.field<%- field.fieldNameCapitalized %>CustomSetSection() -&>
|
|
195
|
+
<&_ if (!fragments.field<%- field.fieldNameCapitalized %>CustomSetSection()) { -&>
|
|
187
196
|
public void set<%= field.fieldInJavaBeanMethod %>(<%= field.javaFieldType %> <%= field.fieldName %>) {
|
|
188
197
|
this.<%= field.fieldName %> = <%= field.fieldName %>;
|
|
189
198
|
}
|
|
190
|
-
<&_ } -&>
|
|
199
|
+
<&_ } -&>
|
|
191
200
|
<%_ if (field.fieldWithContentType) { _%>
|
|
192
201
|
|
|
193
202
|
public String get<%= field.fieldInJavaBeanMethod %>ContentType() {
|
|
@@ -205,6 +214,7 @@ for (relationship of relationships.filter(relationship => !relationship.embedded
|
|
|
205
214
|
this.<%= field.fieldName %>ContentType = <%= field.fieldName %>ContentType;
|
|
206
215
|
}
|
|
207
216
|
<%_ } _%>
|
|
217
|
+
<&_ } -&>
|
|
208
218
|
<%_ } _%>
|
|
209
219
|
|
|
210
220
|
<&- fragments.classAdditionalFieldsMethodsSection('\n\n') -&>
|
|
@@ -22,6 +22,13 @@
|
|
|
22
22
|
-%>
|
|
23
23
|
<&_ if (fragment.importSection) { -&>
|
|
24
24
|
import org.springframework.data.domain.Persistable;
|
|
25
|
+
<%_ if (!relationshipsContainOtherSideIgnore) { _%>
|
|
26
|
+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
27
|
+
<%_ } _%>
|
|
28
|
+
<&_ } -&>
|
|
29
|
+
|
|
30
|
+
<&_ if (fragment.annotationSection) { -&>
|
|
31
|
+
@JsonIgnoreProperties(value = { "new" })
|
|
25
32
|
<&_ } -&>
|
|
26
33
|
|
|
27
34
|
<&_ if (fragment.additionalInterfacesSection) { -&>
|
|
@@ -51,4 +58,4 @@ import org.springframework.data.domain.Persistable;
|
|
|
51
58
|
this.isPersisted = true;
|
|
52
59
|
return this;
|
|
53
60
|
}
|
|
54
|
-
<&_ } -&>
|
|
61
|
+
<&_ } -&>
|
|
@@ -37,6 +37,7 @@ import java.util.List;
|
|
|
37
37
|
import java.util.Map;
|
|
38
38
|
import java.util.Map.Entry;
|
|
39
39
|
import java.util.Optional;
|
|
40
|
+
import org.apache.commons.lang3.StringUtils;
|
|
40
41
|
import org.springframework.data.domain.Pageable;
|
|
41
42
|
import io.r2dbc.spi.Row;
|
|
42
43
|
import io.r2dbc.spi.RowMetadata;
|
|
@@ -148,7 +149,11 @@ _%>
|
|
|
148
149
|
|
|
149
150
|
@Override
|
|
150
151
|
public Mono<<%= persistClass %>> findById(<%= primaryKey.type %> id) {
|
|
152
|
+
<%_ if (primaryKey.type != 'Long') { _%>
|
|
153
|
+
Comparison whereClause = Conditions.isEqual(entityTable.column("<%= primaryKey.fields[0].columnName %>"), Conditions.just(StringUtils.wrap(id.toString(), "'")));
|
|
154
|
+
<%_ } else { _%>
|
|
151
155
|
Comparison whereClause = Conditions.isEqual(entityTable.column("<%= primaryKey.fields[0].columnName %>"), Conditions.just(id.toString()));
|
|
156
|
+
<%_ }_%>
|
|
152
157
|
return createQuery(null, whereClause).one();
|
|
153
158
|
}
|
|
154
159
|
|
package/generators/entity-server/templates/src/main/java/package/service/EntityQueryService.java.ejs
CHANGED
|
@@ -78,7 +78,7 @@ public class <%= serviceClassName %> extends QueryService<<%= persistClass %>> {
|
|
|
78
78
|
*/
|
|
79
79
|
@Transactional(readOnly = true)
|
|
80
80
|
public List<<%= instanceType %>> findByCriteria(<%= criteria %> criteria) {
|
|
81
|
-
log.debug("find by criteria : {}", criteria
|
|
81
|
+
log.debug("find by criteria : {}", criteria);
|
|
82
82
|
final Specification<<%= persistClass %>> specification = createSpecification(criteria);
|
|
83
83
|
<%_ if (dtoMapstruct) { _%>
|
|
84
84
|
return <%= entityListToDto %>(<%= repository %>.findAll(specification));
|
|
@@ -95,7 +95,7 @@ public class <%= serviceClassName %> extends QueryService<<%= persistClass %>> {
|
|
|
95
95
|
*/
|
|
96
96
|
@Transactional(readOnly = true)
|
|
97
97
|
public Page<<%= instanceType %>> findByCriteria(<%= criteria %> criteria, Pageable page) {
|
|
98
|
-
log.debug("find by criteria : {}, page: {}", criteria
|
|
98
|
+
log.debug("find by criteria : {}, page: {}", criteria, page);
|
|
99
99
|
final Specification<<%= persistClass %>> specification = createSpecification(criteria);
|
|
100
100
|
<%_ if (dtoMapstruct) { _%>
|
|
101
101
|
return <%= repository %>.findAll(specification, page)
|
|
@@ -112,7 +112,7 @@ public class <%= serviceClassName %> extends QueryService<<%= persistClass %>> {
|
|
|
112
112
|
*/
|
|
113
113
|
@Transactional(readOnly = true)
|
|
114
114
|
public long countByCriteria(<%= criteria %> criteria) {
|
|
115
|
-
log.debug("count by criteria : {}", criteria
|
|
115
|
+
log.debug("count by criteria : {}", criteria);
|
|
116
116
|
final Specification<<%= persistClass %>> specification = createSpecification(criteria);
|
|
117
117
|
return <%= repository %>.count(specification);
|
|
118
118
|
}
|
|
@@ -134,7 +134,7 @@ public class <%= serviceClassName %> extends QueryService<<%= persistClass %>> {
|
|
|
134
134
|
}
|
|
135
135
|
<%_
|
|
136
136
|
fields.forEach((field) => {
|
|
137
|
-
if (field.id) return;
|
|
137
|
+
if (field.id || field.transient) return;
|
|
138
138
|
if (isFilterableType(field.fieldType)) { _%>
|
|
139
139
|
if (criteria.get<%= field.fieldInJavaBeanMethod %>() != null) {
|
|
140
140
|
specification = specification.and(<%= getSpecificationBuilder(field.fieldType) %>(criteria.get<%= field.fieldInJavaBeanMethod %>(), <%= persistClass %>_.<%= field.fieldName %>));
|
package/generators/entity-server/templates/src/main/java/package/service/EntityService.java.ejs
CHANGED
|
@@ -142,17 +142,19 @@ public interface <%= entityClass %>Service {
|
|
|
142
142
|
* @return a Mono to signal the deletion
|
|
143
143
|
<%_ } _%>
|
|
144
144
|
*/
|
|
145
|
-
<%- reactive ? 'Mono<Void>' : 'void' %> delete(<%= primaryKey.type %> id)
|
|
145
|
+
<%- reactive ? 'Mono<Void>' : 'void' %> delete(<%= primaryKey.type %> id);
|
|
146
|
+
<%_ if (searchEngine) { _%>
|
|
146
147
|
|
|
147
148
|
/**
|
|
148
149
|
* Search for the <%= entityInstance %> corresponding to the query.
|
|
149
150
|
*
|
|
150
151
|
* @param query the query of the search.
|
|
151
|
-
<%_ if (!paginationNo) { _%>
|
|
152
|
+
<%_ if (!paginationNo) { _%>
|
|
152
153
|
*
|
|
153
154
|
* @param pageable the pagination information.
|
|
154
|
-
<%_ } _%>
|
|
155
|
+
<%_ } _%>
|
|
155
156
|
* @return the list of entities.
|
|
156
157
|
*/
|
|
157
|
-
<% if (!paginationNo) { %><%= pageOrFlux %><<%= instanceType %><% } else { %><%= listOrFlux %><<%= instanceType %><% } %>> search(String query<% if (!paginationNo) { %>, Pageable pageable<% } %>)
|
|
158
|
+
<% if (!paginationNo) { %><%= pageOrFlux %><<%= instanceType %><% } else { %><%= listOrFlux %><<%= instanceType %><% } %>> search(String query<% if (!paginationNo) { %>, Pageable pageable<% } %>);
|
|
159
|
+
<%_ } _%>
|
|
158
160
|
}
|
|
@@ -7,36 +7,12 @@ import tech.jhipster.service.Criteria;
|
|
|
7
7
|
<%_ for (const field of fields) { if (field.fieldIsEnum === true) { _%>
|
|
8
8
|
import <%= entityAbsolutePackage %>.domain.enumeration.<%= field.fieldType %>;
|
|
9
9
|
<%_ } } _%>
|
|
10
|
-
import tech.jhipster.service.filter
|
|
11
|
-
import tech.jhipster.service.filter.DoubleFilter;
|
|
12
|
-
import tech.jhipster.service.filter.Filter;
|
|
13
|
-
import tech.jhipster.service.filter.FloatFilter;
|
|
14
|
-
import tech.jhipster.service.filter.IntegerFilter;
|
|
15
|
-
import tech.jhipster.service.filter.LongFilter;
|
|
16
|
-
import tech.jhipster.service.filter.StringFilter;
|
|
17
|
-
<%_ if (fieldsContainBigDecimal) { _%>
|
|
18
|
-
import tech.jhipster.service.filter.BigDecimalFilter;
|
|
19
|
-
<%_ } _%>
|
|
20
|
-
<%_ if (fieldsContainDuration) { _%>
|
|
21
|
-
import tech.jhipster.service.filter.DurationFilter;
|
|
22
|
-
<%_ } _%>
|
|
23
|
-
<%_ if (fieldsContainInstant) { _%>
|
|
24
|
-
import tech.jhipster.service.filter.InstantFilter;
|
|
25
|
-
<%_ } _%>
|
|
26
|
-
<%_ if (fieldsContainLocalDate) { _%>
|
|
27
|
-
import tech.jhipster.service.filter.LocalDateFilter;
|
|
28
|
-
<%_ } _%>
|
|
29
|
-
<%_ if (fieldsContainUUID || otherEntityPrimaryKeyTypesIncludesUUID) { _%>
|
|
30
|
-
import tech.jhipster.service.filter.UUIDFilter;
|
|
31
|
-
<%_ } _%>
|
|
32
|
-
<%_ if (fieldsContainZonedDateTime) { _%>
|
|
33
|
-
import tech.jhipster.service.filter.ZonedDateTimeFilter;
|
|
34
|
-
<%_ } _%>
|
|
10
|
+
import tech.jhipster.service.filter.*;
|
|
35
11
|
|
|
36
12
|
<%_
|
|
37
13
|
var filterVariables = [];
|
|
38
14
|
var extraFilters = {};
|
|
39
|
-
fields.forEach((field) => {
|
|
15
|
+
fields.filter(field => !field.transient).forEach((field) => {
|
|
40
16
|
const fieldType = field.fieldType;
|
|
41
17
|
if (isFilterableType(fieldType)) {
|
|
42
18
|
var filterType;
|
|
@@ -78,6 +54,7 @@ _%>
|
|
|
78
54
|
* fix type specific filters.
|
|
79
55
|
*/
|
|
80
56
|
@ParameterObject
|
|
57
|
+
@SuppressWarnings("common-java:DuplicatedBlocks")
|
|
81
58
|
public class <%= entityClass %>Criteria implements Serializable, Criteria {
|
|
82
59
|
<%_ Object.keys(extraFilters).forEach((key) => {
|
|
83
60
|
extraFilter = extraFilters[key]; _%>
|
package/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs
CHANGED
|
@@ -68,6 +68,7 @@ import <%= `${otherEntity.entityAbsolutePackage}.service.dto.${otherEntity.dtoCl
|
|
|
68
68
|
<%_ if (typeof javadoc !== 'undefined') { _%>
|
|
69
69
|
@Schema(description = "<%- formatAsApiDescription(javadoc) %>")
|
|
70
70
|
<%_ } _%>
|
|
71
|
+
@SuppressWarnings("common-java:DuplicatedBlocks")
|
|
71
72
|
public class <%= dtoClass %> implements Serializable {
|
|
72
73
|
|
|
73
74
|
<%_ for (reference of dtoReferences) {
|
|
@@ -127,7 +127,7 @@ public class <%= serviceClassName %><% if (serviceImpl) { %> implements <%= enti
|
|
|
127
127
|
@Override
|
|
128
128
|
<%_ } _%>
|
|
129
129
|
public <% if (reactive) { %>Mono<<% } %><%= instanceType %><% if (reactive) { %>><% } %> update(<%= instanceType %> <%= instanceName %>) {
|
|
130
|
-
log.debug("Request to
|
|
130
|
+
log.debug("Request to update <%= entityClass %> : {}", <%= instanceName %>);
|
|
131
131
|
<%- include('/partials/update_template', {updatableEntity, viaService: false, returnDirectly: true, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, isPersisted: requiresPersistableImplementation}); -%>
|
|
132
132
|
}
|
|
133
133
|
|