Project

General

Profile

Revision 545f8115

ID545f81158739623b6b83881b06e5616776171e47
Parent c233acf5
Child 135547e5

Added by Katja Luther about 2 years ago

smaller changes on specimenDTOs

View differences:

cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DerivedUnitFacadeController.java
30 30
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
31 31
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
32 32
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
33
import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO;
33 34
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
35
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
34 36
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
35 37
import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor;
36 38
import io.swagger.annotations.Api;
......
107 109
        ModelAndView mv = new ModelAndView();
108 110
        DerivedUnitFacade duf = newFacadeFrom(occurrenceUuid, response,Arrays.asList(new String []{
109 111
                "fieldObjectMedia", "fieldObjectMedia.title"}));
110
        mv.addObject(duf.getFieldObjectMedia());
112
        SpecimenOrObservationBase sob = service.load(occurrenceUuid, null);
113
        FieldUnitDTO dto;
114
        if (sob instanceof FieldUnit){
115
            dto = FieldUnitDTO.newInstance((FieldUnit)sob);
116
            mv.addObject(dto.getListOfMedia());
117
        }
118

  
111 119
        return mv;
112 120
    }
113 121

  
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/TaxonController.java
242 242
        return new StringResultDTO(String.valueOf(countSpecimen));
243 243
    }
244 244

  
245
    @RequestMapping(value = "specimensOrObservations", method = RequestMethod.GET)
246
    public ModelAndView doListSpecimensOrObservations(
245
    @RequestMapping(value = "specimensOrObservationDTOs", method = RequestMethod.GET)
246
    public ModelAndView doListSpecimensOrObservationDTOs(
247 247
            @PathVariable("uuid") UUID uuid,
248 248
            HttpServletRequest request,
249 249
            HttpServletResponse response) throws IOException {
......
256 256
        return mv;
257 257
    }
258 258

  
259
    @RequestMapping(value = "specimensOrObservations", method = RequestMethod.GET)
260
    public ModelAndView doListSpecimensOrObservations(
261
            @PathVariable("uuid") UUID uuid,
262
            HttpServletRequest request,
263
            HttpServletResponse response) throws IOException {
264
        logger.info("doListSpecimensOrObservations() - " + request.getRequestURI());
265
        ModelAndView mv = new ModelAndView();
266
        TaxonBase<?> tb = service.load(uuid);
267
        List<OrderHint> orderHints = new ArrayList<>();
268
        orderHints.add(new OrderHint("titleCache", SortOrder.DESCENDING));
269
        if(tb instanceof Taxon){
270
            List<SpecimenOrObservationBase<?>> specimensOrObservations = occurrenceService.listByAssociatedTaxon(null, null, (Taxon)tb, null, null, null, orderHints, null);
271
            mv.addObject(specimensOrObservations);
272
        } else {
273
            HttpStatusMessage.UUID_REFERENCES_WRONG_TYPE.send(response);
274
            return null;
275
        }
276
        return mv;
277
    }
278

  
259 279
    @RequestMapping(value = "associatedFieldUnits", method = RequestMethod.GET)
260 280
    public Pager<SpecimenOrObservationBase> doGetFieldUnits(
261 281
            @PathVariable("uuid") UUID uuid,
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/DerivateDTO.java
43 43
    private TreeSet<Pair<String, String>> characterData;
44 44
    private DerivateDataDTO derivateDataDTO;
45 45
    protected String taxonName;
46
    protected String titleCache;
46
    protected String listLabel;
47

  
48

  
47 49

  
48 50

  
49 51
    protected String citation;
......
68 70
    private List<MediaDTO> listOfMedia = new ArrayList<>();
69 71

  
70 72
    public DerivateDTO(SpecimenOrObservationBase specimenOrObservation) {
71
        super(specimenOrObservation.getClass(), specimenOrObservation.getUuid());
72

  
73
        super(specimenOrObservation.getClass(), specimenOrObservation.getUuid(), specimenOrObservation.getTitleCache());
74
        addMedia(specimenOrObservation);
73 75
    }
74 76
    public String getTitleCache() {
75
        return titleCache;
77
        return getLabel();
76 78
    }
77 79

  
78
    public void setTitleCache(String titleCache) {
79
        this.titleCache = titleCache;
80

  
81
    public String getListLabel() {
82
        return listLabel;
80 83
    }
81 84

  
85
    public void setListLabel(String listLabel) {
86
        this.listLabel = listLabel;
87
    }
82 88
    public void setCollection(CollectionDTO collection) {
83 89
        this.collection = collection;
84 90
    }
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/FieldUnitDTO.java
39 39
	    fieldUnitDto.kindOfUnit = fieldUnit.getKindOfUnit().getTitleCache();
40 40
	    fieldUnitDto.gatheringEvent = GatheringEventDTO.newInstance(fieldUnit.getGatheringEvent());
41 41
	    fieldUnitDto.setRecordBase(fieldUnit.getRecordBasis().getMessage());
42
	    fieldUnitDto.setTitleCache(fieldUnit.getTitleCache());
43

  
42
	    fieldUnitDto.setListLabel(fieldUnit.getTitleCache());
44 43

  
45 44
	    return fieldUnitDto;
46 45

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/PreservedSpecimenDTO.java
38 38

  
39 39

  
40 40

  
41

  
42

  
41 43
//    public PreservedSpecimenDTO(DerivedUnit derivedUnit){
42 44
//        super();
43 45
//        this.setUuid(derivedUnit.getUuid());
......
78 80
    public static PreservedSpecimenDTO newInstance(DerivedUnit derivedUnit, TaxonName name ){
79 81
        PreservedSpecimenDTO newInstance = new PreservedSpecimenDTO(derivedUnit);
80 82

  
81
        newInstance.setTitleCache(derivedUnit.getTitleCache());
83
//        newInstance.setTitleCache(derivedUnit.getTitleCache());
84

  
82 85
        newInstance.accessionNumber = derivedUnit.getAccessionNumber();
83 86
        newInstance.preferredStableUri = derivedUnit.getPreferredStableUri();
84 87

  
85 88
        newInstance.setCollectioDTo(new CollectionDTO(HibernateProxyHelper.deproxy(derivedUnit.getCollection())));
86 89
        newInstance.setBarcode(derivedUnit.getBarcode());
87 90
        newInstance.setCatalogNumber(derivedUnit.getCatalogNumber());
91
        newInstance.listLabel = derivedUnit.getCatalogNumber();
88 92
        newInstance.setCollectorsNumber(derivedUnit.getCollectorsNumber());
89 93
        if (derivedUnit.getDerivedFrom() != null){
90 94
            newInstance.setDerivationEvent(new DerivationEventDTO(derivedUnit.getDerivedFrom() ));

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)