Project

General

Profile

« Previous | Next » 

Revision 61483b42

Added by Andreas Kohlbecker over 6 years ago

ref #7114 DerivedUnitConverter now deletes convertion sources:

  • DerivedUnitConverterFactory intoduced
  • DerivedUnitConverterFactory as spring bean in all appcontexts
  • tests adapted

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/utility/DerivedUnitConverter.java
11 11
import java.lang.reflect.InvocationTargetException;
12 12
import java.lang.reflect.Method;
13 13

  
14
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
14 15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
15 16
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
16 17
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
......
26 27

  
27 28
    private DerivedUnit du;
28 29

  
30
    IOccurrenceService service;
31

  
29 32
    /**
30 33
     * @param specimenTypeDesignation
31 34
     */
32
    public DerivedUnitConverter(DerivedUnit derivedUnit) {
35
    protected DerivedUnitConverter(DerivedUnit derivedUnit, IOccurrenceService service) {
33 36
        if(derivedUnit == null){
34 37
            throw new NullPointerException();
35 38
        }
39
        this.service = service;
36 40
        this.du = HibernateProxyHelper.deproxy(derivedUnit, DerivedUnit.class);
37 41
    }
38 42

  
......
76 80
            throw new DerivedUnitConversionException("Error during intantiation of " + targetType.getName(), e);
77 81
        }
78 82

  
83

  
84
        service.delete(du);
85

  
79 86
        return newInstance;
80 87

  
81 88
    }

Also available in: Unified diff