Project

General

Profile

Revision 08fc65ee

ID08fc65eebcf2f99481171560c1bb33e40921140b
Parent dc307095
Child cf186d49

Added by Andreas Müller about 1 month ago

revert moving loadRecursive maps and collections

View differences:

cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CacheLoader.java
228 228
     *
229 229
     * For in depth details on the mechanism see
230 230
     * {@link #loadRecursive(CdmBase, List, boolean)} and
231
     * {@link #getAndUpdateFieldVale(CdmBase, CdmBase, String, List, boolean)}
231
     * {@link #getAndUpdateFieldValue(CdmBase, CdmBase, String, List, boolean)}
232 232
     *
233 233
     * @param cdmEntity
234 234
     *            the entity to be put into the cache
......
287 287
     * Load the <code>cdmEntity</code> graph recursively into the cache and
288 288
     * updates entities which are already in the cache depending on the value of
289 289
     * <code>update</code>, for more in depth details on this mechanism see
290
     * {@link #getAndUpdateFieldVale(CdmBase, CdmBase, String, List, boolean)}.
290
     * {@link #getAndUpdateFieldValue(CdmBase, CdmBase, String, List, boolean)}.
291 291
     *
292 292
     * @param cdmEntity
293 293
     *            the entity to be loaded into the cache
......
344 344
        // retrieve the actual object corresponding to the field.
345 345
        // this object will be either a CdmBase or a Collection / Map
346 346
        // with CdmBase as the generic type
347
        Object fieldValue = getAndUpdateFieldVale(deproxiedEntity, cachedCdmEntity, field, alreadyVisitedEntities, update);
348
        if (fieldValue instanceof Map && !entityAlreadyVisisted(alreadyVisitedEntities, fieldValue)) {
349
            loadRecursiveMap((Map<Object,Object>)fieldValue, alreadyVisitedEntities, update);
350
        } else if(fieldValue instanceof Collection && !entityAlreadyVisisted(alreadyVisitedEntities, fieldValue)) {
351
            loadRecursiveCollection((Collection<?>)fieldValue, alreadyVisitedEntities, update);
352
        } else if (fieldValue instanceof CdmBase) {
347
        Object fieldValue = getAndUpdateFieldValue(deproxiedEntity, cachedCdmEntity, field, alreadyVisitedEntities, update);
348
        //Map and Collection are loaded recursivly in getAndUpdateFieldValue already
349
        if (fieldValue instanceof CdmBase) {
353 350
            CdmBase cdmEntityInSubGraph = (CdmBase)fieldValue;
354 351
            if(!entityAlreadyVisisted(alreadyVisitedEntities, cdmEntityInSubGraph) ) {
355 352
                if(cdmCacher.ignoreRecursiveLoad(cdmEntityInSubGraph)){
......
389 386
     *            them to the value of the cdm entity being loaded
390 387
     * @return
391 388
     */
392
    private CdmBase getAndUpdateFieldVale(CdmBase cdmEntity,
389
    private CdmBase getAndUpdateFieldValue(CdmBase cdmEntity,
393 390
            CdmBase cachedCdmEntity,
394 391
            String fieldName,
395 392
            List<Object> alreadyVisitedEntities,
......
456 453
                            return null;
457 454
                        }
458 455
                    }
459
//                } else if(obj instanceof Map && !entityAlreadyVisisted(alreadyVisitedEntities, obj)) {
460
//                    loadRecursiveMap((Map<Object,Object>)obj, alreadyVisitedEntities, update);
461
//                } else if(obj instanceof Collection && !entityAlreadyVisisted(alreadyVisitedEntities, obj)) {
462
//                    loadRecursiveCollection((Collection<?>)obj, alreadyVisitedEntities, update);
456
                } else if(obj instanceof Map && !entityAlreadyVisisted(alreadyVisitedEntities, obj)) {
457
                    loadRecursiveMap((Map<Object,Object>)obj, alreadyVisitedEntities, update);
458
                } else if(obj instanceof Collection && !entityAlreadyVisisted(alreadyVisitedEntities, obj)) {
459
                    loadRecursiveCollection((Collection<?>)obj, alreadyVisitedEntities, update);
463 460
                }
464 461
            }
465 462
            // we return the original cdm entity in the sub graph because we

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)