use of org.opendatakit.aggregate.form.XFormParameters in project briefcase by opendatakit.
the class XmlManipulationUtils method getFormInstanceMetadata.
public static FormInstanceMetadata getFormInstanceMetadata(Element root) throws ParsingException {
// check for odk id
String formId = root.getAttributeValue(null, FORM_ID_ATTRIBUTE_NAME);
// if odk id is not present use namespace
if (formId == null || formId.equalsIgnoreCase(EMPTY_STRING)) {
String schema = root.getAttributeValue(null, NAMESPACE_ATTRIBUTE);
// TODO: move this into FormDefinition?
if (schema == null) {
throw new ParsingException("Unable to extract form id");
}
formId = schema;
}
String modelVersionString = root.getAttributeValue(null, MODEL_VERSION_ATTRIBUTE_NAME);
String instanceId = getOpenRosaInstanceId(root);
if (instanceId == null) {
instanceId = root.getAttributeValue(null, INSTANCE_ID_ATTRIBUTE_NAME);
}
String base64EncryptedFieldKey = getBase64EncryptedFieldKey(root);
return new FormInstanceMetadata(new XFormParameters(formId, modelVersionString), instanceId, base64EncryptedFieldKey);
}
Aggregations