Project

General

Profile

« Previous | Next » 

Revision a9527b12

Added by Andreas Kohlbecker over 3 years ago

ref #9252 determinig hasTypes from actual data and fixing type probelms in methods

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/FieldUnitDTO.java
39 39
	private String date;
40 40
	private String collectionsStatistics;
41 41

  
42
	private boolean hasType;
43

  
44 42
	private GatheringEventDTO gatheringEvent;
45 43

  
46 44
	public static FieldUnitDTO fromEntity(FieldUnit entity){
......
71 69
	 */
72 70
    private FieldUnitDTO(FieldUnit fieldUnit, EnumSet<SpecimenOrObservationType> specimenOrObservationTypeFilter ) {
73 71
        super(fieldUnit);
72

  
73
        if(specimenOrObservationTypeFilter == null) {
74
            specimenOrObservationTypeFilter = EnumSet.allOf(SpecimenOrObservationType.class);
75
        }
74 76
        if (fieldUnit.getGatheringEvent() != null){
75 77
            gatheringEvent = GatheringEventDTO.newInstance(fieldUnit.getGatheringEvent());
76 78
        }
......
235 237
    }
236 238

  
237 239
    public boolean isHasType() {
240
        boolean hasType = collectDerivatives()
241
                .stream()
242
                .anyMatch(derivedUnitDTO -> derivedUnitDTO.getSpecimenTypeDesignations() != null && !derivedUnitDTO.getSpecimenTypeDesignations().isEmpty());
238 243
        return hasType;
239 244
    }
240
    public void setHasType(boolean hasType) {
241
        this.hasType = hasType;
242
    }
243 245

  
244 246
    public GatheringEventDTO getGatheringEvent() {
245 247
        return gatheringEvent;

Also available in: Unified diff