Search in sources :

Example 1 with FormChangeWatcher

use of org.activityinfo.ui.client.store.http.FormChangeWatcher in project activityinfo by bedatadriven.

the class OfflineStore method getCachedMetadata.

/**
 * Try to load a cached FormSchema from the offline store.
 */
public Observable<FormMetadata> getCachedMetadata(ResourceId formId) {
    Observable<FormClass> schema = new ObservableTask<>(new SchemaQuery(database, formId), new FormChangeWatcher(eventBus, change -> change.isFormChanged(formId)));
    Observable<FormMetadataObject> metadata = new ObservableTask<>(new MetadataQuery(database, formId), new FormChangeWatcher(eventBus, change -> change.isFormChanged(formId)));
    return Observable.transform(schema, metadata, (s, m) -> FormMetadata.of(m.getVersion(), s, m.getPermissions()));
}
Also used : ObservableTask(org.activityinfo.ui.client.store.tasks.ObservableTask) FormTreeLoader(org.activityinfo.ui.client.store.FormTreeLoader) java.util(java.util) Json(org.activityinfo.json.Json) ObservableTree(org.activityinfo.observable.ObservableTree) Function2(org.activityinfo.promise.Function2) IDBTransaction(org.activityinfo.indexedb.IDBTransaction) Promise(org.activityinfo.promise.Promise) org.activityinfo.model.form(org.activityinfo.model.form) FormChange(org.activityinfo.ui.client.store.FormChange) Level(java.util.logging.Level) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) HttpStore(org.activityinfo.ui.client.store.http.HttpStore) OfflineDatabase(org.activityinfo.indexedb.OfflineDatabase) ResourceId(org.activityinfo.model.resource.ResourceId) RecordRef(org.activityinfo.model.type.RecordRef) JsonValue(org.activityinfo.json.JsonValue) RecordUpdate(org.activityinfo.model.resource.RecordUpdate) FormChangeWatcher(org.activityinfo.ui.client.store.http.FormChangeWatcher) Function(com.google.common.base.Function) ImmutableSet(com.google.common.collect.ImmutableSet) FormChangeEvent(org.activityinfo.ui.client.store.FormChangeEvent) EventBus(com.google.gwt.event.shared.EventBus) IDBFactory(org.activityinfo.indexedb.IDBFactory) StatefulValue(org.activityinfo.observable.StatefulValue) Logger(java.util.logging.Logger) ObservableTask(org.activityinfo.ui.client.store.tasks.ObservableTask) ColumnSet(org.activityinfo.model.query.ColumnSet) QueryModel(org.activityinfo.model.query.QueryModel) SimpleEventBus(com.google.gwt.event.shared.SimpleEventBus) RecordTransaction(org.activityinfo.model.resource.RecordTransaction) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Observable(org.activityinfo.observable.Observable) Maybe(org.activityinfo.promise.Maybe) FormTree(org.activityinfo.model.formTree.FormTree) FormChangeWatcher(org.activityinfo.ui.client.store.http.FormChangeWatcher)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Function (com.google.common.base.Function)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 EventBus (com.google.gwt.event.shared.EventBus)1 SimpleEventBus (com.google.gwt.event.shared.SimpleEventBus)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 java.util (java.util)1 Level (java.util.logging.Level)1 Logger (java.util.logging.Logger)1 IDBFactory (org.activityinfo.indexedb.IDBFactory)1 IDBTransaction (org.activityinfo.indexedb.IDBTransaction)1 OfflineDatabase (org.activityinfo.indexedb.OfflineDatabase)1 Json (org.activityinfo.json.Json)1 JsonValue (org.activityinfo.json.JsonValue)1 org.activityinfo.model.form (org.activityinfo.model.form)1 FormTree (org.activityinfo.model.formTree.FormTree)1 ColumnSet (org.activityinfo.model.query.ColumnSet)1 QueryModel (org.activityinfo.model.query.QueryModel)1 RecordTransaction (org.activityinfo.model.resource.RecordTransaction)1 RecordUpdate (org.activityinfo.model.resource.RecordUpdate)1