use of org.javarosa.core.util.externalizable.ExtWrapMap 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.ExtWrapMap 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.ExtWrapMap in project javarosa by opendatakit.
the class FormDef method writeExternal.
/**
* Writes the form definition object to the supplied stream.
*
* @param dos - the stream to write to.
* @throws IOException
*/
@Override
public void writeExternal(DataOutputStream dos) throws IOException {
ExtUtil.writeNumeric(dos, getID());
ExtUtil.writeString(dos, ExtUtil.emptyIfNull(getName()));
ExtUtil.write(dos, new ExtWrapNullable(getTitle()));
ExtUtil.write(dos, new ExtWrapListPoly(getChildren()));
ExtUtil.write(dos, getMainInstance());
ExtUtil.write(dos, new ExtWrapNullable(localizer));
List<Condition> conditions = dagImpl.getConditions();
List<Recalculate> recalcs = dagImpl.getRecalculates();
ExtUtil.write(dos, new ExtWrapList(conditions));
ExtUtil.write(dos, new ExtWrapList(recalcs));
ExtUtil.write(dos, new ExtWrapListPoly(outputFragments));
ExtUtil.write(dos, new ExtWrapMap(submissionProfiles));
// for support of multi-instance forms
ExtUtil.write(dos, new ExtWrapMap(formInstances, new ExtWrapTagged()));
ExtUtil.write(dos, new ExtWrapMap(eventListeners, new ExtWrapListPoly()));
ExtUtil.write(dos, new ExtWrapListPoly(extensions));
}
use of org.javarosa.core.util.externalizable.ExtWrapMap in project javarosa by opendatakit.
the class SubmissionProfile method readExternal.
@SuppressWarnings("unchecked")
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
ref = (IDataReference) ExtUtil.read(in, new ExtWrapTagged(IDataReference.class));
method = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
action = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
mediaType = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
attributeMap = (HashMap<String, String>) ExtUtil.read(in, new ExtWrapMap(String.class, String.class));
}
use of org.javarosa.core.util.externalizable.ExtWrapMap 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));
}
Aggregations