use of org.javarosa.core.util.externalizable.ExtWrapTagged 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.ExtWrapTagged in project javarosa by opendatakit.
the class XPathConditional method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
expr = (XPathExpression) ExtUtil.read(in, new ExtWrapTagged(), pf);
hasNow = (boolean) ExtUtil.readBool(in);
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class XPathBinaryOpExpr method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
a = (XPathExpression) ExtUtil.read(in, new ExtWrapTagged(), pf);
b = (XPathExpression) ExtUtil.read(in, new ExtWrapTagged(), pf);
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class FormDef method readExternal.
/**
* Reads the form definition object from the supplied stream.
* <p/>
* Requires that the instance has been set to a prototype of the instance
* that should be used for deserialization.
*
* @param dis - the stream to read from.
* @throws IOException
* @throws InstantiationException
* @throws IllegalAccessException
*/
@Override
public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException {
setID(ExtUtil.readInt(dis));
setName(ExtUtil.nullIfEmpty(ExtUtil.readString(dis)));
setTitle((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
setChildren((List<IFormElement>) ExtUtil.read(dis, new ExtWrapListPoly(), pf));
setInstance((FormInstance) ExtUtil.read(dis, FormInstance.class, pf));
setLocalizer((Localizer) ExtUtil.read(dis, new ExtWrapNullable(Localizer.class), pf));
List<Condition> vcond = (List<Condition>) ExtUtil.read(dis, new ExtWrapList(Condition.class), pf);
for (Condition condition : vcond) {
addTriggerable(condition);
}
List<Recalculate> vcalc = (List<Recalculate>) ExtUtil.read(dis, new ExtWrapList(Recalculate.class), pf);
for (Recalculate recalculate : vcalc) {
addTriggerable(recalculate);
}
finalizeTriggerables();
outputFragments = (List<IConditionExpr>) ExtUtil.read(dis, new ExtWrapListPoly(), pf);
submissionProfiles = (HashMap<String, SubmissionProfile>) ExtUtil.read(dis, new ExtWrapMap(String.class, SubmissionProfile.class));
formInstances = (HashMap<String, DataInstance>) ExtUtil.read(dis, new ExtWrapMap(String.class, new ExtWrapTagged()), pf);
eventListeners = (HashMap<String, List<Action>>) ExtUtil.read(dis, new ExtWrapMap(String.class, new ExtWrapListPoly()), pf);
extensions = (List<XFormExtension>) ExtUtil.read(dis, new ExtWrapListPoly(), pf);
resetEvaluationContext();
}
use of org.javarosa.core.util.externalizable.ExtWrapTagged in project javarosa by opendatakit.
the class ItemsetBinding method readExternal.
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
nodesetExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapTagged(), pf);
contextRef = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
labelExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapTagged(), pf);
valueExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
copyExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
labelIsItext = ExtUtil.readBool(in);
copyMode = ExtUtil.readBool(in);
}
Aggregations