Project

General

Profile

Revision 148bdb5b

ID148bdb5b72244815d8483ae339c516ce136ce0b5
Parent 6ed17427
Child 0faf24b5

Added by Andreas Kohlbecker about 2 years ago

ref #7622 addTypeDesignation() to receive registration uuids instead of objects

View differences:

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

  
145 145
    boolean checkRegistrationExistsFor(TaxonName name);
146 146

  
147
    public void addTypeDesignation(Registration reg, UUID typeDesignationUuid);
147
    public void addTypeDesignation(UUID registrationUUID, UUID typeDesignationUuid);
148 148

  
149 149
    // ============================================================================================
150 150

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/RegistrationServiceImpl.java
260 260

  
261 261
    @Override
262 262
    @Transactional(readOnly=false)
263
    public void addTypeDesignation(Registration reg, UUID typeDesignationUuid){
263
    public void addTypeDesignation(UUID registrationUUID, UUID typeDesignationUuid){
264 264

  
265
        reg = assureIsPersisted(reg);
266 265
        // load the typeDesignations with the registration so that typified names can not be twice in detached sessions
267 266
        // otherwise multiple representation problems might occur
268
        Registration registration = load(reg.getUuid(), Arrays.asList("typeDesignations"));
267
        Registration registration = load(registrationUUID, Arrays.asList("typeDesignations"));
268
        if(registration == null){
269
            registration = newRegistration();
270
            registration = assureIsPersisted(registration);
271
        }
269 272
        TypeDesignationBase<?> nameTypeDesignation = repository.getNameService().loadTypeDesignation(typeDesignationUuid, Arrays.asList(""));
270 273
        registration.getTypeDesignations().add(nameTypeDesignation);
271
        // getSession().merge(registration); // not needed!
272 274
    }
273 275

  
274 276
    /**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)