Project

General

Profile

« Previous | Next » 

Revision dd189293

Added by Andreas Kohlbecker about 7 years ago

ref #6169 support for working sets in the service mock and DTO

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/presenter/phycobank/RegistrationDTO.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.presenter.phycobank;
10 10

  
11
import java.util.HashSet;
12
import java.util.Set;
13

  
11 14
import org.joda.time.DateTime;
12 15

  
13 16
import eu.etaxonomy.cdm.mock.Registration;
14 17
import eu.etaxonomy.cdm.mock.RegistrationStatus;
15 18
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
19
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
20
import eu.etaxonomy.cdm.model.reference.Reference;
16 21
import eu.etaxonomy.cdm.vaadin.util.TypeDesignationConverter;
17 22

  
18 23
public class RegistrationDTO{
19 24

  
20 25
    private String summary = "";
21 26

  
22
    private String citation = "";
27
    private String citationString = "";
28

  
29
    private int citationID;
23 30

  
24 31
    private RegistrationType registrationType;
25 32

  
......
27 34

  
28 35
    static int idAutoincrement = 100000;
29 36

  
37
    private Set<Registration> blockedBy = new HashSet<>();
38

  
30 39
    /**
31 40
     * @param reg
32 41
     * @param typifiedName should be provided in for Registrations for TypeDesignations
......
38 47
        registrationType = RegistrationType.from(reg);
39 48
        if(registrationType.isName()){
40 49
            summary = reg.getName().getTitleCache();
41
            if(reg.getName().getNomenclaturalReference() != null){
42
                citation = reg.getName().getNomenclaturalReference().generateTitle();
50
            INomenclaturalReference citation = reg.getName().getNomenclaturalReference();
51
            if(citation != null){
52
                citationString = citation.generateTitle();
53
                citationID = citation.getId();
43 54
            }
44 55
        } else if(registrationType.isTypification()){
45 56
            summary = new TypeDesignationConverter(reg.getTypeDesignations(), typifiedName)
46 57
                    .buildString().print();
47 58
            if(!reg.getTypeDesignations().isEmpty()){
48
                if(reg.getTypeDesignations().iterator().next().getCitation() != null) {
49
                    citation = reg.getTypeDesignations().iterator().next().getCitation().generateTitle();
59
                Reference citation = reg.getTypeDesignations().iterator().next().getCitation();
60
                if(citation != null) {
61
                    citationString = citation.generateTitle();
62
                    citationID = citation.getId();
50 63
                }
51 64
            }
52 65
        } else {
......
108 121
    }
109 122

  
110 123
    public String getCitation() {
111
        return citation;
124
        return citationString;
125
    }
126

  
127
    /**
128
     * @return the blockedBy
129
     */
130
    public Set<Registration> getBlockedBy() {
131
        return blockedBy;
132
    }
133

  
134
    /**
135
     * @return the citationString
136
     */
137
    public String getCitationString() {
138
        return citationString;
139
    }
140

  
141
    /**
142
     * @return the citationID
143
     */
144
    public int getCitationID() {
145
        return citationID;
112 146
    }
113 147

  
114 148
}

Also available in: Unified diff