Search in sources :

Example 1 with IStorageIterator

use of org.javarosa.core.services.storage.IStorageIterator in project javarosa by opendatakit.

the class RestoreUtils method exportRMS.

public static FormInstance exportRMS(IStorageUtility storage, Class type, String parentTag, IRecordFilter filter) {
    if (!Externalizable.class.isAssignableFrom(type) || !Restorable.class.isAssignableFrom(type)) {
        return null;
    }
    FormInstance dm = newDataModel(parentTag);
    IStorageIterator ri = storage.iterate();
    while (ri.hasMore()) {
        Object obj = ri.nextRecord();
        if (filter == null || filter.filter(obj)) {
            FormInstance objModel = ((Restorable) obj).exportData();
            mergeDataModel(dm, objModel, topRef(dm));
        }
    }
    return dm;
}
Also used : IStorageIterator(org.javarosa.core.services.storage.IStorageIterator) FormInstance(org.javarosa.core.model.instance.FormInstance)

Aggregations

FormInstance (org.javarosa.core.model.instance.FormInstance)1 IStorageIterator (org.javarosa.core.services.storage.IStorageIterator)1