Search in sources :

Example 1 with Restorable

use of org.javarosa.core.model.util.restorable.Restorable in project javarosa by opendatakit.

the class XFormParser method restoreDataModel.

public static FormInstance restoreDataModel(Document doc, Class restorableType) {
    Restorable r = (restorableType != null ? (Restorable) PrototypeFactory.getInstance(restorableType) : null);
    Element e = doc.getRootElement();
    TreeElement te = buildInstanceStructure(e, null, buildNamespacesMap(e), null);
    FormInstance dm = new FormInstance(te);
    loadNamespaces(e, dm);
    if (r != null) {
        RestoreUtils.templateData(r, dm, null);
    }
    loadInstanceData(e, te, null);
    return dm;
}
Also used : TreeElement(org.javarosa.core.model.instance.TreeElement) AbstractTreeElement(org.javarosa.core.model.instance.AbstractTreeElement) Element(org.kxml2.kdom.Element) IFormElement(org.javarosa.core.model.IFormElement) FormInstance(org.javarosa.core.model.instance.FormInstance) Restorable(org.javarosa.core.model.util.restorable.Restorable) TreeElement(org.javarosa.core.model.instance.TreeElement) AbstractTreeElement(org.javarosa.core.model.instance.AbstractTreeElement)

Aggregations

IFormElement (org.javarosa.core.model.IFormElement)1 AbstractTreeElement (org.javarosa.core.model.instance.AbstractTreeElement)1 FormInstance (org.javarosa.core.model.instance.FormInstance)1 TreeElement (org.javarosa.core.model.instance.TreeElement)1 Restorable (org.javarosa.core.model.util.restorable.Restorable)1 Element (org.kxml2.kdom.Element)1