Beispiel #1
0
        /// <summary>Reads a group definition object from the supplied stream. </summary>
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public virtual void  readExternal(System.IO.BinaryReader dis, PrototypeFactory pf)
        {
            ID             = ExtUtil.readInt(dis);
            AppearanceAttr = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            Bind           = (IDataReference)ExtUtil.read(dis, new ExtWrapTagged(), pf);
            TextID         = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            LabelInnerText = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            Repeat         = ExtUtil.readBool(dis);
            Children       = (System.Collections.ArrayList)ExtUtil.read(dis, new ExtWrapListPoly(), pf);

            noAddRemove = ExtUtil.readBool(dis);
            count       = (IDataReference)ExtUtil.read(dis, new ExtWrapNullable(new ExtWrapTagged()), pf);

            chooseCaption    = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            addCaption       = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            delCaption       = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            doneCaption      = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            addEmptyCaption  = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            doneEmptyCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            entryHeader      = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            delHeader        = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
            mainHeader       = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));

            additionalAttributes = ExtUtil.readAttributes(dis, null);
        }
Beispiel #2
0
        /* (non-Javadoc)
         * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream)
         */
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public virtual void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            Id            = ((System.String)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(System.String)), pf));
            DataType      = ExtUtil.readInt(in_Renamed);
            Preload       = ((System.String)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(System.String)), pf));
            PreloadParams = ((System.String)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(System.String)), pf));
            ref_Renamed   = (IDataReference)ExtUtil.read(in_Renamed, new ExtWrapTagged());

            //don't bother reading relevancy/required/readonly/constraint/calculate/additionalAttrs right now; they're only used during parse anyway
        }
Beispiel #3
0
        /// <summary> deserialize a compact instance. note the retrieval of the template data instance</summary>
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public virtual void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            int formID = ExtUtil.readInt(in_Renamed);

            instance = getTemplateInstance(formID).Clone();

            instance.ID        = ExtUtil.readInt(in_Renamed);
            instance.DateSaved = (System.DateTime)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(System.DateTime)));
            //formID, name, schema, versions, and namespaces are all invariants of the template instance

            TreeElement root = instance.getRoot();

            readTreeElement(root, in_Renamed, pf);
        }
Beispiel #4
0
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public override void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            init_context = ExtUtil.readInt(in_Renamed);
            if (init_context == INIT_CONTEXT_EXPR)
            {
                filtExpr = (XPathFilterExpr)ExtUtil.read(in_Renamed, typeof(XPathFilterExpr), pf);
            }

            System.Collections.ArrayList v = (System.Collections.ArrayList)ExtUtil.read(in_Renamed, new ExtWrapList(typeof(XPathStep)), pf);
            steps = new XPathStep[v.Count];
            for (int i = 0; i < steps.Length; i++)
            {
                steps[i] = ((XPathStep)v[i]).intern();
            }
        }
Beispiel #5
0
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public virtual void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            axis = ExtUtil.readInt(in_Renamed);
            test = ExtUtil.readInt(in_Renamed);

            switch (test)
            {
            case TEST_NAME:  name = (XPathQName)ExtUtil.read(in_Renamed, typeof(XPathQName)); break;

            case TEST_NAMESPACE_WILDCARD:  namespace_Renamed = ExtUtil.readString(in_Renamed); break;

            case TEST_TYPE_PROCESSING_INSTRUCTION:  literal = ((System.String)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(System.String)))); break;
            }

            System.Collections.ArrayList v = (System.Collections.ArrayList)ExtUtil.read(in_Renamed, new ExtWrapListPoly(), pf);
            predicates = new XPathExpression[v.Count];
            for (int i = 0; i < predicates.Length; i++)
            {
                predicates[i] = (XPathExpression)v[i];
            }
        }
Beispiel #6
0
        /*
         * (non-Javadoc)
         * @see org.javarosa.core.util.Externalizable#readExternal(java.io.DataInputStream)
         */
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public virtual void  readExternal(System.IO.BinaryReader dis, PrototypeFactory pf)
        {
            ID             = ExtUtil.readInt(dis);
            binding        = (IDataReference)ExtUtil.read(dis, new ExtWrapNullable(new ExtWrapTagged()), pf);
            AppearanceAttr = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            TextID         = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            LabelInnerText = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            HelpText       = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            HelpTextID     = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));
            HelpInnerText  = ((System.String)ExtUtil.read(dis, new ExtWrapNullable(typeof(System.String)), pf));

            ControlType = ExtUtil.readInt(dis);

            additionalAttributes = ExtUtil.readAttributes(dis, null);

            choices = ExtUtil.nullIfEmpty((System.Collections.ArrayList)ExtUtil.read(dis, new ExtWrapList(typeof(SelectChoice)), pf));
            for (int i = 0; i < NumChoices; i++)
            {
                choices.elementAt(i).setIndex(i);
            }
            DynamicChoices = (ItemsetBinding)ExtUtil.read(dis, new ExtWrapNullable(typeof(ItemsetBinding)));
        }
Beispiel #7
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public override void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     op = ExtUtil.readInt(in_Renamed);
     base.readExternal(in_Renamed, pf);
 }
Beispiel #8
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public virtual void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     n = ExtUtil.readInt(in_Renamed);
 }
Beispiel #9
0
 /* (non-Javadoc)
  * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream)
  */
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public virtual void readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     xmlValue = ExtUtil.readString(in_Renamed);
     index    = ExtUtil.readInt(in_Renamed);
 }
Beispiel #10
0
        /// <summary> recursively read in a node of the instance, by filling out the template instance</summary>
        /// <param name="e">
        /// </param>
        /// <param name="ref">
        /// </param>
        /// <param name="in">
        /// </param>
        /// <param name="pf">
        /// </param>
        /// <throws>  IOException </throws>
        /// <throws>  DeserializationException </throws>
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        private void  readTreeElement(TreeElement e, System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            TreeElement templ   = instance.getTemplatePath(e.Ref);
            bool        isGroup = !templ.Leaf;

            if (isGroup)
            {
                System.Collections.ArrayList childTypes = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
                for (int i = 0; i < templ.NumChildren; i++)
                {
                    System.String childName = templ.getChildAt(i).Name;
                    if (!childTypes.Contains(childName))
                    {
                        childTypes.Add(childName);
                    }
                }

                for (int i = 0; i < childTypes.Count; i++)
                {
                    System.String childName = (System.String)childTypes[i];

                    TreeReference childTemplRef = e.Ref.extendRef(childName, 0);
                    TreeElement   childTempl    = instance.getTemplatePath(childTemplRef);

                    bool repeatable = childTempl.Repeatable;
                    int  n          = ExtUtil.readInt(in_Renamed);

                    bool relevant = (n > 0);
                    if (!repeatable && n > 1)
                    {
                        throw new DeserializationException("Detected repeated instances of a non-repeatable node");
                    }

                    if (repeatable)
                    {
                        int mult = e.getChildMultiplicity(childName);
                        for (int j = mult - 1; j >= 0; j--)
                        {
                            e.removeChild(childName, j);
                        }

                        for (int j = 0; j < n; j++)
                        {
                            TreeReference dstRef = e.Ref.extendRef(childName, j);
                            try
                            {
                                instance.copyNode(childTempl, dstRef);
                            }
                            catch (InvalidReferenceException ire)
                            {
                                //If there is an invalid reference, this is a malformed instance,
                                //so we'll throw a Deserialization exception.
                                TreeReference r = ire.InvalidReference;
                                if (r == null)
                                {
                                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                                    throw new DeserializationException("Null Reference while attempting to deserialize! " + ire.Message);
                                }
                                else
                                {
                                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                                    throw new DeserializationException("Invalid Reference while attemtping to deserialize! Reference: " + r.toString(true) + " | " + ire.Message);
                                }
                            }

                            TreeElement child = e.getChild(childName, j);
                            child.setRelevant(true);
                            readTreeElement(child, in_Renamed, pf);
                        }
                    }
                    else
                    {
                        TreeElement child = e.getChild(childName, 0);
                        child.setRelevant(relevant);
                        if (relevant)
                        {
                            readTreeElement(child, in_Renamed, pf);
                        }
                    }
                }
            }
            else
            {
                e.Value = (IAnswerData)ExtUtil.read(in_Renamed, new ExtWrapAnswerData(this, e.DataType));
            }
        }