Project

General

Profile

« Previous | Next » 

Revision 0844524a

Added by Andreas Kohlbecker about 6 years ago

switching vom id based to uuid based ui navigation and entity references

View differences:

src/main/java/eu/etaxonomy/cdm/service/RegistrationWorkingSetService.java
15 15
import java.util.List;
16 16
import java.util.Optional;
17 17
import java.util.Set;
18
import java.util.UUID;
18 19

  
19 20
import org.apache.log4j.Logger;
21
import org.hibernate.Hibernate;
20 22
import org.springframework.beans.factory.annotation.Autowired;
21 23
import org.springframework.beans.factory.annotation.Qualifier;
22 24
import org.springframework.stereotype.Service;
......
152 154
    }
153 155

  
154 156

  
157
    /**
158
     * @param id the Registration entity id
159
     * @return
160
     */
161
    @Override
162
    public RegistrationDTO loadDtoByUuid(UUID uuid) {
163
        Registration reg = repo.getRegistrationService().load(uuid, REGISTRATION_INIT_STRATEGY);
164
        inititializeSpecimen(reg);
165
        return new RegistrationDTO(reg);
166
    }
167

  
168

  
155 169
    @Override
156 170
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex) {
157 171

  
......
178 192
        return dtoPager;
179 193
    }
180 194

  
195
    /**
196
     * {@inheritDoc}
197
     * @throws RegistrationValidationException
198
     */
199
    @Override
200
    public RegistrationWorkingSet loadWorkingSetByReferenceUuid(UUID referenceUuid) throws RegistrationValidationException {
201

  
202
        Reference reference = repo.getReferenceService().find(referenceUuid);
203
        repo.getReferenceService().load(reference.getUuid()); // needed to avoid the problem described in #7331
204

  
205
        Pager<Registration> pager = repo.getRegistrationService().page(Optional.of(reference), null, null, null, REGISTRATION_INIT_STRATEGY);
206

  
207
        /* for debugging https://dev.e-taxonomy.eu/redmine/issues/7331 */
208
        // debugIssue7331(pager);
209
        return new RegistrationWorkingSet(makeDTOs(pager.getRecords()));
210
    }
211

  
181 212
    /**
182 213
     * {@inheritDoc}
183 214
     * @throws RegistrationValidationException
......
190 221

  
191 222
        Pager<Registration> pager = repo.getRegistrationService().page(Optional.of(reference), null, null, null, REGISTRATION_INIT_STRATEGY);
192 223

  
193
        /* for debugging https://dev.e-taxonomy.eu/redmine/issues/7331
224
        /* for debugging https://dev.e-taxonomy.eu/redmine/issues/7331 */
225
        // debugIssue7331(pager);
226

  
227
        return new RegistrationWorkingSet(makeDTOs(pager.getRecords()));
228
    }
229

  
230

  
231
    /**
232
     * @param pager
233
     */
234
    @SuppressWarnings("unused")
235
    private void debugIssue7331(Pager<Registration> pager) {
194 236
        for(Registration reg : pager.getRecords()){
195 237
            if(reg.getName() != null && reg.getName().getNomenclaturalReference().getAuthorship() != null){
196 238
                Reference ref = (Reference) reg.getName().getNomenclaturalReference();
......
201 243
                logger.debug("NO AUTHORS");
202 244
            }
203 245
        }
204
        */
205
        return new RegistrationWorkingSet(makeDTOs(pager.getRecords()));
206 246
    }
207 247

  
208 248
    @Override
209
    public Set<RegistrationDTO> loadBlockingRegistrations(Integer blockedRegistrationId){
249
    public Set<RegistrationDTO> loadBlockingRegistrations(UUID blockedRegistrationUuid){
210 250

  
211
        Registration registration = repo.getRegistrationService().load(blockedRegistrationId, BLOCKING_REGISTRATION_INIT_STRATEGY);
251
        Registration registration = repo.getRegistrationService().load(blockedRegistrationUuid, BLOCKING_REGISTRATION_INIT_STRATEGY);
212 252
        Set<Registration> registrations = registration.getBlockedBy();
213 253

  
214 254
        Set<RegistrationDTO> blockingSet = new HashSet<>();

Also available in: Unified diff