Project

General

Profile

« Previous | Next » 

Revision 71559ffe

Added by Katja Luther over 2 years ago

ref #9710: switch to dtos for descriptive data set and descriptions for character matrix

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/CharacterDto.java
45 45
    private TermNodeDto ratioTo;
46 46

  
47 47
    public CharacterDto(UUID uuid, Set<Representation> representations, UUID partOfUuid, UUID kindOfUuid,
48
            UUID vocabularyUuid, Integer orderIndex, String idInVocabulary, Set<Representation> vocRepresentations,
48
            UUID vocabularyUuid, Integer orderIndex, String idInVocabulary, //Set<Representation> vocRepresentations,
49 49
            boolean isAvailableForTaxon, boolean isAvailableForTaxonName, boolean isAvailableForOccurrence,
50 50
            String titleCache, TermNodeDto structure, TermDto structureModifier, TermNodeDto property,
51 51
            TermDto propertyModifier, TermNodeDto ratioTo, boolean isSupportCategoricalData, boolean isSupportsQuantitativeData, Set<TermVocabularyDto> supportedCategoricalEnumerations, Set<TermVocabularyDto> recommendedModifierEnumeration,  Set<TermDto> recommendedMeasurementUnits,  Set<TermDto> recommendedStatisticalMeasures) {
52 52
        super(uuid, representations, partOfUuid, kindOfUuid, vocabularyUuid, orderIndex, idInVocabulary,
53
                vocRepresentations, isAvailableForTaxon, isAvailableForTaxonName, isAvailableForOccurrence, titleCache, isSupportCategoricalData, isSupportsQuantitativeData, supportedCategoricalEnumerations, recommendedModifierEnumeration, recommendedMeasurementUnits, recommendedStatisticalMeasures);
53
                isAvailableForTaxon, isAvailableForTaxonName, isAvailableForOccurrence, titleCache, isSupportCategoricalData, isSupportsQuantitativeData, supportedCategoricalEnumerations, recommendedModifierEnumeration, recommendedMeasurementUnits, recommendedStatisticalMeasures);
54 54
        this.structure = structure;
55 55
        this.structureModifier = structureModifier;
56 56
        this.property = property;
......
82 82
           recommendedMeasurementUnitsDtos.add(TermDto.fromTerm(term));
83 83
       }
84 84
       CharacterDto dto = new CharacterDto(character.getUuid(), character.getRepresentations(), character.getPartOf() != null? character.getPartOf().getUuid(): null, character.getKindOf() != null? character.getKindOf().getUuid(): null,
85
               voc != null? voc.getUuid(): null, null, character.getIdInVocabulary(), voc != null? voc.getRepresentations(): null, character.isAvailableForTaxon(), character.isAvailableForTaxonName(), character.isAvailableForOccurrence(), character.getTitleCache(),
85
               voc != null? voc.getUuid(): null, null, character.getIdInVocabulary(), character.isAvailableForTaxon(), character.isAvailableForTaxonName(), character.isAvailableForOccurrence(), character.getTitleCache(),
86 86
                       character.getStructure() !=null? TermNodeDto.fromNode(character.getStructure(), null): null, character.getStructureModifier() != null? TermDto.fromTerm(character.getStructureModifier()): null,
87 87
                                       character.getProperty() != null? TermNodeDto.fromNode(character.getProperty(), null): null, character.getPropertyModifier() != null? TermDto.fromTerm(character.getPropertyModifier()): null, character.getRatioToStructure() != null? TermNodeDto.fromNode(character.getRatioToStructure(), null): null,
88 88
                                               character.isSupportsCategoricalData(), character.isSupportsQuantitativeData(),supportedCategoricalDtos, recommendedModifierDtos, recommendedMeasurementUnitsDtos, recommendedStatisticalMeasuresDtos);
......
142 142
                + "v.uuid, "
143 143
//                + "a.orderIndex, "
144 144
                + "a.idInVocabulary, "
145
                + "voc_rep,  "
145
//                + "voc_rep,  "
146 146
                + "a.termType,  "
147 147
                + "a.uri,  "
148 148
                + "m,  "
......
192 192
                if(elements[1]!=null){
193 193
                    dtoMap.get(uuid).addRepresentation((Representation)elements[1]);
194 194
                }
195
                if(elements[6]!=null){
196
                    dtoMap.get(uuid).addVocRepresentation((Representation)elements[6]);
197
                }
198
                if(elements[9]!=null){
199
                    dtoMap.get(uuid).addMedia(((Media) elements[9]).getUuid());
195
//                if(elements[6]!=null){
196
//                    dtoMap.get(uuid).addVocRepresentation((Representation)elements[6]);
197
//                }
198
                if(elements[8]!=null){
199
                    dtoMap.get(uuid).addMedia(((Media) elements[8]).getUuid());
200 200
                }
201 201
            } else {
202 202
                // term representation
......
207 207
                }
208 208
                // term media
209 209
                Set<UUID> mediaUuids = new HashSet<>();
210
                if(elements[9] instanceof Media) {
211
                    mediaUuids.add(((Media) elements[9]).getUuid());
210
                if(elements[8] instanceof Media) {
211
                    mediaUuids.add(((Media) elements[8]).getUuid());
212 212
                }
213 213
                // voc representation
214
                Set<Representation> vocRepresentations = new HashSet<>();
215
                if(elements[6] instanceof Representation) {
216
                    vocRepresentations = new HashSet<Representation>(7);
217
                    vocRepresentations.add((Representation)elements[6]);
218
                }
214
//                Set<Representation> vocRepresentations = new HashSet<>();
215
//                if(elements[6] instanceof Representation) {
216
//                    vocRepresentations = new HashSet<Representation>(7);
217
//                    vocRepresentations.add((Representation)elements[6]);
218
//                }
219 219
                boolean isAvailableForTaxon = false;
220 220
                boolean isAvailableForTaxonName = false;
221 221
                boolean isAvailableForOccurrence = false;
222 222

  
223
                EnumSet<CdmClass> availableForString = (EnumSet<CdmClass>)elements[10];
223
                EnumSet<CdmClass> availableForString = (EnumSet<CdmClass>)elements[9];
224 224

  
225 225
                if (availableForString.contains(CdmClass.TAXON)){
226 226
                    isAvailableForTaxon = true;
......
234 234
                boolean isSupportsCategoricalData = false;
235 235
                boolean isSupportsQuantitativeData = false;
236 236

  
237
                EnumSet<CdmClass> supportsString = (EnumSet<CdmClass>)elements[12];
237
                EnumSet<CdmClass> supportsString = (EnumSet<CdmClass>)elements[11];
238 238

  
239 239
                if (supportsString.contains(CdmClass.CATEGORICAL_DATA)){
240 240
                    isSupportsCategoricalData = true;
......
243 243
                    isSupportsQuantitativeData = true;
244 244
                }
245 245

  
246
                Object o = elements[13];
246
                Object o = elements[12];
247 247
                Set<TermVocabularyDto> recommendedModifierDtos = new HashSet<>();
248 248
                if (o instanceof TermVocabulary){
249 249
                    recommendedModifierDtos.add(TermVocabularyDto.fromVocabulary((TermVocabulary)o));
......
258 258

  
259 259

  
260 260

  
261
                o = elements[14];
261
                o = elements[13];
262 262
                Set<TermDto> recommendedStatisticalMeasuresDtos = new HashSet<>();
263 263
                if (o instanceof StatisticalMeasure){
264 264
                    recommendedStatisticalMeasuresDtos.add(TermDto.fromTerm((StatisticalMeasure)o));
......
270 270
                        }
271 271
                    }
272 272
                }
273
                o =  elements[15];
273
                o =  elements[14];
274 274
                Set<TermVocabularyDto> supportedCategoricalDtos = new HashSet<>();
275 275
                if (o instanceof TermVocabulary){
276 276
                    supportedCategoricalDtos.add(TermVocabularyDto.fromVocabulary((TermVocabulary)o));
......
282 282
                }
283 283

  
284 284

  
285
                o = elements[16];
285
                o = elements[15];
286 286
                Set<TermDto> recommendedMeasurementUnitsDtos = new HashSet<>();
287 287
                if (o instanceof MeasurementUnit){
288 288
                    recommendedMeasurementUnitsDtos.add(TermDto.fromTerm((MeasurementUnit)o));
289 289
                }else if (o instanceof Set){
290
                    Set<MeasurementUnit> recommendedMeasurementUnits = (Set<MeasurementUnit>) elements[17];
290
                    Set<MeasurementUnit> recommendedMeasurementUnits = (Set<MeasurementUnit>) elements[15];
291 291
                    for (MeasurementUnit term: recommendedMeasurementUnits){
292 292
                        recommendedMeasurementUnitsDtos.add(TermDto.fromTerm(term));
293 293
                    }
294 294
                }
295 295

  
296
                o = elements[17];
296
                o = elements[16];
297 297
                TermNodeDto prop = null;
298 298
                if (o instanceof TermNode){
299 299
                    prop = TermNodeDto.fromNode((TermNode) o, TermTreeDto.fromTree((TermTree) ((TermNode)o).getGraph()));
300 300
                }
301 301

  
302
                o = elements[18];
302
                o = elements[17];
303 303
                TermNodeDto structure = null;
304 304
                if (o instanceof TermNode){
305 305
                    structure = TermNodeDto.fromNode((TermNode) o, TermTreeDto.fromTree((TermTree) ((TermNode)o).getGraph()));
306 306
                }
307 307

  
308
                o = elements[10];
308
                o = elements[9];
309 309
                TermNodeDto ratioTo = null;
310 310
                if (o instanceof TermNode){
311 311
                    ratioTo = TermNodeDto.fromNode((TermNode) o, TermTreeDto.fromTree((TermTree) ((TermNode)o).getGraph()));
......
320 320
                        (UUID)elements[4],
321 321
                        null,
322 322
                        (String)elements[5],
323
                        vocRepresentations,
323
//                        vocRepresentations,
324 324
                        isAvailableForTaxon,
325 325
                        isAvailableForTaxonName,
326 326
                        isAvailableForOccurrence,
327
                        (String)elements[11],structure, null, prop, null, ratioTo, isSupportsCategoricalData,
327
                        (String)elements[10],structure, null, prop, null, ratioTo, isSupportsCategoricalData,
328 328
//                        structure, structureModifier, prop, null, isSupportsCategoricalData,
329 329
                        isSupportsQuantitativeData,
330 330
                        supportedCategoricalDtos,
......
332 332
                        recommendedMeasurementUnitsDtos,
333 333
                        recommendedStatisticalMeasuresDtos)
334 334
                        ;
335
                termDto.setUri((URI)elements[8]);
335
                termDto.setUri((URI)elements[7]);
336 336
                termDto.setMedia(mediaUuids);
337 337

  
338 338

  

Also available in: Unified diff