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/mock/RegistrationService.java
13 13
import java.util.HashSet;
14 14
import java.util.List;
15 15
import java.util.Map;
16
import java.util.Set;
16 17
import java.util.UUID;
17 18

  
18 19
import org.springframework.beans.factory.annotation.Autowired;
......
43 44
    private Map<UUID, Registration> registrationsByUUID = new HashMap<>();
44 45
    private Map<String, Registration> registrationsByRegID = new HashMap<>();
45 46
    private Map<String, RegistrationDTO> registrationDTOsByRegID = new HashMap<>();
47
    private Map<Integer, Set<RegistrationDTO>> registrationDTOsByCitationID = new HashMap<>();
46 48

  
47 49
    private Collection<CdmBase> cdmEntities = new HashSet<>();
48 50

  
......
87 89
        registrationsByUUID.put(reg.getUuid(), reg);
88 90
        registrationsByRegID.put(reg.getSpecificIdentifier(), reg);
89 91
        registrationDTOsByRegID.put(reg.getSpecificIdentifier(), dto);
92
        if(! registrationDTOsByCitationID.containsKey(dto.getCitationID())){
93
            registrationDTOsByCitationID.put(dto.getCitationID(), new HashSet<RegistrationDTO>());
94
        }
95
        registrationDTOsByCitationID.get(dto.getCitationID()).add(dto);
90 96
    }
91 97

  
92 98
    private void mergeBack(){
......
111 117
        return registrationDTOsByRegID.values();
112 118
    }
113 119

  
120
    public Map<Integer, Set<RegistrationDTO>> listDTOsByWorkingSet() {
121
        init();
122
        return registrationDTOsByCitationID;
123
    }
124

  
114 125
    /**
115 126
     * @param registrationID
116 127
     * @return
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
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/ListViewBean.java
171 171
        Column statusColumn = grid.addColumn("status");
172 172

  
173 173
        Column citationColumn = grid.addColumn("citation");
174
        citationColumn.setHeaderCaption("Publication");
175

  
174 176

  
175 177
        Column summaryColumn = grid.addColumn("summary");
176 178

  

Also available in: Unified diff