Search in sources :

Example 1 with Updater

use of org.activityinfo.store.query.server.Updater in project activityinfo by bedatadriven.

the class ResourceLocatorSyncImpl method persist.

@Override
public void persist(FormInstance formInstance) {
    Updater updater = new Updater(catalog.get(), authenticatedUser.get().getUserId(), blobAuthorizer, new HrdSerialNumberProvider());
    updater.execute(formInstance);
}
Also used : Updater(org.activityinfo.store.query.server.Updater) HrdSerialNumberProvider(org.activityinfo.store.hrd.HrdSerialNumberProvider)

Example 2 with Updater

use of org.activityinfo.store.query.server.Updater in project activityinfo by bedatadriven.

the class ActivityInfoClientAsyncStub method updateRecord.

@Override
public Promise<Void> updateRecord(String formId, String recordId, FormRecordUpdateBuilder query) {
    try {
        FormStorageProvider catalog = newCatalog();
        Updater updater = new Updater(catalog, currentUserId(), blobAuthorizer, new SerialNumberProviderStub());
        updater.execute(ResourceId.valueOf(formId), ResourceId.valueOf(recordId), query.toJsonObject());
        return Promise.resolved(null);
    } catch (Exception e) {
        return Promise.rejected(e);
    }
}
Also used : FormStorageProvider(org.activityinfo.store.spi.FormStorageProvider) Updater(org.activityinfo.store.query.server.Updater)

Example 3 with Updater

use of org.activityinfo.store.query.server.Updater in project activityinfo by bedatadriven.

the class TestingStorageProvider method updateRecords.

public void updateRecords(RecordTransaction transaction) {
    Updater updater = new Updater(this, 1, new BlobAuthorizerStub(), serialNumberProvider);
    updater.execute(transaction);
}
Also used : Updater(org.activityinfo.store.query.server.Updater)

Example 4 with Updater

use of org.activityinfo.store.query.server.Updater in project activityinfo by bedatadriven.

the class MySqlUpdateTest method updateAdminEntity.

@Test
public void updateAdminEntity() throws JsonMappingException {
    RecordUpdate changeObject = new RecordUpdate();
    changeObject.setRecordId(entity(21).asString());
    changeObject.setFormId(adminLevelFormClass(2).asString());
    changeObject.setFieldValue("name", "Nouveau Irumu");
    Updater updater = updater();
    updater.setEnforcePermissions(false);
    updater.executeChange(changeObject);
    query(adminLevelFormClass(2), "_id", "name");
    assertThat(column("_id"), hasValues("z0000000010", "z0000000011", "z0000000012", "z0000000013", "z0000000021"));
    assertThat(column("name"), hasValues("Bukavu", "Walungu", "Shabunda", "Kalehe", "Nouveau Irumu"));
}
Also used : RecordUpdate(org.activityinfo.model.resource.RecordUpdate) TypedRecordUpdate(org.activityinfo.store.spi.TypedRecordUpdate) Updater(org.activityinfo.store.query.server.Updater) Test(org.junit.Test)

Example 5 with Updater

use of org.activityinfo.store.query.server.Updater in project activityinfo by bedatadriven.

the class MySqlUpdateTest method executeUpdate.

private void executeUpdate(FormInstance creation) {
    Updater updater = updater();
    updater.execute(creation);
}
Also used : Updater(org.activityinfo.store.query.server.Updater)

Aggregations

Updater (org.activityinfo.store.query.server.Updater)19 Test (org.junit.Test)13 TypedRecordUpdate (org.activityinfo.store.spi.TypedRecordUpdate)12 RecordUpdate (org.activityinfo.model.resource.RecordUpdate)11 GeoPoint (org.activityinfo.model.type.geo.GeoPoint)3 ResourceId (org.activityinfo.model.resource.ResourceId)2 FormStorageProvider (org.activityinfo.store.spi.FormStorageProvider)2 JsonValue (org.activityinfo.json.JsonValue)1 FormClass (org.activityinfo.model.form.FormClass)1 FormField (org.activityinfo.model.form.FormField)1 FormInstance (org.activityinfo.model.form.FormInstance)1 FormRecord (org.activityinfo.model.form.FormRecord)1 KeyGenerator (org.activityinfo.model.legacy.KeyGenerator)1 ColumnSet (org.activityinfo.model.query.ColumnSet)1 QueryModel (org.activityinfo.model.query.QueryModel)1 EnumValue (org.activityinfo.model.type.enumerated.EnumValue)1 Quantity (org.activityinfo.model.type.number.Quantity)1 HrdSerialNumberProvider (org.activityinfo.store.hrd.HrdSerialNumberProvider)1 ColumnSetBuilder (org.activityinfo.store.query.server.ColumnSetBuilder)1 InvalidUpdateException (org.activityinfo.store.query.server.InvalidUpdateException)1