Project

General

Profile

Download (1.6 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2021 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.api.service.dto;
10

    
11
import java.util.UUID;
12

    
13
import eu.etaxonomy.cdm.model.common.Annotation;
14
import eu.etaxonomy.cdm.model.common.CdmBase;
15
import eu.etaxonomy.cdm.ref.TypedEntityReference;
16

    
17
/**
18
 * @author a.kohlbecker
19
 * @since Dec 10, 2021
20
 */
21
public class AnnotationDTO extends TypedEntityReference<Annotation> {
22

    
23
    private static final long serialVersionUID = 4865632821417238523L;
24

    
25
    private UUID annotationTypeUuid = null;
26
    private String text = null;
27

    
28
    public static <T extends CdmBase> AnnotationDTO fromEntity(Annotation annotation) {
29
        AnnotationDTO dto = new AnnotationDTO(Annotation.class, annotation.getUuid());
30
        if(annotation.getAnnotationType() != null) {
31
            dto.setAnnotationTypeUuid(annotation.getAnnotationType().getUuid());
32
        }
33
        dto.setText(annotation.getText());
34
        return dto;
35
    }
36

    
37
    @SuppressWarnings("deprecation")
38
    public AnnotationDTO(Class<Annotation> type, UUID uuid) {
39
        super(type, uuid);
40
        this.label = null;
41
    }
42

    
43
    public UUID getAnnotationTypeUuid() {
44
        return annotationTypeUuid;
45
    }
46

    
47
    private void setAnnotationTypeUuid(UUID annotationTypeUuid) {
48
        this.annotationTypeUuid = annotationTypeUuid;
49
    }
50

    
51
    public String getText() {
52
        return text;
53
    }
54

    
55
    private void setText(String text) {
56
        this.text = text;
57
    }
58

    
59
}
(1-1/45)