Custom DataStore LoadContext usage

Hi,

I need my application to query data from a legacy system which is in TopSpeed format.

For that my current solution is to load all data on the cuba application database and work from there, but I hate it because I need a sync code around to keep things updated.

The dataset is not big, I can easily hold it all in RAM and not bother with the database, which is what I am trying to do now.

So,
a) I have a Repository class I created that loads the TopSpeed file into a HashMap<Long, Client> and reloads when the source file is changed (nice, no sync code!).

public class Client extends BaseLongIdEntity implements Serializable

b) Then I have a DataStore class (implements DataStore) which uses the Repository.
c) the DataStore .load() method works (ugly, but works):

@Nullable
@Override
public <E extends Entity> E load(LoadContext<E> context) {
    if(!clientRepository.isLoaded()) clientRepository.refresh();
    return (E) clientRepository.getClient((long) context.getId());
}

And now the question: How do I implement loadList() ??? And other CUBA niceties.

  1. I have @MetaProperty on all fields, but CUBA won’t show them in the Filter control

  2. How can I parse the LoadContext / LoadContext.query to filter the returned list? (I currently return all values and that works).

  3. Am I overthinking? Maybe there’s a better solution to my main objective: use that second datasource without importing/syncing to a persisted database.

PS: I’m on 7.0BETA4 but I guess the version does not really matter to this question.

For the record,

After exploring option 3. on this thread: link it turns out that using an in-memory HSQL database is the easiest and probably most efficient way to achieve what I wanted.

With the extra bonus of retaining all CUBA features.
And the second extra bonus of being able to move to a temporary-file based HSQL anytime if needed.

How to do it is explained on the linked thread.