Skip to content

Commit

Permalink
[Doc] Ajouts de Snipeets dans la documentation JPA
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Sep 20, 2024
1 parent e964916 commit 828d91a
Showing 1 changed file with 294 additions and 0 deletions.
294 changes: 294 additions & 0 deletions docs/generator/jpa.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,3 +703,297 @@ jpa:
fieldsEnum: Persisted # Classes dans lesquelles le générateur doit ajouter une enum des champs : jamais (None), dans les classes persistées (Persisted), dans les classes non persistées (Dto), ou les deux (Persisted_Dto)
fieldsEnumInterface: topmodel.exemple.utils.IFieldEnum<> # Classe dont doivent hériter ces enum
```

## Snippets

### Domains

```yaml
---
domain:
name: ID
label: ID technique
autoGeneratedValue: true
asDomains:
list: LIST
java:
type: Long
---
domain:
name: MAIL
asDomains:
list: LIST
label: Mail
length: 100
java:
type: String
annotations:
- text: '@Email(message = "Le mail ''${validatedValue}'' n''est pas valide")'
imports:
- "jakarta.validation.constraints.Email"
---
domain:
name: DATE_TIME
label: Date
asDomains:
list: LIST
java:
type: LocalDateTime
imports:
- java.time.LocalDateTime
---
domain:
name: TIME
label: Heure
asDomains:
list: LIST
java:
type: LocalTime
imports:
- java.time.LocalTime
---
domain:
name: DATE
label: Date
asDomains:
list: LIST
java:
type: LocalDate
imports:
- java.time.LocalDate
---
domain:
name: DATE_PAST
label: Date
asDomains:
list: LIST
java:
type: LocalDate
imports:
- java.time.LocalDate
annotations:
- text: "@Past"
imports:
- "jakarta.validation.constraints.Past"
---
domain:
name: DATE_CREATION
label: Date
asDomains:
list: LIST
java:
type: LocalDate
imports:
- java.time.LocalDate
annotations:
- text: "@CreatedDate"
imports:
- org.springframework.data.annotation.CreatedDate
target: Persisted
- text: "@PastOrPresent"
imports:
- "jakarta.validation.constraints.PastOrPresent"
---
domain:
name: DATE_MODIFICATION
label: Date
asDomains:
list: LIST
java:
type: LocalDate
imports:
- java.time.LocalDate
annotations:
- text: "@LastModifiedDate"
imports:
- org.springframework.data.annotation.LastModifiedDate
target: Persisted
- text: "@PastOrPresent"
imports:
- "jakarta.validation.constraints.PastOrPresent"
---
domain:
name: CREE_PAR
label: Créé par
scale: 50
asDomains:
list: LIST
java:
type: String
annotations:
- text: "@CreatedBy"
imports:
- org.springframework.data.annotation.CreatedBy
target: Persisted
---
domain:
name: MODIFIE_PAR
label: Modifié par
scale: 50
asDomains:
list: LIST
java:
type: String
annotations:
- text: "@LastModifiedBy"
imports:
- org.springframework.data.annotation.LastModifiedBy
target: Persisted
---
domain:
name: FILE_FORM
mediaType: "multipart/form-data"
label: Fichier
bodyParam: true
ts:
type: File
java:
type: MultipartFile
imports:
- "org.springframework.web.multipart.MultipartFile"
---
domain:
name: FILE
mediaType: "multipart/form-data"
label: Fichier
bodyParam: true
ts:
type: File
java:
type: File
imports:
- "java.io.File"
---
domain:
name: RESPONSE_ENTITY
label: Response Entity
ts:
type: any
java:
type: ResponseEntity<{$0}>
imports:
- org.springframework.http.ResponseEntity
- "{$1}"
---
domain:
name: LIST
label: Liste
java:
type: List<String>
genericType: List<{T}>
imports:
- java.util.List
---
domain:
name: POINT
label: Point
java:
type: Point
imports:
- org.locationtech.jts.geom.Point
---
domain:
name: POLYGONE
label: Polygone
java:
type: Polygon
imports:
- org.locationtech.jts.geom.Polygon
---
domain:
name: PAGE
label: Date
java:
type: Page
genericType: Page<{T}>
imports:
- "org.springframework.data.domain.Page"
---
domain:
name: HTTP_RESPONSE
label: Réponse Http
java:
type: ResponseEntity<Void>
imports:
- org.springframework.http.ResponseEntity
```

### Décorateurs

```yaml
---
decorator:
name: DateCreation
description: Entity Listener pour suivre les évènements de création
java:
annotations:
- EntityListeners(AuditingEntityListener.class)
imports:
- org.springframework.data.jpa.domain.support.AuditingEntityListener
- jakarta.persistence.EntityListeners
properties:
- name: DateCreation
comment: Date de création de l'objet
required: true
domain: DATE_CREATION
label: Date de création
---
decorator:
name: DateModification
description: Entity Listener pour suivre les évènements de modification
java:
annotations:
- EntityListeners(AuditingEntityListener.class)
imports:
- org.springframework.data.jpa.domain.support.AuditingEntityListener
- jakarta.persistence.EntityListeners
properties:
- name: DateModification
comment: Date de création de l'objet
required: true
domain: DATE_MODIFICATION
label: Date de modification
---
decorator:
name: CreePar
description: Entity Listener pour suivre les évènements de création
java:
annotations:
- EntityListeners(AuditingEntityListener.class)
imports:
- org.springframework.data.jpa.domain.support.AuditingEntityListener
- jakarta.persistence.EntityListeners
properties:
- name: CreePar
comment: Auteur de la création de l'objet
required: true
domain: CREE_PAR
label: Créateur
---
decorator:
name: ModifiePar
description: Entity Listener pour suivre les évènements de création
java:
annotations:
- EntityListeners(AuditingEntityListener.class)
imports:
- org.springframework.data.jpa.domain.support.AuditingEntityListener
- jakarta.persistence.EntityListeners
properties:
- name: ModifiePar
comment: Auteur de la création de l'objet
required: true
domain: MODIFIE_PAR
label: Créateur
---
decorator:
name: HasAuthority
description: Droit nécessaire pour pouvoir accéder au endpoint
java:
annotations:
- "@PreAuthorize(\"hasAuthority('{$0}')\")"
imports:
- org.springframework.security.access.prepost.PreAuthorize
```

0 comments on commit 828d91a

Please sign in to comment.