generator-jhipster 7.7.0 → 7.8.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 +1 -2
- package/generators/app/index.js +10 -0
- package/generators/ci-cd/index.js +1 -1
- package/generators/ci-cd/templates/github-actions.yml.ejs +4 -4
- package/generators/client/files-common.js +1 -2
- package/generators/client/files-react.js +25 -2
- package/generators/client/index.js +1 -1
- package/generators/client/needle-api/needle-client-react.js +11 -8
- package/generators/client/templates/angular/angular.json.ejs +1 -9
- package/generators/client/templates/angular/jest.conf.js.ejs +1 -1
- package/generators/client/templates/angular/package.json +17 -18
- package/generators/client/templates/angular/package.json.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/list/user-management.component.ts.ejs +1 -1
- 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/webpack/webpack.custom.js.ejs +12 -1
- package/generators/client/templates/common/package.json +7 -6
- package/generators/client/templates/common/webpack/webpack.microfrontend.js.jhi.ejs +2 -3
- package/generators/client/templates/react/.eslintrc.json.ejs +1 -1
- package/generators/client/templates/react/jest.conf.js.ejs +1 -1
- package/generators/client/templates/react/package.json +30 -31
- package/generators/client/templates/react/package.json.ejs +1 -0
- package/generators/client/templates/react/src/main/webapp/app/app.scss.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/config/store.ts.ejs +53 -6
- package/generators/client/templates/react/src/main/webapp/app/config/translation-middleware.ts.ejs +58 -0
- package/generators/client/templates/react/src/main/webapp/app/entities/menu.tsx.ejs +45 -0
- package/generators/client/templates/react/src/main/webapp/app/entities/reducers.ts.ejs +25 -0
- package/generators/client/templates/react/src/main/webapp/app/entities/routes.tsx.ejs +47 -0
- package/generators/client/templates/react/src/main/webapp/app/index.tsx.ejs +7 -7
- package/generators/client/templates/react/src/main/webapp/app/main.tsx.ejs +19 -0
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/logs/logs.tsx.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs +2 -1
- package/generators/client/templates/react/src/main/webapp/app/modules/login/login-modal.tsx.ejs +5 -1
- package/generators/client/templates/react/src/main/webapp/app/routes.tsx.ejs +24 -7
- package/generators/client/templates/react/src/main/webapp/app/shared/error/error-loading.tsx.ejs +15 -0
- package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/entities.tsx.ejs +34 -6
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/index.ts.ejs +9 -2
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +9 -3
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.ts.ejs +21 -5
- package/generators/client/templates/react/src/main/webapp/app/typings.d.ts.ejs +15 -0
- package/generators/client/templates/react/src/main/webapp/microfrontends/entities-menu.tsx.ejs +3 -0
- package/generators/client/templates/react/src/main/webapp/microfrontends/entities-routes.tsx.ejs +3 -0
- package/generators/client/templates/react/tsconfig.json.ejs +3 -3
- package/generators/client/templates/react/tsconfig.test.json.ejs +9 -1
- package/generators/client/templates/react/webpack/webpack.common.js.ejs +6 -13
- package/generators/client/templates/react/webpack/webpack.dev.js.ejs +7 -8
- package/generators/client/templates/react/webpack/webpack.microfrontend.js.jhi.react.ejs +99 -0
- package/generators/client/templates/react/webpack/webpack.prod.js.ejs +31 -21
- package/generators/client/templates/vue/package.json +16 -17
- package/generators/client/templates/vue/package.json.ejs +1 -1
- package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +1 -0
- package/generators/client/templates/vue/src/main/webapp/app/shared/data/data-utils.service.ts.ejs +1 -1
- package/generators/client/templates/vue/src/test/javascript/jest.conf.js.ejs +2 -2
- package/generators/client/templates/vue/tsconfig.json.ejs +0 -3
- package/generators/client/templates/vue/webpack/webpack.common.js.ejs +6 -2
- package/generators/common/templates/package.json +2 -2
- package/generators/docker-compose/index.js +9 -5
- package/generators/entity/index.js +34 -19
- package/generators/entity-client/index.js +8 -0
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/update/entity-management-update.component.ts.ejs +1 -1
- package/generators/entity-client/templates/common/src/test/javascript/cypress/integration/entity/entity.spec.ts.ejs +1 -0
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-delete-dialog.tsx.ejs +3 -3
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-detail.tsx.ejs +5 -4
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs +19 -18
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.reducer.ts.ejs +2 -2
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.tsx.ejs +21 -20
- package/generators/entity-i18n/templates/i18n/entity_fr.json.ejs +1 -1
- package/generators/entity-server/files.js +30 -10
- package/generators/entity-server/index.js +19 -1
- package/generators/entity-server/templates/couchbase/src/main/java/package/domain/Entity.java.jhi.spring_data_couchbase.ejs +1 -1
- package/generators/entity-server/templates/couchbase/src/main/java/package/repository/EntityRepository.java.ejs +31 -8
- package/generators/entity-server/templates/partials/update_template.ejs +77 -0
- package/generators/entity-server/templates/reactive/partials/save_template.ejs +1 -1
- package/generators/entity-server/templates/reactive/partials/update_template.ejs +41 -0
- package/generators/entity-server/templates/src/main/java/package/common/get_all_template.ejs +5 -5
- package/generators/entity-server/templates/src/main/java/package/common/get_template.ejs +1 -1
- package/generators/entity-server/templates/src/main/java/package/common/inject_template.ejs +13 -4
- package/generators/entity-server/templates/src/main/java/package/common/patch_template.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.ejs +2 -1
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.javax_lifecycle_events.ejs +31 -0
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_persistable.ejs +54 -0
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_reactive.ejs +1 -1
- package/generators/entity-server/templates/src/main/java/package/domain/EntityCallback.java.ejs +43 -0
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepository.java.ejs +6 -6
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryInternalImpl_reactive.java.ejs +13 -16
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryWithBagRelationshipsImpl.java.ejs +4 -3
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepository_reactive.java.ejs +15 -23
- package/generators/entity-server/templates/src/main/java/package/repository/EntitySqlHelper_reactive.java.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/repository/rowmapper/EntityRowMapper.java.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/repository/search/EntitySearchRepository.java.ejs +12 -25
- package/generators/entity-server/templates/src/main/java/package/service/EntityService.java.ejs +10 -2
- package/generators/entity-server/templates/src/main/java/package/service/impl/EntityServiceImpl.java.ejs +21 -5
- package/generators/entity-server/templates/src/main/java/package/service/mapper/EntityMapper.java.ejs +61 -90
- package/generators/entity-server/templates/src/main/java/package/web/rest/EntityResource.java.ejs +6 -4
- package/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs +28 -15
- package/generators/generator-base-private.js +1 -1
- package/generators/generator-base.js +29 -0
- package/generators/generator-constants.js +5 -5
- package/generators/generator-transforms.js +0 -1
- package/generators/gradle/constants.cjs +1 -1
- package/generators/maven/files.cjs +0 -1
- package/generators/maven/templates/.mvn/wrapper/maven-wrapper.jar +0 -0
- package/generators/maven/templates/.mvn/wrapper/maven-wrapper.properties +18 -2
- package/generators/maven/templates/mvnw +13 -7
- package/generators/maven/templates/mvnw.cmd +19 -13
- package/generators/maven/templates/pom.xml.jhi.ejs +1 -1
- package/generators/server/cleanup.js +19 -3
- package/generators/server/files.js +101 -17
- package/generators/server/index.js +11 -5
- package/generators/server/needle-api/needle-server-gradle.js +38 -0
- package/generators/server/templates/.mvn/jvm.config +1 -0
- package/generators/server/templates/.mvn/wrapper/maven-wrapper.jar +0 -0
- package/generators/server/templates/.mvn/wrapper/maven-wrapper.properties +18 -2
- package/generators/server/templates/build.gradle.ejs +7 -5
- package/generators/server/templates/couchbase/src/main/java/package/repository/JHipsterCouchbaseRepository.java.ejs +24 -1
- package/generators/server/templates/devcontainer/Dockerfile.ejs +25 -0
- package/generators/server/templates/devcontainer/devcontainer.json.ejs +64 -0
- package/generators/server/templates/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/generators/server/templates/gradle.properties.ejs +4 -4
- package/generators/server/templates/mvnw +13 -7
- package/generators/server/templates/mvnw.cmd +19 -13
- package/generators/server/templates/pom.xml.ejs +19 -17
- package/generators/server/templates/settings.gradle.ejs +6 -4
- package/generators/server/templates/src/main/docker/app.yml.ejs +2 -6
- package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs +2 -1
- package/generators/server/templates/src/main/docker/mysql.yml.ejs +1 -0
- package/generators/server/templates/src/main/java/package/config/AsyncConfiguration.java.ejs +6 -0
- package/generators/{client/templates/react/src/main/webapp/app/entities/index.tsx.ejs → server/templates/src/main/java/package/config/KafkaSseConsumer.java.ejs} +8 -14
- package/generators/server/templates/src/main/java/package/config/KafkaSseProducer.java.ejs +30 -0
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +12 -10
- package/generators/server/templates/src/main/java/package/repository/EntityManager.java.ejs +3 -3
- package/generators/server/templates/src/main/java/package/security/jwt/JWTFilter.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/security/jwt/TokenProvider.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/web/rest/KafkaResource.java.ejs +60 -108
- package/generators/server/templates/src/main/java/package/web/rest/KafkaResource_reactive.java.ejs +74 -0
- package/generators/server/templates/src/main/resources/config/application.yml.ejs +26 -22
- package/generators/server/templates/src/test/java/package/CassandraKeyspaceIT.java.ejs +3 -4
- package/generators/server/templates/src/test/java/package/IntegrationTest.java.ejs +9 -3
- package/generators/server/templates/src/test/java/package/TechnicalStructureTest.java.ejs +0 -3
- package/generators/server/templates/src/test/java/package/config/CassandraTestContainer.java.ejs +122 -0
- package/generators/server/templates/src/test/java/package/config/EmbeddedCassandra.java.ejs +11 -0
- package/generators/server/templates/src/test/java/package/config/EmbeddedKafka.java.ejs +11 -0
- package/generators/server/templates/src/test/java/package/config/EmbeddedMongo.java.ejs +11 -0
- package/generators/server/templates/src/test/java/package/config/KafkaTestContainer.java.ejs +38 -0
- package/generators/server/templates/src/test/java/package/config/MongoDbTestContainer.java.ejs +67 -0
- package/generators/server/templates/src/test/java/package/config/TestContainersSpringContextCustomizerFactory.java.ejs +114 -0
- package/generators/server/templates/src/test/java/package/cucumber/CucumberIT.java.ejs +3 -10
- package/generators/server/templates/src/test/java/package/security/DomainUserDetailsServiceIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/security/jwt/JWTFilterTest.java.ejs +5 -5
- package/generators/server/templates/src/test/java/package/service/MailServiceIT.java.ejs +2 -4
- package/generators/server/templates/src/test/java/package/service/UserServiceIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT.java.ejs +3 -3
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT_oauth2.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT_skipUserManagement.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/KafkaResourceIT.java.ejs +52 -123
- package/generators/server/templates/src/test/java/package/web/rest/KafkaResourceIT_reactive.java.ejs +99 -0
- package/generators/server/templates/src/test/java/package/web/rest/PublicUserResourceIT.java.ejs +7 -10
- package/generators/server/templates/src/test/java/package/web/rest/UserJWTControllerIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/UserResourceIT.java.ejs +2 -5
- package/generators/server/templates/src/test/java/package/web/rest/errors/ExceptionTranslatorIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/errors/ExceptionTranslatorIT_reactive.java.ejs +1 -4
- package/generators/server/templates/src/test/resources/META-INF/spring.factories.ejs +1 -1
- package/generators/server/templates/src/test/resources/config/application.yml.ejs +21 -20
- package/generators/server/templates/src/test/resources/testcontainers.properties.ejs +1 -0
- package/generators/workspaces/index.js +2 -1
- package/package.json +15 -15
- package/utils/entity.js +2 -0
- package/utils/field.js +8 -3
- package/utils/relationship.js +10 -1
- package/generators/entity-server/templates/src/main/java/package/repository/search/SortToSortBuilderListConverter.java.ejs +0 -25
- package/generators/maven/templates/.mvn/wrapper/MavenWrapperDownloader.java +0 -117
- package/generators/server/templates/.mvn/wrapper/MavenWrapperDownloader.java +0 -117
- package/generators/server/templates/src/main/java/package/config/KafkaProperties.java.ejs +0 -68
- package/generators/server/templates/src/test/java/package/AbstractCassandraTest.java.ejs +0 -125
- package/generators/server/templates/src/test/java/package/MongoDbTestContainerExtension.java.ejs +0 -37
- package/generators/server/templates/src/test/java/package/TestContainersSpringContextCustomizerFactory.java.ejs +0 -24
|
@@ -220,7 +220,7 @@ _%>
|
|
|
220
220
|
}
|
|
221
221
|
<%_ for (reference of Object.values(differentRelationships).filter(arr => arr.some(rel => rel.reference.owned && rel.otherEntity.primaryKey)).map(arr => arr[0].reference)) { _%>
|
|
222
222
|
|
|
223
|
-
track<%= reference.relationship.otherEntity.entityAngularName %>By<%= reference.relationship.otherEntity.primaryKey.nameCapitalized %>(
|
|
223
|
+
track<%= reference.relationship.otherEntity.entityAngularName %>By<%= reference.relationship.otherEntity.primaryKey.nameCapitalized %>(_index: number, item: I<%= reference.relationship.otherEntity.entityAngularName %>): <%= getTypescriptKeyType(reference.relationship.otherEntity.primaryKey.type) %> {
|
|
224
224
|
return item.<%= reference.relationship.otherEntity.primaryKey.name %>!;
|
|
225
225
|
}
|
|
226
226
|
<%_ } _%>
|
|
@@ -24,6 +24,7 @@ const otherEntities = _.uniq(Object.values(differentRelationships).filter(rels =
|
|
|
24
24
|
const skipCreateTest =
|
|
25
25
|
(
|
|
26
26
|
!cypressBootstrapEntities ||
|
|
27
|
+
requiredRelationships.some(rel => rel.otherEntity.primaryKey && rel.otherEntity.primaryKey.derived) ||
|
|
27
28
|
requiredRelationships.some(rel => rel.otherEntity.builtInUser || rel.otherEntity === this.entity) ||
|
|
28
29
|
requiredRelationships.map(rel => rel.otherEntity.relationships).flat().some(rel => rel.relationshipRequired) ||
|
|
29
30
|
!entityFakeData
|
|
@@ -34,11 +34,11 @@ export const <%= entityReactName %>DeleteDialog = (props: RouteComponentProps<{
|
|
|
34
34
|
setLoadModal(true);
|
|
35
35
|
}, []);
|
|
36
36
|
|
|
37
|
-
const <%= entityInstance %>Entity = useAppSelector(state => state.<%=
|
|
38
|
-
const updateSuccess = useAppSelector(state => state.<%=
|
|
37
|
+
const <%= entityInstance %>Entity = useAppSelector(state => state.<%= entityReactState %>.entity);
|
|
38
|
+
const updateSuccess = useAppSelector(state => state.<%= entityReactState %>.updateSuccess);
|
|
39
39
|
|
|
40
40
|
const handleClose = () => {
|
|
41
|
-
props.history.push('/<%=
|
|
41
|
+
props.history.push('/<%= entityPage %>'<%_ if (paginationPagination) { _%> + props.location.search<%_ } _%>);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
useEffect(() => {
|
package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-detail.tsx.ejs
CHANGED
|
@@ -33,13 +33,14 @@ import {
|
|
|
33
33
|
} from 'react-jhipster';
|
|
34
34
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
35
35
|
|
|
36
|
-
import { getEntity } from './<%= entityFileName %>.reducer';
|
|
37
36
|
import { APP_DATE_FORMAT, APP_LOCAL_DATE_FORMAT } from 'app/config/constants';
|
|
38
37
|
<%_ if (fieldsContainDuration) { _%>
|
|
39
38
|
import { DurationFormat } from 'app/shared/DurationFormat';
|
|
40
39
|
<%_ } _%>
|
|
41
40
|
import { useAppDispatch, useAppSelector } from 'app/config/store';
|
|
42
41
|
|
|
42
|
+
import { getEntity } from './<%= entityFileName %>.reducer';
|
|
43
|
+
|
|
43
44
|
export const <%= entityReactName %>Detail = (props: RouteComponentProps<{id: string}>) => {
|
|
44
45
|
const dispatch = useAppDispatch();
|
|
45
46
|
|
|
@@ -47,7 +48,7 @@ export const <%= entityReactName %>Detail = (props: RouteComponentProps<{id: str
|
|
|
47
48
|
dispatch(getEntity(props.match.params.id));
|
|
48
49
|
}, []);
|
|
49
50
|
|
|
50
|
-
const <%= entityInstance %>Entity = useAppSelector(state => state.<%=
|
|
51
|
+
const <%= entityInstance %>Entity = useAppSelector(state => state.<%= entityReactState %>.entity);
|
|
51
52
|
return (
|
|
52
53
|
<Row>
|
|
53
54
|
<Col md="8">
|
|
@@ -152,10 +153,10 @@ _%>
|
|
|
152
153
|
<%_ } _%>
|
|
153
154
|
<%_ } _%>
|
|
154
155
|
</dl>
|
|
155
|
-
<Button tag={Link} to="/<%=
|
|
156
|
+
<Button tag={Link} to="/<%= entityPage %>" replace color="info" data-cy="entityDetailsBackButton">
|
|
156
157
|
<FontAwesomeIcon icon="arrow-left" /> <span className="d-none d-md-inline" ><Translate contentKey="entity.action.back">Back</Translate></span>
|
|
157
158
|
</Button>
|
|
158
|
-
<Button tag={Link} to={`/<%=
|
|
159
|
+
<Button tag={Link} to={`/<%= entityPage %>/${<%= entityInstance %>Entity.<%= primaryKey.name %>}/edit`} replace color="primary">
|
|
159
160
|
<FontAwesomeIcon icon="pencil-alt" /> <span className="d-none d-md-inline"><Translate contentKey="entity.action.edit">Edit</Translate></span>
|
|
160
161
|
</Button>
|
|
161
162
|
</Col>
|
package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
CHANGED
|
@@ -43,6 +43,12 @@ import {
|
|
|
43
43
|
} from 'react-jhipster';
|
|
44
44
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
45
45
|
|
|
46
|
+
import { convertDateTimeFromServer, convertDateTimeToServer, displayDefaultDateTime } from 'app/shared/util/date-utils';
|
|
47
|
+
<%_ if (relationships.filter(e => e.relationshipManyToMany) !== undefined) { _%>
|
|
48
|
+
import { mapIdList } from 'app/shared/util/entity-utils';
|
|
49
|
+
<%_ } _%>
|
|
50
|
+
import { useAppDispatch, useAppSelector } from 'app/config/store';
|
|
51
|
+
|
|
46
52
|
<%_
|
|
47
53
|
let hasRelationshipQuery = false;
|
|
48
54
|
let otherEntityActions = new Set();
|
|
@@ -72,7 +78,7 @@ Object.keys(differentRelationships).forEach(key => {
|
|
|
72
78
|
action: `get${upperFirstCamelCase(uniqueRel.otherEntityNamePlural)}`,
|
|
73
79
|
instance: `${uniqueRel.otherEntityNamePlural}`,
|
|
74
80
|
entity: uniqueRel.otherEntityAngularName,
|
|
75
|
-
reducer: uniqueRel.
|
|
81
|
+
reducer: uniqueRel.otherEntity.builtInUser ? `userManagement.${uniqueRel.otherEntityNamePlural}` : `${uniqueRel.otherEntity.entityReactState}.entities`,
|
|
76
82
|
});
|
|
77
83
|
if (uniqueRel.otherEntityAngularName === 'User') {
|
|
78
84
|
_%>
|
|
@@ -90,22 +96,17 @@ import { getEntities as get<%= upperFirstCamelCase(uniqueRel.otherEntityNamePlur
|
|
|
90
96
|
<%_ } _%>
|
|
91
97
|
<%_ } _%>
|
|
92
98
|
<%_ }); _%>
|
|
99
|
+
import { I<%= entityReactName %> } from 'app/shared/model/<%= entityModelFileName %>.model';
|
|
100
|
+
<%_ const enumImports = generateEntityClientEnumImports(fields); _%>
|
|
101
|
+
<%_ enumImports.forEach( (importedPath, importedType) => { _%>
|
|
102
|
+
import { <%- importedType %> } from '<%- importedPath %>';
|
|
103
|
+
<%_ }); _%>
|
|
93
104
|
import {
|
|
94
105
|
getEntity,
|
|
95
106
|
updateEntity,
|
|
96
107
|
createEntity,
|
|
97
108
|
reset
|
|
98
109
|
} from './<%= entityFileName %>.reducer';
|
|
99
|
-
import { I<%= entityReactName %> } from 'app/shared/model/<%= entityModelFileName %>.model';
|
|
100
|
-
import { convertDateTimeFromServer, convertDateTimeToServer, displayDefaultDateTime } from 'app/shared/util/date-utils';
|
|
101
|
-
<%_ if (relationships.filter(e => e.relationshipManyToMany) !== undefined) { _%>
|
|
102
|
-
import { mapIdList } from 'app/shared/util/entity-utils';
|
|
103
|
-
<%_ } _%>
|
|
104
|
-
import { useAppDispatch, useAppSelector } from 'app/config/store';
|
|
105
|
-
<%_ const enumImports = generateEntityClientEnumImports(fields); _%>
|
|
106
|
-
<%_ enumImports.forEach( (importedPath, importedType) => { _%>
|
|
107
|
-
import { <%- importedType %> } from '<%- importedPath %>';
|
|
108
|
-
<%_ }); _%>
|
|
109
110
|
|
|
110
111
|
export const <%= entityReactName %>Update = (props: RouteComponentProps<{id: string}>) => {
|
|
111
112
|
const dispatch = useAppDispatch();
|
|
@@ -113,17 +114,17 @@ export const <%= entityReactName %>Update = (props: RouteComponentProps<{id: str
|
|
|
113
114
|
const [isNew] = useState(!props.match.params || !props.match.params.id);
|
|
114
115
|
|
|
115
116
|
<%_ otherEntityActions.forEach(val => { _%>
|
|
116
|
-
const <%= val.instance %> = useAppSelector(state => state.<%= val.reducer
|
|
117
|
+
const <%= val.instance %> = useAppSelector(state => state.<%= val.reducer %>);
|
|
117
118
|
<%_ }) _%>
|
|
118
|
-
const <%= entityInstance %>Entity = useAppSelector(state => state.<%=
|
|
119
|
-
const loading = useAppSelector(state => state.<%=
|
|
120
|
-
const updating = useAppSelector(state => state.<%=
|
|
121
|
-
const updateSuccess = useAppSelector(state => state.<%=
|
|
119
|
+
const <%= entityInstance %>Entity = useAppSelector(state => state.<%= entityReactState %>.entity);
|
|
120
|
+
const loading = useAppSelector(state => state.<%= entityReactState %>.loading);
|
|
121
|
+
const updating = useAppSelector(state => state.<%= entityReactState %>.updating);
|
|
122
|
+
const updateSuccess = useAppSelector(state => state.<%= entityReactState %>.updateSuccess);
|
|
122
123
|
<%_ enumImports.forEach( (importedPath, importedType) => { _%>
|
|
123
124
|
const <%- _.lowerFirst(importedType) %>Values = Object.keys(<%- importedType %>);
|
|
124
125
|
<%_ }); _%>
|
|
125
126
|
const handleClose = () => {
|
|
126
|
-
props.history.push('/<%=
|
|
127
|
+
props.history.push('/<%= entityPage %>'<%_ if (paginationPagination) { _%> + props.location.search<%_ } _%>);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
useEffect(() => {
|
|
@@ -383,7 +384,7 @@ _%>
|
|
|
383
384
|
</ValidatedField>
|
|
384
385
|
<%_ } _%>
|
|
385
386
|
<%_ }) _%>
|
|
386
|
-
<Button tag={Link} id="cancel-save" data-cy="entityCreateCancelButton" to="/<%=
|
|
387
|
+
<Button tag={Link} id="cancel-save" data-cy="entityCreateCancelButton" to="/<%= entityPage %>" replace color="info">
|
|
387
388
|
<FontAwesomeIcon icon="arrow-left" />
|
|
388
389
|
<span className="d-none d-md-inline" ><Translate contentKey="entity.action.back">Back</Translate></span>
|
|
389
390
|
</Button>
|
package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.reducer.ts.ejs
CHANGED
|
@@ -45,9 +45,9 @@ const initialState: EntityState<I<%= entityReactName %>> = {
|
|
|
45
45
|
updateSuccess: false
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const apiUrl = '
|
|
48
|
+
const apiUrl = '<%= entityApi %>api/<%= entityApiUrl %>';
|
|
49
49
|
<%_ if (searchEngine) { _%>
|
|
50
|
-
const apiSearchUrl = '
|
|
50
|
+
const apiSearchUrl = '<%= entityApi %>api/_search/<%= entityApiUrl %>';
|
|
51
51
|
<%_ } _%>
|
|
52
52
|
|
|
53
53
|
// Actions
|
package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.tsx.ejs
CHANGED
|
@@ -40,10 +40,17 @@ import {
|
|
|
40
40
|
} from 'react-jhipster';
|
|
41
41
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
42
42
|
|
|
43
|
+
import { APP_DATE_FORMAT, APP_LOCAL_DATE_FORMAT } from 'app/config/constants';
|
|
44
|
+
<%_ if (!paginationNo) { _%>
|
|
45
|
+
import { ASC, DESC, ITEMS_PER_PAGE, SORT } from 'app/shared/util/pagination.constants';
|
|
46
|
+
import { overridePaginationStateWithQueryParams } from 'app/shared/util/entity-utils';
|
|
47
|
+
<%_ } _%>
|
|
48
|
+
import { useAppDispatch, useAppSelector } from 'app/config/store';
|
|
43
49
|
<%_ if (fieldsContainDuration) { _%>
|
|
44
50
|
import { DurationFormat } from 'app/shared/DurationFormat';
|
|
45
51
|
<%_ } _%>
|
|
46
52
|
|
|
53
|
+
import { I<%= entityReactName %> } from 'app/shared/model/<%= entityModelFileName %>.model';
|
|
47
54
|
import {
|
|
48
55
|
<%_ if (searchEngine) { _%>
|
|
49
56
|
searchEntities,
|
|
@@ -53,13 +60,6 @@ import {
|
|
|
53
60
|
reset,
|
|
54
61
|
<%_ } _%>
|
|
55
62
|
} from './<%= entityFileName %>.reducer';
|
|
56
|
-
import { I<%= entityReactName %> } from 'app/shared/model/<%= entityModelFileName %>.model';
|
|
57
|
-
import { APP_DATE_FORMAT, APP_LOCAL_DATE_FORMAT } from 'app/config/constants';
|
|
58
|
-
<%_ if (!paginationNo) { _%>
|
|
59
|
-
import { ASC, DESC, ITEMS_PER_PAGE, SORT } from 'app/shared/util/pagination.constants';
|
|
60
|
-
import { overridePaginationStateWithQueryParams } from 'app/shared/util/entity-utils';
|
|
61
|
-
<%_ } _%>
|
|
62
|
-
import { useAppDispatch, useAppSelector } from 'app/config/store';
|
|
63
63
|
|
|
64
64
|
export const <%= entityReactName %> = (props: RouteComponentProps<{url: string}>) => {
|
|
65
65
|
const dispatch = useAppDispatch();
|
|
@@ -74,15 +74,15 @@ export const <%= entityReactName %> = (props: RouteComponentProps<{url: string}>
|
|
|
74
74
|
const [sorting, setSorting] = useState(false);
|
|
75
75
|
<%_ } _%>
|
|
76
76
|
|
|
77
|
-
const <%= entityInstance %>List = useAppSelector(state => state.<%=
|
|
78
|
-
const loading = useAppSelector(state => state.<%=
|
|
77
|
+
const <%= entityInstance %>List = useAppSelector(state => state.<%= entityReactState %>.entities);
|
|
78
|
+
const loading = useAppSelector(state => state.<%= entityReactState %>.loading);
|
|
79
79
|
<%_ if (!paginationNo) { _%>
|
|
80
|
-
const totalItems = useAppSelector(state => state.<%=
|
|
80
|
+
const totalItems = useAppSelector(state => state.<%= entityReactState %>.totalItems);
|
|
81
81
|
<%_ } _%>
|
|
82
82
|
<%_ if (paginationInfiniteScroll) { _%>
|
|
83
|
-
const links = useAppSelector(state => state.<%=
|
|
84
|
-
const entity = useAppSelector(state => state.<%=
|
|
85
|
-
const updateSuccess = useAppSelector(state => state.<%=
|
|
83
|
+
const links = useAppSelector(state => state.<%= entityReactState %>.links);
|
|
84
|
+
const entity = useAppSelector(state => state.<%= entityReactState %>.entity);
|
|
85
|
+
const updateSuccess = useAppSelector(state => state.<%= entityReactState %>.updateSuccess);
|
|
86
86
|
<%_ } _%>
|
|
87
87
|
|
|
88
88
|
<%_ if (paginationPagination || paginationInfiniteScroll || !paginationNo && !paginationInfiniteScroll) { _%>
|
|
@@ -293,7 +293,7 @@ export const <%= entityReactName %> = (props: RouteComponentProps<{url: string}>
|
|
|
293
293
|
<FontAwesomeIcon icon="sync" spin={loading} /> <Translate contentKey="<%= i18nKeyPrefix %>.home.refreshListLabel">Refresh List</Translate>
|
|
294
294
|
</Button>
|
|
295
295
|
<%_ if (!readOnly) { _%>
|
|
296
|
-
<Link to=
|
|
296
|
+
<Link to="/<%= entityPage %>/new" className="btn btn-primary jh-create-entity" id="jh-create-entity" data-cy="entityCreateButton">
|
|
297
297
|
<FontAwesomeIcon icon="plus" />
|
|
298
298
|
<Translate contentKey="<%= i18nKeyPrefix %>.home.createLabel">
|
|
299
299
|
Create new <%= entityClassHumanized %>
|
|
@@ -352,7 +352,7 @@ export const <%= entityReactName %> = (props: RouteComponentProps<{url: string}>
|
|
|
352
352
|
<%= entityInstance %>List.map((<%= entityInstance %>, i) => (
|
|
353
353
|
<tr key={`entity-${i}`} data-cy="entityTable">
|
|
354
354
|
<td>
|
|
355
|
-
<Button tag={Link} to={
|
|
355
|
+
<Button tag={Link} to={`/<%= entityPage %>/${<%= entityInstance %>.<%= primaryKey.name %>}`} color="link" size="sm">
|
|
356
356
|
{<%= entityInstance %>.<%= primaryKey.name %>}
|
|
357
357
|
</Button>
|
|
358
358
|
</td>
|
|
@@ -403,6 +403,7 @@ _%>
|
|
|
403
403
|
<%_ } _%>
|
|
404
404
|
<%_ } _%>
|
|
405
405
|
<%_ for (relationship of relationships) {
|
|
406
|
+
const otherEntity = relationship.otherEntity;
|
|
406
407
|
const ownerSide = relationship.ownerSide;
|
|
407
408
|
const relationshipFieldName = relationship.relationshipFieldName;
|
|
408
409
|
const relationshipFieldNamePlural = relationship.relationshipFieldNamePlural;
|
|
@@ -430,13 +431,13 @@ _%>
|
|
|
430
431
|
{
|
|
431
432
|
(<%= entityInstance %>.<%= relationshipFieldNamePlural %>) ?
|
|
432
433
|
(<%= entityInstance %>.<%= relationshipFieldNamePlural %>.map((val, j) =>
|
|
433
|
-
<span key={j}><Link to={
|
|
434
|
+
<span key={j}><Link to={`/<%= otherEntity.entityPage %>/${val.<%= otherEntity.primaryKey.name %>}`}>{val.<%= otherEntityField %>}</Link>{(j === <%= entityInstance %>.<%= relationshipFieldNamePlural %>.length - 1) ? '' : ', '}</span>
|
|
434
435
|
)
|
|
435
436
|
) : null
|
|
436
437
|
}
|
|
437
438
|
<%_ } else { _%>
|
|
438
439
|
{<%= entityInstance + "." + relationshipFieldName %> ?
|
|
439
|
-
<Link to={
|
|
440
|
+
<Link to={`/<%= otherEntity.entityPage %>/${<%= entityInstance + "." + relationshipFieldName + "." + otherEntityPkName + "}" %>`}>
|
|
440
441
|
{<%= entityInstance + "." + relationshipFieldName + "." + otherEntityField %>}
|
|
441
442
|
</Link> : ''}
|
|
442
443
|
<%_ } _%>
|
|
@@ -446,14 +447,14 @@ _%>
|
|
|
446
447
|
<%_ } _%>
|
|
447
448
|
<td className="text-end">
|
|
448
449
|
<div className="btn-group flex-btn-group-container">
|
|
449
|
-
<Button tag={Link} to={
|
|
450
|
+
<Button tag={Link} to={`/<%= entityPage %>/${<%= entityInstance %>.<%= primaryKey.name %>}`} color="info" size="sm" data-cy="entityDetailsButton">
|
|
450
451
|
<FontAwesomeIcon icon="eye" /> <span className="d-none d-md-inline" ><Translate contentKey="entity.action.view">View</Translate></span>
|
|
451
452
|
</Button>
|
|
452
453
|
<%_ if (!readOnly) { _%>
|
|
453
|
-
<Button tag={Link} to={
|
|
454
|
+
<Button tag={Link} to={`/<%= entityPage %>/${<%= entityInstance %>.<%= primaryKey.name %>}/edit<%_ if (paginationPagination) { _%>?page=${paginationState.activePage}&sort=${paginationState.sort},${paginationState.order}<%_ } _%>`} color="primary" size="sm" data-cy="entityEditButton">
|
|
454
455
|
<FontAwesomeIcon icon="pencil-alt" /> <span className="d-none d-md-inline"><Translate contentKey="entity.action.edit">Edit</Translate></span>
|
|
455
456
|
</Button>
|
|
456
|
-
<Button tag={Link} to={
|
|
457
|
+
<Button tag={Link} to={`/<%= entityPage %>/${<%= entityInstance %>.<%= primaryKey.name %>}/delete<%_ if (paginationPagination) { _%>?page=${paginationState.activePage}&sort=${paginationState.sort},${paginationState.order}<%_ } _%>`} color="danger" size="sm" data-cy="entityDeleteButton">
|
|
457
458
|
<FontAwesomeIcon icon="trash" /> <span className="d-none d-md-inline"><Translate contentKey="entity.action.delete">Delete</Translate></span>
|
|
458
459
|
</Button>
|
|
459
460
|
<%_ } _%>
|
|
@@ -39,7 +39,7 @@ let helpBlocks = 0; %>
|
|
|
39
39
|
<%_ } _%>
|
|
40
40
|
<%_ if (!readOnly) { _%>
|
|
41
41
|
"delete": {
|
|
42
|
-
"question": "
|
|
42
|
+
"question": "Êtes-vous certain de vouloir supprimer le <%= entityClassHumanized %> {{ id }} ?"
|
|
43
43
|
},
|
|
44
44
|
<%_ } _%>
|
|
45
45
|
"detail": {
|
|
@@ -78,6 +78,36 @@ const serverFiles = {
|
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
condition: generator => generator.databaseTypeSql && generator.requiresPersistableImplementation,
|
|
83
|
+
path: SERVER_MAIN_SRC_DIR,
|
|
84
|
+
templates: [
|
|
85
|
+
{
|
|
86
|
+
file: 'package/domain/Entity.java.jhi.spring_data_persistable',
|
|
87
|
+
renameTo: generator => `${generator.entityAbsoluteFolder}/domain/${generator.persistClass}.java.jhi.spring_data_persistable`,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
condition: generator => generator.databaseTypeSql && generator.reactive && generator.requiresPersistableImplementation,
|
|
93
|
+
path: SERVER_MAIN_SRC_DIR,
|
|
94
|
+
templates: [
|
|
95
|
+
{
|
|
96
|
+
file: 'package/domain/EntityCallback.java',
|
|
97
|
+
renameTo: generator => `${generator.entityAbsoluteFolder}/domain/${generator.persistClass}Callback.java`,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
condition: generator => generator.databaseTypeSql && !generator.reactive && generator.requiresPersistableImplementation,
|
|
103
|
+
path: SERVER_MAIN_SRC_DIR,
|
|
104
|
+
templates: [
|
|
105
|
+
{
|
|
106
|
+
file: 'package/domain/Entity.java.jhi.javax_lifecycle_events',
|
|
107
|
+
renameTo: generator => `${generator.entityAbsoluteFolder}/domain/${generator.persistClass}.java.jhi.javax_lifecycle_events`,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
81
111
|
{
|
|
82
112
|
condition: generator => generator.databaseTypeCassandra,
|
|
83
113
|
path: SERVER_MAIN_SRC_DIR,
|
|
@@ -172,16 +202,6 @@ const serverFiles = {
|
|
|
172
202
|
},
|
|
173
203
|
],
|
|
174
204
|
},
|
|
175
|
-
{
|
|
176
|
-
condition: generator => generator.searchEngine === ELASTICSEARCH && !generator.embedded && !generator.paginationNo,
|
|
177
|
-
path: SERVER_MAIN_SRC_DIR,
|
|
178
|
-
templates: [
|
|
179
|
-
{
|
|
180
|
-
file: 'package/repository/search/SortToSortBuilderListConverter.java',
|
|
181
|
-
renameTo: generator => `${generator.entityAbsoluteFolder}/repository/search/SortToSortBuilderListConverter.java`,
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
},
|
|
185
205
|
{
|
|
186
206
|
condition: generator => !generator.reactive && !generator.embedded && generator.databaseType !== COUCHBASE,
|
|
187
207
|
path: SERVER_MAIN_SRC_DIR,
|
|
@@ -168,6 +168,17 @@ module.exports = class extends BaseBlueprintGenerator {
|
|
|
168
168
|
this.reactiveUniqueEntityTypes = new Set(this.reactiveEagerRelations.map(rel => rel.otherEntityNameCapitalized));
|
|
169
169
|
this.reactiveUniqueEntityTypes.add(this.entityClass);
|
|
170
170
|
},
|
|
171
|
+
|
|
172
|
+
relationshipsSqlDerivedProperties() {
|
|
173
|
+
if (!this.databaseTypeSql) return;
|
|
174
|
+
for (const relationship of this.relationships) {
|
|
175
|
+
if (!relationship.otherEntity.embedded) {
|
|
176
|
+
relationship.joinColumnNames = relationship.otherEntity.primaryKey.fields.map(
|
|
177
|
+
otherField => `${relationship.columnNamePrefix}${otherField.columnName}`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
171
182
|
};
|
|
172
183
|
}
|
|
173
184
|
|
|
@@ -184,6 +195,9 @@ module.exports = class extends BaseBlueprintGenerator {
|
|
|
184
195
|
if (this.isJhipsterVersionLessThan('7.6.1')) {
|
|
185
196
|
this.removeFile(`${this.entityAbsoluteFolder}/repository/search/SortToFieldSortBuilderConverter.java`);
|
|
186
197
|
}
|
|
198
|
+
if (this.isJhipsterVersionLessThan('7.7.1')) {
|
|
199
|
+
this.removeFile(`${this.entityAbsoluteFolder}/repository/search/SortToSortBuilderListConverter.java`);
|
|
200
|
+
}
|
|
187
201
|
},
|
|
188
202
|
...writeFiles(),
|
|
189
203
|
...super._missingPostWriting(),
|
|
@@ -209,7 +223,11 @@ module.exports = class extends BaseBlueprintGenerator {
|
|
|
209
223
|
return this._postWriting();
|
|
210
224
|
}
|
|
211
225
|
|
|
212
|
-
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated
|
|
228
|
+
* TODO remove for v8
|
|
229
|
+
* Private methods used in templates
|
|
230
|
+
*/
|
|
213
231
|
_getJoinColumnName(relationship) {
|
|
214
232
|
if (relationship.id === true) {
|
|
215
233
|
return 'id';
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<&_ if (fragment.staticImportSection) { -&>
|
|
24
24
|
<%_ if (!embedded) { _%>
|
|
25
25
|
import static <%= packageName %>.config.Constants.ID_DELIMITER;
|
|
26
|
-
import static <%= packageName %>.domain.<%=
|
|
26
|
+
import static <%= packageName %>.domain.<%= persistClass %>.TYPE_NAME;
|
|
27
27
|
import static org.springframework.data.couchbase.core.mapping.id.GenerationStrategy.UNIQUE;
|
|
28
28
|
<%_ } _%>
|
|
29
29
|
<&_ } -&>
|
|
@@ -23,11 +23,15 @@ import <%= entityAbsolutePackage %>.domain.<%= persistClass %>;
|
|
|
23
23
|
<%_ if (relationships.length !== 0) { _%>
|
|
24
24
|
import org.springframework.data.couchbase.repository.Query;
|
|
25
25
|
import org.springframework.data.domain.Pageable;
|
|
26
|
+
import static <%= packageName %>.repository.JHipsterCouchbaseRepository.pageableStatement;
|
|
27
|
+
import com.couchbase.client.java.query.QueryScanConsistency;
|
|
28
|
+
import org.springframework.data.couchbase.repository.ScanConsistency;
|
|
26
29
|
<%_ if (reactive) { _%>
|
|
27
30
|
import reactor.core.publisher.Flux;
|
|
28
31
|
import reactor.core.publisher.Mono;
|
|
29
32
|
<%_ } else { _%>
|
|
30
33
|
import org.springframework.data.domain.Page;
|
|
34
|
+
import org.springframework.data.domain.PageImpl;
|
|
31
35
|
import java.util.List;
|
|
32
36
|
<%_ } _%>
|
|
33
37
|
<%_ } _%>
|
|
@@ -39,12 +43,12 @@ import org.springframework.stereotype.Repository;
|
|
|
39
43
|
import java.util.UUID;
|
|
40
44
|
<%_ } _%>
|
|
41
45
|
|
|
42
|
-
import static <%= packageName %>.domain.<%=
|
|
46
|
+
import static <%= packageName %>.domain.<%= persistClass %>.TYPE_NAME;
|
|
43
47
|
|
|
44
48
|
/**
|
|
45
49
|
* Spring Data Couchbase repository for the <%= persistClass %> entity.
|
|
46
50
|
*/
|
|
47
|
-
<%_ if (!
|
|
51
|
+
<%_ if (!implementsEagerLoadApis) { _%>
|
|
48
52
|
@SuppressWarnings("unused")
|
|
49
53
|
<%_ } _%>
|
|
50
54
|
<%_
|
|
@@ -60,9 +64,9 @@ public interface <%= entityClass %>Repository extends JHipsterCouchbaseRepositor
|
|
|
60
64
|
String SELECT = "SELECT meta(b).id as __id, meta(b).cas as __cas, b.*" + <%
|
|
61
65
|
for (const relationship of notEmbeddedRelationships) {
|
|
62
66
|
if (relationship.collection) {
|
|
63
|
-
%> ", (
|
|
67
|
+
%> ", ARRAY OBJECT_ADD(item, 'id', meta(item).id) FOR item IN `<%= relationship.relationshipFieldNamePlural %>` END AS `<%= relationship.relationshipFieldNamePlural %>`" + <%
|
|
64
68
|
} else {
|
|
65
|
-
%> ", (
|
|
69
|
+
%> ", OBJECT_ADD(`<%= relationship.relationshipFieldName %>`, 'id', meta(`<%= relationship.relationshipFieldName %>`).id) AS `<%= relationship.relationshipFieldName %>`" + <%
|
|
66
70
|
}
|
|
67
71
|
} %>
|
|
68
72
|
" FROM #{#n1ql.bucket} b";
|
|
@@ -81,8 +85,19 @@ public interface <%= entityClass %>Repository extends JHipsterCouchbaseRepositor
|
|
|
81
85
|
|
|
82
86
|
String WHERE = " WHERE b.type = '" + TYPE_NAME + "'";
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
default <%= pageOrFlux %><<%= persistClass %>> findAll(Pageable pageable) {
|
|
89
|
+
return
|
|
90
|
+
<% if (!reactive) { %>new PageImpl<>(<% } %>
|
|
91
|
+
findAll(pageableStatement(pageable, "b"))
|
|
92
|
+
<% if (!reactive) { %>,
|
|
93
|
+
pageable,
|
|
94
|
+
count()
|
|
95
|
+
)<% } %>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Query(SELECT + JOIN + WHERE + " #{[0]}")
|
|
99
|
+
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
|
|
100
|
+
<%= listOrFlux %><<%= persistClass %>> findAll(String pageableStatement);
|
|
86
101
|
|
|
87
102
|
@Query(SELECT + JOIN + WHERE)
|
|
88
103
|
<%= listOrFlux %><<%= persistClass %>> findAll();
|
|
@@ -95,8 +110,16 @@ public interface <%= entityClass %>Repository extends JHipsterCouchbaseRepositor
|
|
|
95
110
|
@Query(SELECT + JOIN + WHERE + " AND " + SEARCH_CONDITION)
|
|
96
111
|
<%= listOrFlux %><<%= persistClass %>> search(String queryString);
|
|
97
112
|
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
default <%= pageOrFlux %><<%= persistClass %>> search(String queryString, Pageable pageable) {
|
|
114
|
+
return
|
|
115
|
+
<% if (!reactive) { %>new PageImpl<>(<% } %>
|
|
116
|
+
search(queryString, pageableStatement(pageable, "b"))
|
|
117
|
+
<% if (!reactive) { %>)<% } %>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@ScanConsistency(query = QueryScanConsistency.NOT_BOUNDED)
|
|
121
|
+
@Query(SELECT + JOIN + WHERE + " AND " + SEARCH_CONDITION + " #{[1]}")
|
|
122
|
+
<%= listOrFlux %><<%= persistClass %>> search(String queryString, String pageableStatement);
|
|
100
123
|
<%_ } _%>
|
|
101
124
|
|
|
102
125
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2022 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
|
+
<%_ const instanceType = restClass;
|
|
20
|
+
const instanceName = restInstance;
|
|
21
|
+
const mapper = entityInstance + 'Mapper';
|
|
22
|
+
const dtoToEntity = mapper + '.' + 'toEntity';
|
|
23
|
+
const entityToDto = mapper + '.' + 'toDto';
|
|
24
|
+
const entityToDtoReference = mapper + '::' + 'toDto';
|
|
25
|
+
const returnPrefix = (returnDirectly && !searchEngineElasticsearch) ? 'return' : instanceType + ' result =';
|
|
26
|
+
let resultEntity;
|
|
27
|
+
let mapsIdEntityInstance;
|
|
28
|
+
let mapsIdRepoInstance;
|
|
29
|
+
let otherEntityName;
|
|
30
|
+
|
|
31
|
+
if (isUsingMapsId) {
|
|
32
|
+
mapsIdEntityInstance = mapsIdAssoc.otherEntityNameCapitalized.charAt(0).toLowerCase() + mapsIdAssoc.otherEntityNameCapitalized.slice(1);
|
|
33
|
+
mapsIdRepoInstance = `${mapsIdEntityInstance}Repository`;
|
|
34
|
+
otherEntityName = mapsIdAssoc.otherEntityName;
|
|
35
|
+
} _%>
|
|
36
|
+
<%_ if (!viaService) { _%>
|
|
37
|
+
<%_ if (dtoMapstruct) { _%>
|
|
38
|
+
<%_ resultEntity = persistInstance; _%>
|
|
39
|
+
<%= persistClass %> <%= persistInstance %> = <%= dtoToEntity %>(<%= instanceName %>);
|
|
40
|
+
<%_ if (isPersisted) { _%>
|
|
41
|
+
<%= persistInstance %>.setIsPersisted();
|
|
42
|
+
<%_ } _%>
|
|
43
|
+
<%_ if (isUsingMapsId) { _%>
|
|
44
|
+
<%= mapsIdAssoc.otherEntity.primaryKey.type %> <%= otherEntityName %>Id = <%= instanceName %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>().get<%= primaryKey.nameCapitalized %>();
|
|
45
|
+
<%= mapsIdRepoInstance %>.findById(<%= otherEntityName %>Id).ifPresent(<%= persistInstance %>::<%_ if (!fluentMethods) { _%>set<%= mapsIdAssoc.relationshipNameCapitalized %> <%_ } else { _%><%= mapsIdAssoc.relationshipName %><%_ } _%>);
|
|
46
|
+
<%_ } _%>
|
|
47
|
+
<%_ if (updatableEntity) { _%>
|
|
48
|
+
<%= persistInstance %> = <%= entityInstance %>Repository.save(<%= persistInstance %>);
|
|
49
|
+
<%_ } else { _%>
|
|
50
|
+
// no save call needed as we have no fields that can be updated
|
|
51
|
+
<%_ } _%>
|
|
52
|
+
<%= returnPrefix %> <%= entityToDto %>(<%= persistInstance %>);
|
|
53
|
+
<%_ } else {
|
|
54
|
+
resultEntity = 'result'; _%>
|
|
55
|
+
<%_ if (isUsingMapsId) { _%>
|
|
56
|
+
<%= mapsIdAssoc.otherEntity.primaryKey.type %> <%= otherEntityName %>Id = <%= instanceName %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>().get<%= primaryKey.nameCapitalized %>();
|
|
57
|
+
<%= mapsIdRepoInstance %>.findById(<%= otherEntityName %>Id).ifPresent(<%= instanceName %>::<%_ if (!fluentMethods) { _%>set<%= mapsIdAssoc.relationshipNameCapitalized %> <%_ } else { _%><%= otherEntityName %><%_ } _%>);
|
|
58
|
+
<%_ } _%>
|
|
59
|
+
<%_ if (isPersisted) { _%>
|
|
60
|
+
<%= persistInstance %>.setIsPersisted();
|
|
61
|
+
<%_ } _%>
|
|
62
|
+
<%_ if (updatableEntity) { _%>
|
|
63
|
+
<%= returnPrefix %> <%= entityInstance %>Repository.save(<%= persistInstance %>);
|
|
64
|
+
<%_ } else { _%>
|
|
65
|
+
// no save call needed as we have no fields that can be updated
|
|
66
|
+
<%= returnPrefix %> <%= persistInstance %>;
|
|
67
|
+
<%_ } _%>
|
|
68
|
+
<%_ } _%>
|
|
69
|
+
<%_ if (searchEngineElasticsearch) { _%>
|
|
70
|
+
<%= entityInstance %>SearchRepository.save(<%= resultEntity %>);
|
|
71
|
+
<%_ if (returnDirectly) { _%>
|
|
72
|
+
return result;
|
|
73
|
+
<%_ } _%>
|
|
74
|
+
<%_ } _%>
|
|
75
|
+
<%_ } else { _%>
|
|
76
|
+
<%= returnPrefix %> <%= entityInstance %>Service.update(<%= instanceName %>);
|
|
77
|
+
<%_ } _%>
|
|
@@ -25,7 +25,7 @@ _%>
|
|
|
25
25
|
<%_ if (viaService) { _%>
|
|
26
26
|
return <%= entityInstance %>Service.save(<%= instanceName %>)
|
|
27
27
|
<%_ } else { _%>
|
|
28
|
-
return <%= entityInstance %>Repository.save(<%if (dtoMapstruct) { %><%= dtoToEntity %>(<% } %><%= instanceName
|
|
28
|
+
return <%= entityInstance %>Repository.save(<%if (dtoMapstruct) { %><%= dtoToEntity %>(<% } %><%= instanceName %><%if (dtoMapstruct) { %>)<% } -%>)
|
|
29
29
|
<%_ if (searchEngineElasticsearch) { %>
|
|
30
30
|
.flatMap(<%= entityInstance %>SearchRepository::save)
|
|
31
31
|
<%_ } -%>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2022 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
|
+
<%_ const instanceType = restClass;
|
|
20
|
+
const instanceName = restInstance;
|
|
21
|
+
const mapper = entityInstance + 'Mapper';
|
|
22
|
+
const dtoToEntity = mapper + '.' + 'toEntity';
|
|
23
|
+
const entityToDtoReference = mapper + '::' + 'toDto';
|
|
24
|
+
_%>
|
|
25
|
+
<%_ if (viaService) { _%>
|
|
26
|
+
return <%= entityInstance %>Service.update(<%= instanceName %>)
|
|
27
|
+
<%_ } else { _%>
|
|
28
|
+
<%_ if (updatableEntity) { _%>
|
|
29
|
+
return <%= entityInstance %>Repository.save(<%if (dtoMapstruct) { %><%= dtoToEntity %>(<% } %><%= instanceName %><%if (dtoMapstruct) { %>)<% } -%><% if (isPersisted) { %>.setIsPersisted()<% } %>)
|
|
30
|
+
<%_ } else { _%>
|
|
31
|
+
// no save call needed as we have no fields that can be updated
|
|
32
|
+
return <%= entityInstance %>Repository.findById(<%= instanceName %>.get<%= primaryKey.nameCapitalized %>())
|
|
33
|
+
<%_ } _%>
|
|
34
|
+
<%_ if (searchEngineElasticsearch) { %>
|
|
35
|
+
.flatMap(<%= entityInstance %>SearchRepository::save)
|
|
36
|
+
<%_ } -%>
|
|
37
|
+
<%_ if (dtoMapstruct) { %>
|
|
38
|
+
.map(<%= entityToDtoReference %>)
|
|
39
|
+
<%_ } -%>
|
|
40
|
+
<%_ if (returnDirectly) { _%>;<%_ } _%>
|
|
41
|
+
<%_ } _%>
|