Example #1
0
 public virtual IDataPayload createSerializedPayload(FormInstance model, IDataReference ref_Renamed)
 {
     init();
     rootRef = org.javarosa.core.model.instance.FormInstance.unpackReference(ref_Renamed);
     if (this.serializer == null)
     {
         this.AnswerDataSerializer = new XFormAnswerDataSerializer();
     }
     model.accept(this);
     if (theXmlDoc != null)
     {
         //TODO: Did this strip necessary data?
         sbyte[] form = XFormSerializer.getUtfBytes(theXmlDoc);
         if (dataPointers.Count == 0)
         {
             return(new ByteArrayPayload(form, null, org.javarosa.core.services.transport.payload.IDataPayload_Fields.PAYLOAD_TYPE_XML));
         }
         MultiMessagePayload payload = new MultiMessagePayload();
         payload.addPayload(new ByteArrayPayload(form, "xml_submission_file", org.javarosa.core.services.transport.payload.IDataPayload_Fields.PAYLOAD_TYPE_XML));
         System.Collections.IEnumerator en = dataPointers.GetEnumerator();
         //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
         while (en.MoveNext())
         {
             //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
             IDataPointer pointer = (IDataPointer)en.Current;
             payload.addPayload(new DataPointerPayload(pointer));
         }
         return(payload);
     }
     else
     {
         return(null);
     }
 }
Example #2
0
        /*
         * (non-Javadoc)
         * @see org.javarosa.core.model.utils.IInstanceSerializingVisitor#serializeDataModel(org.javarosa.core.model.IFormDataModel)
         */
        public virtual sbyte[] serializeInstance(FormInstance model, IDataReference ref_Renamed)
        {
            init();
            rootRef = org.javarosa.core.model.instance.FormInstance.unpackReference(ref_Renamed);
            if (this.serializer == null)
            {
                this.AnswerDataSerializer = new XFormAnswerDataSerializer();
            }

            model.accept(this);
            if (theXmlDoc != null)
            {
                return(XFormSerializer.getUtfBytes(theXmlDoc));
            }
            else
            {
                return(null);
            }
        }