Project

General

Profile

« Previous | Next » 

Revision 394be96b

Added by Patrick Plitzner about 5 years ago

ref #8011 Add uri and termType to DTO query

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TermDto.java
8 8
*/
9 9
package eu.etaxonomy.cdm.persistence.dto;
10 10

  
11
import java.net.URI;
11 12
import java.util.ArrayList;
12 13
import java.util.Collection;
13 14
import java.util.HashMap;
......
20 21
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
21 22
import eu.etaxonomy.cdm.model.common.OrderedTermBase;
22 23
import eu.etaxonomy.cdm.model.common.Representation;
24
import eu.etaxonomy.cdm.model.common.TermType;
23 25
import eu.etaxonomy.cdm.model.common.TermVocabulary;
24 26

  
25 27
/**
......
85 87
                vocabulary.getUuid(),
86 88
                (term instanceof OrderedTermBase)?((OrderedTermBase) term).getOrderIndex():null,
87 89
                term.getIdInVocabulary());
90
        dto.setTermType(term.getTermType());
91
        dto.setUri(term.getUri());
88 92
        if(initializeToTop){
89 93
            if(partOf!=null){
90 94
                dto.setPartOfDto(fromTerm(partOf, initializeToTop));
......
205 209

  
206 210
    public static String getTermDtoSelect(String fromTable){
207 211
        return ""
208
                + "select a.uuid, r, p.uuid, k.uuid, v.uuid, a.orderIndex, a.idInVocabulary, voc_rep "
212
                + "select a.uuid, "
213
                + "r, "
214
                + "p.uuid, "
215
                + "k.uuid, "
216
                + "v.uuid, "
217
                + "a.orderIndex, "
218
                + "a.idInVocabulary, "
219
                + "voc_rep,  "
220
                + "a.termType,  "
221
                + "a.uri  "
209 222
                + "from "+fromTable+" as a "
210 223
                + "LEFT JOIN a.partOf as p "
211 224
                + "LEFT JOIN a.kindOf as k "
......
235 248
                } else {
236 249
                    vocRepresentations = (Set<Representation>)elements[7];
237 250
                }
238
                dtoMap.put(uuid, new TermDto(uuid, representations, (UUID)elements[2], (UUID)elements[3], (UUID)elements[4], (Integer)elements[5], (String)elements[6], vocRepresentations));
251
                TermDto termDto = new TermDto(
252
                        uuid,
253
                        representations,
254
                        (UUID)elements[2],
255
                        (UUID)elements[3],
256
                        (UUID)elements[4],
257
                        (Integer)elements[5],
258
                        (String)elements[6],
259
                        vocRepresentations);
260
                termDto.setTermType((TermType)elements[8]);
261
                termDto.setUri((URI)elements[9]);
262
                dtoMap.put(uuid, termDto);
239 263
            }
240 264
        }
241 265
        return new ArrayList<>(dtoMap.values());

Also available in: Unified diff