Project

General

Profile

Download (2.25 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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.vaadin.presenter.phycobank;
10

    
11
import org.joda.time.DateTime;
12

    
13
import eu.etaxonomy.cdm.mock.Registration;
14
import eu.etaxonomy.cdm.mock.RegistrationStatus;
15
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
16
import eu.etaxonomy.cdm.vaadin.util.TypeDesignationConverter;
17

    
18
public class RegistrationDTO{
19

    
20
    private String summary = "";
21

    
22
    private RegistrationType registrationType;
23

    
24
    private Registration reg;
25

    
26
    static int idAutoincrement = 100000;
27

    
28
    /**
29
     * @param reg
30
     * @param typifiedName should be provided in for Registrations for TypeDesignations
31
     */
32
    public RegistrationDTO(Registration reg, TaxonNameBase typifiedName) {
33

    
34
         this.reg = reg;
35

    
36
        registrationType = RegistrationType.from(reg);
37
        if(registrationType.isName()){
38
            summary = reg.getName().getTitleCache();
39
        } else if(registrationType.isTypification()){
40
            summary = new TypeDesignationConverter(reg.getTypeDesignations(), typifiedName)
41
                    .buildString().print();
42
        } else {
43
            summary = "- INVALID REGISTRATION -";
44
        }
45
    }
46

    
47
    /**
48
     * @return the summary
49
     */
50
    public String getSummary() {
51
        return summary;
52
    }
53

    
54

    
55
    /**
56
     * @return the registrationType
57
     */
58
    public RegistrationType getRegistrationType() {
59
        return registrationType;
60
    }
61

    
62

    
63
    /**
64
     * @return the status
65
     */
66
    public RegistrationStatus getStatus() {
67
        return reg.getStatus();
68
    }
69

    
70

    
71
    /**
72
     * @return the registrationId
73
     */
74
    public String getRegistrationId() {
75
        return reg.getIdentifier();
76
    }
77

    
78

    
79
    /**
80
     * @return the internalRegId
81
     */
82
    public String getInternalRegId() {
83
        return reg.getSpecificIdentifier();
84
    }
85

    
86
    /**
87
     * @return the registrationDate
88
     */
89
    public DateTime getRegistrationDate() {
90
        return reg.getRegistrationDate();
91
    }
92

    
93
    /**
94
     * @return the created
95
     */
96
    public DateTime getCreated() {
97
        return reg.getCreated();
98
    }
99

    
100
}
(2-2/4)