use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class TreeElement method writeExternal.
@Override
public void writeExternal(DataOutputStream out) throws IOException {
ExtUtil.writeString(out, ExtUtil.emptyIfNull(name));
ExtUtil.writeNumeric(out, multiplicity);
ExtUtil.writeNumeric(out, flags);
ExtUtil.write(out, new ExtWrapNullable(value == null ? null : new ExtWrapTagged(value)));
// child
if (children.isEmpty()) {
// 1.
ExtUtil.writeBool(out, false);
} else {
// 1.
ExtUtil.writeBool(out, true);
// 2.
ExtUtil.writeNumeric(out, children.size());
// 3.
for (TreeElement child : children) {
if (child.getClass() == TreeElement.class) {
// 3.1
ExtUtil.writeBool(out, true);
child.writeExternal(out);
} else {
// 3.2
ExtUtil.writeBool(out, false);
ExtUtil.write(out, new ExtWrapTagged(child));
}
}
}
// end Jan 22, 2009
ExtUtil.writeNumeric(out, dataType);
ExtUtil.writeString(out, ExtUtil.emptyIfNull(instanceName));
// TODO: inefficient for repeats
ExtUtil.write(out, new ExtWrapNullable(constraint));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(preloadHandler));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(preloadParams));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(namespace));
ExtUtil.writeAttributes(out, bindAttributes);
ExtUtil.writeAttributes(out, attributes);
}
use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class CompactInstanceWrapper method readExternal.
/**
* deserialize a compact instance. note the retrieval of the template data instance
*/
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
int formID = ExtUtil.readInt(in);
instance = getTemplateInstance(formID).clone();
instance.setID(ExtUtil.readInt(in));
instance.setDateSaved((Date) ExtUtil.read(in, new ExtWrapNullable(Date.class)));
// formID, name, schema, versions, and namespaces are all invariants of the template instance
TreeElement root = instance.getRoot();
readTreeElement(root, in, pf);
}
use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class FormInstance method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
super.readExternal(in, pf);
schema = (String) ExtUtil.read(in, new ExtWrapNullable(String.class), pf);
dateSaved = (Date) ExtUtil.read(in, new ExtWrapNullable(Date.class), pf);
namespaces = (HashMap<String, Object>) ExtUtil.read(in, new ExtWrapMap(String.class, String.class));
setRoot((TreeElement) ExtUtil.read(in, TreeElement.class, pf));
}
use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class TreeReference method readExternal.
@Override
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
refLevel = ExtUtil.readInt(in);
instanceName = (String) ExtUtil.read(in, new ExtWrapNullable(String.class), pf);
contextType = ExtUtil.readInt(in);
int size = ExtUtil.readInt(in);
for (int i = 0; i < size; ++i) {
TreeReferenceLevel level = (TreeReferenceLevel) ExtUtil.read(in, TreeReferenceLevel.class);
this.add(level.intern());
}
}
use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class XPathQName method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
namespace = (String) ExtUtil.read(in, new ExtWrapNullable(String.class));
name = ExtUtil.readString(in);
}
Aggregations