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.
-
I have @MetaProperty on all fields, but CUBA won’t show them in the Filter control
-
How can I parse the LoadContext / LoadContext.query to filter the returned list? (I currently return all values and that works).
-
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.