-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseNoteMapper.java
More file actions
29 lines (25 loc) · 935 Bytes
/
CaseNoteMapper.java
File metadata and controls
29 lines (25 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.example.projektarendehantering.application.service;
import org.example.projektarendehantering.infrastructure.persistence.CaseNoteEntity;
import org.example.projektarendehantering.presentation.dto.CaseNoteDTO;
import org.springframework.stereotype.Component;
@Component
public class CaseNoteMapper {
public CaseNoteDTO toDTO(CaseNoteEntity entity) {
if (entity == null) return null;
return new CaseNoteDTO(
entity.getId(),
entity.getContent(),
entity.getAuthor(),
entity.getCreatedAt()
);
}
public CaseNoteEntity toEntity(CaseNoteDTO dto) {
if (dto == null) return null;
CaseNoteEntity entity = new CaseNoteEntity();
entity.setId(dto.getId());
entity.setContent(dto.getContent());
entity.setAuthor(dto.getAuthor());
entity.setCreatedAt(dto.getCreatedAt());
return entity;
}
}