use of org.activityinfo.store.spi.FormStorageProvider in project activityinfo by bedatadriven.
the class ActivityInfoClientAsyncStub method getRecord.
@Override
public Promise<Maybe<FormRecord>> getRecord(String formId, String recordId) {
try {
FormStorageProvider catalog = newCatalog();
Optional<FormStorage> storage = catalog.getForm(ResourceId.valueOf(formId));
if (!storage.isPresent()) {
return Promise.resolved(Maybe.<FormRecord>notFound());
}
Optional<FormRecord> record = storage.get().get(ResourceId.valueOf(recordId));
if (!record.isPresent()) {
return Promise.resolved(Maybe.<FormRecord>notFound());
}
return Promise.resolved(Maybe.of(record.get()));
} catch (Exception e) {
return Promise.rejected(e);
}
}
use of org.activityinfo.store.spi.FormStorageProvider in project activityinfo by bedatadriven.
the class ActivityInfoClientAsyncStub method getFormTree.
@Override
public Promise<FormTree> getFormTree(ResourceId formId) {
FormStorageProvider newCatalog = newCatalog();
FormTreeBuilder treeBuilder = new FormTreeBuilder(newCatalog);
return Promise.resolved(treeBuilder.queryTree(formId));
}
use of org.activityinfo.store.spi.FormStorageProvider in project activityinfo by bedatadriven.
the class ActivityInfoClientAsyncStub method getFormSchema.
@Override
public Promise<FormClass> getFormSchema(String formId) {
FormStorageProvider catalog = newCatalog();
FormClass formClass;
try {
formClass = defensiveCopy(catalog.getFormClass(ResourceId.valueOf(formId)));
} catch (Exception e) {
return Promise.rejected(e);
}
return Promise.resolved(formClass);
}
Aggregations