use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class SubmissionProfile method writeExternal.
public void writeExternal(DataOutputStream out) throws IOException {
ExtUtil.write(out, new ExtWrapTagged(ref));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(method));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(action));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(mediaType));
ExtUtil.write(out, new ExtWrapMap(attributeMap));
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class SetValueAction method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
target = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
explicitValue = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
if (explicitValue == null) {
value = (XPathExpression) ExtUtil.read(in, new ExtWrapTagged(), pf);
}
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class TreeElement method readExternal.
/* ==== SERIALIZATION ==== */
/*
* TODO:
*
* this new serialization scheme is kind of lame. ideally, we shouldn't have
* to sub-class TreeElement at all; we should have an API that can
* seamlessly represent complex data model objects (like weight history or
* immunizations) as if they were explicity XML subtrees underneath the
* parent TreeElement
*
* failing that, we should wrap this scheme in an ExternalizableWrapper
*/
@Override
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
name = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
multiplicity = ExtUtil.readInt(in);
flags = ExtUtil.readInt(in);
value = (IAnswerData) ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
// child
if (!ExtUtil.readBool(in)) {
// 1.
// todo is this needed?
children.clear();
} else {
// 2.
int numChildren = (int) ExtUtil.readNumeric(in);
children.clear();
// 3.
List<TreeElement> newChildren = new ArrayList<>(numChildren);
for (int i = 0; i < numChildren; ++i) {
boolean normal = ExtUtil.readBool(in);
TreeElement child;
if (normal) {
// 3.1
child = new TreeElement();
child.readExternal(in, pf);
} else {
// 3.2
child = (TreeElement) ExtUtil.read(in, new ExtWrapTagged(), pf);
}
child.setParent(this);
newChildren.add(child);
}
children.addAll(newChildren);
}
// end Jan 22, 2009
dataType = ExtUtil.readInt(in);
instanceName = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
constraint = (Constraint) ExtUtil.read(in, new ExtWrapNullable(Constraint.class), pf);
preloadHandler = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
preloadParams = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
namespace = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
bindAttributes = ExtUtil.readAttributes(in, this);
attributes = ExtUtil.readAttributes(in, this);
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class DataBinding method writeExternal.
/* (non-Javadoc)
* @see org.javarosa.core.services.storage.utilities.Externalizable#writeExternal(java.io.DataOutputStream)
*/
public void writeExternal(DataOutputStream out) throws IOException {
ExtUtil.write(out, new ExtWrapNullable(getId()));
ExtUtil.writeNumeric(out, getDataType());
ExtUtil.write(out, new ExtWrapNullable(getPreload()));
ExtUtil.write(out, new ExtWrapNullable(getPreloadParams()));
ExtUtil.write(out, new ExtWrapTagged(ref));
// don't bother writing relevancy/required/readonly/constraint/calculate/additionalAttrs right now; they're only used during parse anyway
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class Triggerable method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
expr = (IConditionExpr) ExtUtil.read(in, new ExtWrapTagged(), pf);
contextRef = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
originalContextRef = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
List<TreeReference> tlist = (List<TreeReference>) ExtUtil.read(in, new ExtWrapList(TreeReference.class), pf);
targets = new ArrayList<TreeReference>(tlist);
}
Aggregations