Search in sources :

Example 1 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly in project javarosa by opendatakit.

the class TreeReferenceLevel method readExternal.

public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    name = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    multiplicity = ExtUtil.readInt(in);
    predicates = (List<XPathExpression>) ExtUtil.nullIfEmpty((List<XPathExpression>) ExtUtil.read(in, new ExtWrapListPoly()));
}
Also used : XPathExpression(org.javarosa.xpath.expr.XPathExpression) ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly)

Example 2 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly in project javarosa by opendatakit.

the class XPathFuncExpr method writeExternal.

public void writeExternal(DataOutputStream out) throws IOException {
    List<XPathExpression> v = Arrays.asList(args);
    ExtUtil.write(out, id);
    ExtUtil.write(out, new ExtWrapListPoly(v));
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly)

Example 3 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly 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();
}
Also used : Condition(org.javarosa.core.model.condition.Condition) IConditionExpr(org.javarosa.core.model.condition.IConditionExpr) DataInstance(org.javarosa.core.model.instance.DataInstance) Recalculate(org.javarosa.core.model.condition.Recalculate) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap) Localizer(org.javarosa.core.services.locale.Localizer) ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) List(java.util.List) ArrayList(java.util.ArrayList) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 4 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly in project javarosa by opendatakit.

the class XPathStep method readExternal.

public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    axis = ExtUtil.readInt(in);
    test = ExtUtil.readInt(in);
    switch(test) {
        case TEST_NAME:
            name = (XPathQName) ExtUtil.read(in, XPathQName.class);
            break;
        case TEST_NAMESPACE_WILDCARD:
            namespace = ExtUtil.readString(in);
            break;
        case TEST_TYPE_PROCESSING_INSTRUCTION:
            literal = (String) ExtUtil.read(in, new ExtWrapNullable(String.class));
            break;
    }
    List<Object> v = (List<Object>) ExtUtil.read(in, new ExtWrapListPoly(), pf);
    predicates = new XPathExpression[v.size()];
    for (int i = 0; i < predicates.length; i++) predicates[i] = (XPathExpression) v.get(i);
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) List(java.util.List) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 5 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly in project javarosa by opendatakit.

the class XPathStep method writeExternal.

public void writeExternal(DataOutputStream out) throws IOException {
    ExtUtil.writeNumeric(out, axis);
    ExtUtil.writeNumeric(out, test);
    switch(test) {
        case TEST_NAME:
            ExtUtil.write(out, name);
            break;
        case TEST_NAMESPACE_WILDCARD:
            ExtUtil.writeString(out, namespace);
            break;
        case TEST_TYPE_PROCESSING_INSTRUCTION:
            ExtUtil.write(out, new ExtWrapNullable(literal));
            break;
    }
    List<XPathExpression> v = Arrays.asList(predicates);
    ExtUtil.write(out, new ExtWrapListPoly(v));
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Aggregations

ExtWrapListPoly (org.javarosa.core.util.externalizable.ExtWrapListPoly)14 ExtWrapNullable (org.javarosa.core.util.externalizable.ExtWrapNullable)9 ExtWrapTagged (org.javarosa.core.util.externalizable.ExtWrapTagged)7 List (java.util.List)5 ExtWrapList (org.javarosa.core.util.externalizable.ExtWrapList)5 ExtWrapMap (org.javarosa.core.util.externalizable.ExtWrapMap)5 ArrayList (java.util.ArrayList)4 Condition (org.javarosa.core.model.condition.Condition)2 Recalculate (org.javarosa.core.model.condition.Recalculate)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 IConditionExpr (org.javarosa.core.model.condition.IConditionExpr)1 DataInstance (org.javarosa.core.model.instance.DataInstance)1 Localizer (org.javarosa.core.services.locale.Localizer)1 OrderedMap (org.javarosa.core.util.OrderedMap)1 DeserializationException (org.javarosa.core.util.externalizable.DeserializationException)1 ExtWrapBase (org.javarosa.core.util.externalizable.ExtWrapBase)1 ExtWrapMapPoly (org.javarosa.core.util.externalizable.ExtWrapMapPoly)1 PrototypeFactory (org.javarosa.core.util.externalizable.PrototypeFactory)1 XPathExpression (org.javarosa.xpath.expr.XPathExpression)1