@dsivd/prestations-ng 18.0.0-beta.7 → 18.0.0-beta.9

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/UPGRADING_V18.md CHANGED
@@ -68,11 +68,13 @@ providers: [
68
68
  }
69
69
  ```
70
70
 
71
+ Continue with your migration:
72
+
71
73
  ```bash
72
74
  ng update @fortawesome/angular-fontawesome@0.15 --force
73
75
  ```
74
76
 
75
- **NB: If your project has `@angular/cdk`**
77
+ **NB: When using `@angular/cdk` in your project**
76
78
 
77
79
  ```bash
78
80
  ng update @angular/cdk@18
@@ -106,12 +108,18 @@ When asked the question "Select the migrations that you'd like to run", accept "
106
108
  ng update @angular-eslint/builder@19
107
109
  ```
108
110
 
109
- **NB: If your project has `@angular/cdk`**
111
+ **NB: When using `@angular/cdk` in your project**
110
112
 
111
113
  ```bash
112
114
  ng update @angular/cdk@19
113
115
  ```
114
116
 
117
+ **NB: When using `ngx-matomo-client` in your project**
118
+
119
+ ```bash
120
+ ng update ngx-matomo-client@7
121
+ ```
122
+
115
123
  Continue with your migration:
116
124
 
117
125
  ```bash
@@ -197,6 +205,28 @@ In your `app.module.ts` file:
197
205
  })
198
206
  ```
199
207
 
208
+ #### Matomo migration as standalone (if you are using it in your project)
209
+
210
+ In your `app.module.ts` file:
211
+
212
+ - Remove `import { MatomoInitializationMode, MatomoModule } from 'ngx-matomo-client';`
213
+ - Remove `MatomoModule.forRoot({mode: MatomoInitializationMode.AUTO_DEFERRED})` from `imports` in `@NgModule(...)`
214
+ - Add `provideMatomo` to `imports` in `@NgModule(...)`
215
+ - Add `provideMatomo({ mode: 'deferred' })` to `providers` in `@NgModule(...)`
216
+
217
+ ```diff
218
+ - import { MatomoInitializationMode, MatomoInitializerService, MatomoModule } from 'ngx-matomo-client';
219
+ + import { MatomoInitializerService, provideMatomo } from 'ngx-matomo-client';
220
+
221
+ @NgModule({
222
+ imports: [
223
+ - MatomoModule.forRoot({mode: MatomoInitializationMode.AUTO_DEFERRED}),
224
+ ], providers: [
225
+ + provideMatomo({ mode: 'deferred' })
226
+ ]
227
+ })
228
+ ```
229
+
200
230
  #### Move and update your tsconfig\*.json files
201
231
 
202
232
  - Move your `tsconfig.app.json` and `tsconfig.spec.json` from `src` to `front` (if not already done)
@@ -361,7 +391,9 @@ Finally check if your tests run well :
361
391
  ```bash
362
392
  npm run test
363
393
  ```
394
+
364
395
  **NB: If you are having trouble finding puppeteer ChromiumHeadless binary**
396
+
365
397
  ```bash
366
398
  npx puppeteer browsers install chrome
367
399
  npm run test
@@ -374,6 +406,145 @@ in your `app.component.spec.ts` file, add `HttpClientTestingModule` to `TestBed.
374
406
 
375
407
  From here on, we are back in the root folder of your project
376
408
 
409
+ ### Openshift
410
+
411
+ Since spring boot 3 has a minimal jdk version of 17, you now have to deploy you application in an openshift cluster.
412
+ see https://dsigit.etat-de-vaud.ch/outils/git/projects/PEE/repos/imt-charts/browse/README.MD
413
+
414
+ ### Spring boot 3
415
+
416
+ You can use this openrewrite recipe to simplify the migration (run with java 11)
417
+
418
+ ```bash
419
+ mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_4 -Drewrite.exportDatatables=true -Pnof,noft
420
+ ```
421
+
422
+ After that, you should continue based on your current parent :
423
+
424
+ ### SPRING-BOOT-STARTER-PARENT
425
+
426
+ - remove this profile `<id>devex.in</id>` and its properties (`<devex*`)
427
+ - set property `java.version` to `21`
428
+ - set property `build.nofront` to `false`
429
+ - set property `skipTests` to `false`
430
+ - set property `commons-lang3.version` to `3.17.0`
431
+ - set property `commons-io.version` to `2.19.0`
432
+ - set property `commons-text.version` to `1.13.1`
433
+ - set property `prestations-be.version` to `18.x.y`
434
+ - remove plugin `maven-assembly-plugin` and its properties (`<assembly.xxx`)
435
+ - remove dependency `spring-cloud-starter-netflix-eureka-client`
436
+ - remove dependency `javax.el` and its property (`<javax.el.version>`)
437
+
438
+ If you used `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin`, you should replace it with `org.jvnet.jaxb:jaxb-maven-plugin`
439
+
440
+ ```
441
+ <plugin>
442
+ <groupId>org.jvnet.jaxb</groupId>
443
+ <artifactId>jaxb-maven-plugin</artifactId>
444
+ <version>${jaxb-maven-plugin.version}</version>
445
+ <configuration>
446
+ <strict>false</strict> <!-- see https://github.com/highsource/maven-jaxb2-plugin/wiki/Catalogs-in-Strict-Mode -->
447
+ <schemaDirectory>${basedir}/src/main/resources/xsd/</schemaDirectory>
448
+ <args>
449
+ <arg>-extension</arg>
450
+ <arg>-Xvalue-constructor</arg>
451
+ <arg>-XsimpleEquals</arg>
452
+ <arg>-XsimpleHashCode</arg>
453
+ <arg>-Xinheritance</arg>
454
+ </args>
455
+ </configuration>
456
+ <executions>
457
+ <execution>
458
+ <goals>
459
+ <goal>generate</goal>
460
+ </goals>
461
+ <configuration>
462
+ <schemaIncludes>
463
+ <include>backoffice.xsd</include>
464
+ </schemaIncludes>
465
+ </configuration>
466
+ </execution>
467
+ </executions>
468
+ <dependencies>
469
+ <dependency>
470
+ <groupId>org.jvnet.jaxb</groupId>
471
+ <artifactId>jaxb-plugins</artifactId>
472
+ <version>${jaxb-plugins.version}</version>
473
+ </dependency>
474
+ <dependency>
475
+ <groupId>org.jvnet.jaxb2_commons</groupId>
476
+ <artifactId>jaxb2-namespace-prefix</artifactId>
477
+ <version>${jaxb2-namespace-prefix.version}</version>
478
+ </dependency>
479
+ </dependencies>
480
+ </plugin>
481
+ ```
482
+
483
+ with these properties :
484
+
485
+ ```
486
+ <jaxb-maven-plugin.version>4.0.8</jaxb-maven-plugin.version>
487
+ <jaxb-plugins.version>3.0.0</jaxb-plugins.version>
488
+ <jaxb2-namespace-prefix.version>2.0</jaxb2-namespace-prefix.version>
489
+ ```
490
+
491
+ ### APPLICATION-PARENT
492
+
493
+ - remove property `java.version` (already set to `21` in the parent)
494
+ - if existing, remove exclusion `spring-cloud-starter-netflix-eureka-client` from `starter-prestation`
495
+ - remove dependency `spring-boot-starter-validation` (already in `starter-prestation`)
496
+ - remove devex properties
497
+
498
+ If you used `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin`, you should replace it with `org.jvnet.jaxb:jaxb-maven-plugin`
499
+
500
+ ```
501
+ <plugin>
502
+ <groupId>org.jvnet.jaxb</groupId>
503
+ <artifactId>jaxb-maven-plugin</artifactId>
504
+ <executions>
505
+ <execution>
506
+ <goals>
507
+ <goal>generate</goal>
508
+ </goals>
509
+ <configuration>
510
+ <schemaIncludes>
511
+ <include>backoffice.xsd</include>
512
+ </schemaIncludes>
513
+ </configuration>
514
+ </execution>
515
+ </executions>
516
+ </plugin>
517
+ ```
518
+
519
+ ### clean / build your project
520
+
521
+ - remove the annotation `@EnableEurekaClient`
522
+ - remove the property `eureka.client.enabled`
523
+ - remove the property `eureka.client.serviceUrl.defaultZone` (in you configuration repository)
524
+ - replace deprecated annotation `@MockBean` with `@MockitoBean`
525
+ - remove deprecated field constructor `Validator validator` from `AbstractSdkController`
526
+ - use `SdkControllerTest.getValidator()` instead of creating a `LocalValidatorFactoryBean` to build your ``
527
+
528
+ build your project with java 21 :
529
+
530
+ ```
531
+ mvn -U clean install -Pnof,noft
532
+ ```
533
+
534
+ ### Property migration
535
+
536
+ run you application with this dependency :
537
+
538
+ ```
539
+ <dependency>
540
+ <groupId>org.springframework.boot</groupId>
541
+ <artifactId>spring-boot-properties-migrator</artifactId>
542
+ <scope>runtime</scope>
543
+ </dependency>
544
+ ```
545
+
546
+ look for logs that indicate property you should migrate, update them and remove the dependency
547
+
377
548
  ### Captcha configuration
378
549
 
379
550
  - As stated in the migration guide from v16 to v17, Cybercache is responsible of the captcha turnstile verify call.
@@ -388,3 +559,44 @@ From here on, we are back in the root folder of your project
388
559
  Cookie storage is kept as before, therefore you can keep cookie related properties that starts with `recaptcha.cookie.YYY` in your properties.
389
560
 
390
561
  See [Skeleton](https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBSDK/repos/skeleton/pull-requests/708/overview) for a working example
562
+
563
+ ### HIBERNATE
564
+
565
+ ## Sequences
566
+
567
+ Hibernate doesn't use the default sequence anymore, you can keep using it by replacing
568
+
569
+ ```
570
+ @GeneratedValue(strategy = GenerationType.SEQUENCE)
571
+ ```
572
+
573
+ with
574
+
575
+ ```
576
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hibernate_sequence")
577
+ @SequenceGenerator(name = "hibernate_sequence", allocationSize = 1)
578
+ ```
579
+
580
+ ## Dates mapping
581
+
582
+ replace `@Type(LocalDateTimeUserType.class)` by `@Convert(converter = LocalDateTimeConverter.class)`
583
+ replace `@Type(LocalDateUserType.class)` by `@Convert(converter = LocalDateConverter.class)`
584
+
585
+ ### Jenkins files for Unit tests
586
+
587
+ buildPipeline is not supported anymore, replace the content of jenkins>UT>JenkinsFile with :
588
+
589
+ ```
590
+ @Library('devsup-library') _
591
+
592
+ buildAppPipelinePodmanUT([
593
+ name : 'the name of your application',
594
+ label : 'your slaves lable',
595
+ jdk : '21',
596
+ node : '20'
597
+ ])
598
+ ```
599
+
600
+ ### Debugging tips
601
+
602
+ Spring boot 3 doesn't support calling a controller with a trailing slash, fix the url called (/api/ping != /api/ping**/**)
@@ -5285,13 +5285,15 @@ const IamInterceptorServiceExistingProvider = {
5285
5285
  multi: true
5286
5286
  };
5287
5287
  class PrestationsNgCoreModule {
5288
- constructor(injector) {
5288
+ constructor(injector, faConfig) {
5289
5289
  this.injector = injector;
5290
+ this.faConfig = faConfig;
5290
5291
  ServiceLocator.injector = injector;
5291
5292
  // do not let font-awesome add its own css as it would be rejected by CSP
5292
5293
  config.autoAddCss = false;
5294
+ faConfig.autoAddCss = false;
5293
5295
  }
5294
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PrestationsNgCoreModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
5296
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PrestationsNgCoreModule, deps: [{ token: i0.Injector }, { token: i1$2.FaConfig }], target: i0.ɵɵFactoryTarget.NgModule }); }
5295
5297
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: PrestationsNgCoreModule, imports: [RouterModule] }); }
5296
5298
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PrestationsNgCoreModule, providers: [
5297
5299
  IamInterceptorServiceExistingProvider,
@@ -5307,7 +5309,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
5307
5309
  provideHttpClient(withInterceptorsFromDi())
5308
5310
  ]
5309
5311
  }]
5310
- }], ctorParameters: () => [{ type: i0.Injector }] });
5312
+ }], ctorParameters: () => [{ type: i0.Injector }, { type: i1$2.FaConfig }] });
5311
5313
 
5312
5314
  // eslint-disable max-classes-per-file
5313
5315
  class SessionInfoData {