Project

General

Profile

Revision 134e317a

ID134e317afd3458bef55ba7dd7e6c07ab501dd1e3
Parent 48f770f5
Child afb7802b

Added by Andreas Kohlbecker 9 months ago

ref #8039 additional addTypeDesignation method in RegistrationService

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IRegistrationService.java
158 158

  
159 159
    public void addTypeDesignation(UUID registrationUUID, UUID typeDesignationUuid);
160 160

  
161
    /**
162
     * @param registration
163
     * @param typeDesignationUuid
164
     */
165
    public void addTypeDesignation(Registration registration, UUID typeDesignationUuid);
166

  
161 167
    // ============================================================================================
162 168

  
163 169
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/RegistrationServiceImpl.java
395 395
        registration.getTypeDesignations().add(nameTypeDesignation);
396 396
    }
397 397

  
398
    @Override
399
    @Transactional(readOnly=false)
400
    public void addTypeDesignation(Registration registration, UUID typeDesignationUuid){
401

  
402
        if(registration == null){
403
            registration = newRegistration();
404
            registration = assureIsPersisted(registration);
405
        } else {
406
            if(registration.isPersited()){
407
                // make sure the the typeDesignations are loaded with the registration so that typified names can not be twice in detached sessions
408
                // otherwise multiple representation problems might occur
409
                registration.getTypeDesignations();
410
            }
411
        }
412
        TypeDesignationBase<?> nameTypeDesignation = nameService.loadTypeDesignation(typeDesignationUuid, Arrays.asList(""));
413
        registration.getTypeDesignations().add(nameTypeDesignation);
414
    }
415

  
398 416
    /**
399 417
     * Sets the registration identifier and submitter in case the registration is not yet persisted.
400 418
     *

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)