Skip to content

cleanup PreloadingNetworkStoreClient assumes its delegate is CachedNetworkStoreClient #420

Open
@jonenst

Description

@jonenst

Describe the current behavior

public List<Resource<SubstationAttributes>> getSubstations(UUID networkUuid, int variantNum) {
    ensureCached(ResourceType.SUBSTATION, networkUuid, variantNum);
    return delegate.getSubstations(networkUuid, variantNum);
}

private void ensureCached(ResourceType resourceType, UUID networkUuid, int variantNum) {
    loadToCache(resourceType, networkUuid, variantNum);
    resourceTypes.add(resourceType);
} 

private void loadToCache(ResourceType resourceType, UUID networkUuid, int variantNum) {
    delegate.getSubstations(networkUuid, variantNum);
}

wee call getSubstations twice, so it works only for CachedNetworkStoreClient

Describe the expected behavior

refactor the code to force the delegate to be of type cachednetworkstoreclient for preloadingnetworkstoreclient ? because it doesn't make sense to preload for a client that doesn't not cache.

Describe the motivation

reduce code complexity

Extra Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions