Project

General

Profile

« Previous | Next » 

Revision 6dbfb2ec

Added by Andreas Kohlbecker over 7 years ago

ref #6087 adding orderINdex to TermDTO

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/description/DescriptionDaoImpl.java
923 923

  
924 924
            // NOTE can't use "select new TermDto(distinct a.uuid, r , a.vocabulary.uuid) since we will get multiple
925 925
            // rows for a term with multiple representations
926
            String parentAreasQueryStr = "select a.uuid, r, p.uuid, v.uuid "
926
            String parentAreasQueryStr = "select a.uuid, r, p.uuid, v.uuid, a.orderIndex "
927 927
                    + "from NamedArea as a LEFT JOIN a.partOf as p LEFT JOIN a.representations AS r LEFT JOIN a.vocabulary as v "
928 928
                    + "where a.id in (:allAreaIds) order by a.idInVocabulary";
929 929
            query = getSession().createQuery(parentAreasQueryStr);
......
959 959
                } else {
960 960
                    representations = (Set<Representation>)elements[1];
961 961
                }
962
                dtoMap.put(uuid, new TermDto(uuid, representations, (UUID)elements[2], (UUID)elements[3]));
962
                dtoMap.put(uuid, new TermDto(uuid, representations, (UUID)elements[2], (UUID)elements[3], (Integer)elements[4]));
963 963
            }
964 964
        }
965 965
        return new ArrayList<TermDto>(dtoMap.values());
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TermDto.java
26 26
    private final UUID uuid;
27 27
    private UUID partOfUuid = null;
28 28
    private UUID vocabularyUuid = null;
29
    private Integer orderIndex = null;
29 30
    private final Set<Representation> representations;
30 31
    private String representation_L10n = null;
31 32
    private String representation_L10n_abbreviatedLabel = null;
32 33

  
33
    public TermDto(UUID uuid, Set<Representation> representations) {
34
    public TermDto(UUID uuid, Set<Representation> representations, Integer orderIndex) {
34 35
        this.representations = representations;
35 36
        this.uuid = uuid;
37
        this.setOrderIndex(orderIndex);
36 38
    }
37 39

  
38
    public TermDto(UUID uuid, Set<Representation> representations, UUID partOfUuid, UUID vocabularyUuid) {
40
    public TermDto(UUID uuid, Set<Representation> representations, UUID partOfUuid, UUID vocabularyUuid, Integer orderIndex) {
39 41
        this.representations = representations;
40 42
        this.uuid = uuid;
41 43
        this.partOfUuid = partOfUuid;
42 44
        this.vocabularyUuid = vocabularyUuid;
45
        this.setOrderIndex(orderIndex);
43 46
    }
44 47

  
45 48
    static public TermDto fromNamedArea(NamedArea namedArea) {
46
        TermDto dto = new TermDto(namedArea.getUuid(), namedArea.getRepresentations());
49
        TermDto dto = new TermDto(namedArea.getUuid(), namedArea.getRepresentations(), namedArea.getOrderIndex());
47 50
        return dto;
48 51
    }
49 52

  
......
127 130

  
128 131
    }
129 132

  
133
    /**
134
     * @return the orderIndex
135
     */
136
    public Integer getOrderIndex() {
137
        return orderIndex;
138
    }
139

  
140
    /**
141
     * @param orderIndex the orderIndex to set
142
     */
143
    public void setOrderIndex(Integer orderIndex) {
144
        this.orderIndex = orderIndex;
145
    }
146

  
147

  
148

  
130 149
}

Also available in: Unified diff