Search in sources :

Example 6 with FormStorageProvider

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);
    }
}
Also used : FormStorageProvider(org.activityinfo.store.spi.FormStorageProvider) FormStorage(org.activityinfo.store.spi.FormStorage) HrdFormStorage(org.activityinfo.store.hrd.HrdFormStorage)

Example 7 with FormStorageProvider

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));
}
Also used : FormStorageProvider(org.activityinfo.store.spi.FormStorageProvider) FormTreeBuilder(org.activityinfo.model.formTree.FormTreeBuilder)

Example 8 with FormStorageProvider

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);
}
Also used : FormStorageProvider(org.activityinfo.store.spi.FormStorageProvider)

Aggregations

FormStorageProvider (org.activityinfo.store.spi.FormStorageProvider)8 HrdFormStorage (org.activityinfo.store.hrd.HrdFormStorage)3 FormStorage (org.activityinfo.store.spi.FormStorage)3 Updater (org.activityinfo.store.query.server.Updater)2 EntityTransaction (javax.persistence.EntityTransaction)1 JsonValue (org.activityinfo.json.JsonValue)1 FormTreeBuilder (org.activityinfo.model.formTree.FormTreeBuilder)1 MySqlStorageProvider (org.activityinfo.store.mysql.MySqlStorageProvider)1 ColumnSetBuilder (org.activityinfo.store.query.server.ColumnSetBuilder)1 NullFormSupervisor (org.activityinfo.store.query.shared.NullFormSupervisor)1