- DerivedUnitConverter<DerivedUnit> converter = new DerivedUnitConverter<DerivedUnit> (std.getTypeSpecimen());
- convertedSpecimen = converter.convertTo((Class<DerivedUnit>)requiredSpecimenType, specimenOrObservationTypeFor(kindOfUnit));
+ if(currentType == MediaSpecimen.class){
+ MediaSpecimen mediaSpecimen = (MediaSpecimen)typeSpecimen;
+ // set null to allow conversion
+ mediaSpecimen.setMediaSpecimen(null);
+ }
+ DerivedUnitConverter<DerivedUnit> converter = new DerivedUnitConverter<DerivedUnit>(std);
+ std = converter.convertTo((Class<DerivedUnit>)requiredSpecimenType, convertToType);
+ }
+ if(typeSpecimen.getId() != 0){
+ replacedTypeSpecimen = typeSpecimen;