/* === (DE)SERIALIZATION === */ /// <summary> Read the object from 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) { fallbackDefaultLocale = ExtUtil.readBool(dis); fallbackDefaultForm = ExtUtil.readBool(dis); localeResources =(OrderedMap < String, List< LocaleDataSource >>) ExtUtil.read(dis, new ExtWrapMap(String. }
public static FormDef getFormFromSerializedResource(System.String resource) { FormDef returnForm = null; //UPGRADE_ISSUE: Method 'java.lang.Class.getResourceAsStream' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetResourceAsStream_javalangString'" //UPGRADE_ISSUE: Class 'java.lang.System' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangSystem'" System.IO.Stream is_Renamed = typeof(Type).Assembly.GetManifestResourceStream(resource); //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'" System.IO.BinaryReader dis = null; try { if (is_Renamed != null) { dis = new System.IO.BinaryReader(is_Renamed); returnForm = (FormDef)ExtUtil.read(dis, typeof(FormDef)); } else { //#if debug.output==verbose System.Console.Out.WriteLine("ResourceStream NULL"); //#endif } } catch (System.IO.IOException e) { Console.Error.WriteLine(e.StackTrace); } catch (DeserializationException e) { Console.Error.WriteLine(e.StackTrace); } finally { if (is_Renamed != null) { try { is_Renamed.Close(); } catch (System.IO.IOException e) { Console.Error.WriteLine(e.StackTrace); } } if (dis != null) { try { //UPGRADE_TODO: Method 'java.io.FilterInputStream.close' was converted to 'System.IO.BinaryReader.Close' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFilterInputStreamclose'" dis.Close(); } catch (System.IO.IOException e) { Console.Error.WriteLine(e.StackTrace); } } } return(returnForm); }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { ref_ = (IDataReference)ExtUtil.read(in_, new ExtWrapTagged(typeof(IDataReference))); method = ExtUtil.readString(in_); action = ExtUtil.readString(in_); mediaType = ExtUtil.nullIfEmpty(ExtUtil.readString(in_)); attributeMap = (Dictionary <String, String>)ExtUtil.read(in_, new ExtWrapMap(typeof(String), typeof(String))); }
//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) { ref_Renamed = (IDataReference) ExtUtil.read(in_Renamed, new ExtWrapTagged(typeof(IDataReference))); method = ExtUtil.readString(in_Renamed); action = ExtUtil.nullIfEmpty(ExtUtil.readString(in_Renamed)); mediaType = ExtUtil.nullIfEmpty(ExtUtil.readString(in_Renamed)); attributeMap =(HashMap < String, String >) ExtUtil.read(in, new ExtWrapMap(String. }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { int length = in_.ReadInt32(); data = new IDataPointer[length]; for (int i = 0; i < data.Length; ++i) { data[i] = (IDataPointer)ExtUtil.read(in_, new ExtWrapTagged()); } }
/* (non-Javadoc) * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream) */ public void readExternal(BinaryReader in_, PrototypeFactory pf) { ID = ((String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf)); DataType = (ExtUtil.readInt(in_)); Preload = ((String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf)); PreloadParams = ((String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf)); ref_ = (IDataReference)ExtUtil.read(in_, new ExtWrapTagged()); //don't bother reading relevancy/required/readonly/constraint/calculate right now; they're only used during parse anyway }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { x = (XPathExpression)ExtUtil.read(in_, new ExtWrapTagged(), pf); ArrayList v = (ArrayList)ExtUtil.read(in_, new ExtWrapListPoly(), pf); predicates = new XPathExpression[v.Count]; for (int i = 0; i < predicates.Length; i++) { predicates[i] = (XPathExpression)v[i]; } }
/* * (non-Javadoc) * * @see * org.javarosa.core.services.storage.utilities.Externalizable#readExternal * (java.io.DataInputStream) */ public void readExternal(BinaryReader in_, PrototypeFactory pf) { id = ExtUtil.readInt(in_); formId = ExtUtil.readInt(in_); name = (String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf); schema = (String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf); dateSaved = (DateTime)ExtUtil.read(in_, new ExtWrapNullable(typeof(DateTime)), pf); namespaces = (Hashtable)ExtUtil.read(in_, new ExtWrapMap(typeof(String), typeof(String))); setRoot((TreeElement)ExtUtil.read(in_, typeof(TreeElement), pf)); }
public void readExternal(BinaryReader in_renamed, PrototypeFactory pf) { id = (XPathQName)ExtUtil.read(in_renamed, typeof(XPathQName)); ArrayList v = (ArrayList)ExtUtil.read(in_renamed, new ExtWrapListPoly(), pf); args = new XPathExpression[v.Count]; for (int i = 0; i < args.Length; i++) { args[i] = (XPathExpression)v[i]; } }
public void readExternal(BinaryReader in_renamed, PrototypeFactory pf) { nodesetRef = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf); nodesetExpr = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapTagged(), pf); contextRef = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf); labelRef = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf); labelExpr = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapTagged(), pf); valueRef = (TreeReference)ExtUtil.read(in_renamed, new ExtWrapNullable(typeof(TreeReference)), pf); valueExpr = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapNullable(new ExtWrapTagged()), pf); copyRef = (TreeReference)ExtUtil.read(in_renamed, new ExtWrapNullable(typeof(TreeReference)), pf); labelIsItext = ExtUtil.readBool(in_renamed); copyMode = ExtUtil.readBool(in_renamed); }
//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) { refLevel = ExtUtil.readInt(in_Renamed); instanceName = ((System.String)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(System.String)), pf)); contextType = ExtUtil.readInt(in_Renamed); int size = ExtUtil.readInt(in_Renamed); for (int i = 0; i < size; ++i) { TreeReferenceLevel level = (TreeReferenceLevel)ExtUtil.read(in_Renamed, typeof(TreeReferenceLevel)); this.add(level.intern()); } }
/* === (DE)SERIALIZATION === */ /** * Read the object from stream. */ public void readExternal(System.IO.BinaryReader dis, PrototypeFactory pf) { fallbackDefaultLocale = ExtUtil.readBool(dis); fallbackDefaultForm = ExtUtil.readBool(dis); localeResources = (OrderedHashtable)ExtUtil.read(dis, new ExtWrapMap(typeof(String), new ExtWrapListPoly(), 1), pf);; locales = (ArrayList)ExtUtil.read(dis, new ExtWrapList(typeof(String))); setDefaultLocale((String)ExtUtil.read(dis, new ExtWrapNullable(typeof(String)), pf)); String currentLocale = (String)ExtUtil.read(dis, new ExtWrapNullable(typeof(String)), pf); if (currentLocale != null) { Locale = currentLocale; } }
/** * deserialize a compact instance. note the retrieval of the template data instance */ public void readExternal(BinaryReader in_renamed, PrototypeFactory pf) { int formID = ExtUtil.readInt(in_renamed); instance = getTemplateInstance(formID).clone(); instance.ID = (ExtUtil.readInt(in_renamed)); instance.setDateSaved((DateTime)ExtUtil.read(in_renamed, new ExtWrapNullable(typeof(DateTime)))); //formID, name, schema, versions, and namespaces are all invariants of the template instance TreeElement root = instance.getRoot(); readTreeElement(root, in_renamed, pf); }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { init_context = ExtUtil.readInt(in_); if (init_context == INIT_CONTEXT_EXPR) { filtExpr = (XPathFilterExpr)ExtUtil.read(in_, typeof(XPathFilterExpr), pf); } ArrayList v = (ArrayList)ExtUtil.read(in_, new ExtWrapList(typeof(XPathStep)), pf); steps = new XPathStep[v.Count]; for (int i = 0; i < steps.Length; i++) { steps[i] = (XPathStep)v[i]; } }
public override void readExternal(BinaryReader in_Renamed, PrototypeFactory pf) { byte flag = in_Renamed.ReadByte(); if (flag == 0x00) { val = null; } else { Type answerType = classForDataType(dataType); if (answerType == null) { //custom data types val = ExtUtil.read(in_Renamed, new ExtWrapTagged(), pf); } else if (answerType == typeof(SelectOneData)) { val = instance.getSelectOne(ExtUtil.read(in_Renamed, org.javarosa.core.model.instance.utils.CompactInstanceWrapper.CHOICE_MODE == org.javarosa.core.model.instance.utils.CompactInstanceWrapper.CHOICE_VALUE ? typeof(System.String) : typeof(System.Int32))); } else if (answerType == typeof(SelectMultiData)) { val = instance.getSelectMulti((System.Collections.ArrayList)ExtUtil.read(in_Renamed, new ExtWrapList(org.javarosa.core.model.instance.utils.CompactInstanceWrapper.CHOICE_MODE == org.javarosa.core.model.instance.utils.CompactInstanceWrapper.CHOICE_VALUE ? typeof(System.String) : typeof(System.Int32)))); } else { switch (flag) { case 0x40: answerType = typeof(StringData); break; case 0x41: answerType = typeof(IntegerData); break; case 0x42: answerType = typeof(DecimalData); break; case 0x43: answerType = typeof(DateData); break; case 0x44: answerType = typeof(BooleanData); break; } val = (IAnswerData)ExtUtil.read(in_Renamed, answerType); } } }
/* * (non-Javadoc) * @see org.javarosa.core.util.Externalizable#readExternal(java.io.DataInputStream) */ public void readExternal(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); choices = ExtUtil.nullIfEmpty((List <SelectChoice>)ExtUtil.read(dis, new ExtWrapList(typeof(SelectChoice)), pf)); for (int i = 0; i < NumChoices; i++) { ((SelectChoice)choices[i]).Index = i; } DynamicChoices = (ItemsetBinding)ExtUtil.read(dis, new ExtWrapNullable(typeof(ItemsetBinding))); }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { axis = ExtUtil.readInt(in_); test = ExtUtil.readInt(in_); switch (test) { case TEST_NAME: name = (XPathQName)ExtUtil.read(in_, typeof(XPathQName)); break; case TEST_NAMESPACE_WILDCARD: namespace_ = ExtUtil.readString(in_); break; case TEST_TYPE_PROCESSING_INSTRUCTION: literal = (String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String))); break; } ArrayList v = (ArrayList)ExtUtil.read(in_, new ExtWrapListPoly(), pf); predicates = new XPathExpression[v.Count]; for (int i = 0; i < predicates.Length; i++) { predicates[i] = (XPathExpression)v[i]; } }
/** Reads a group definition object from the supplied stream. */ public void readExternal(BinaryReader dis, PrototypeFactory pf) { ID = ExtUtil.readInt(dis); setAppearanceAttr((String)ExtUtil.read(dis, new ExtWrapNullable(typeof(String)), pf)); Bind = (IDataReference)ExtUtil.read(dis, new ExtWrapTagged(), pf); TextID = (String)ExtUtil.read(dis, new ExtWrapNullable(typeof(String)), pf); LabelInnerText = ((String)ExtUtil.read(dis, new ExtWrapNullable(typeof(String)), pf)); Repeat = (ExtUtil.readBool(dis)); Children = (List <IFormElement>)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)); }
/** * recursively read in a node of the instance, by filling out the template instance * @param e * @param ref * @param in * @param pf * @throws IOException * @throws DeserializationException */ private void readTreeElement(TreeElement e, BinaryReader in_, PrototypeFactory pf) { TreeElement templ = instance.getTemplatePath(e.getRef()); Boolean isGroup = !templ.isLeaf(); if (isGroup) { ArrayList childTypes = new ArrayList(); for (int i = 0; i < templ.getNumChildren(); i++) { String childName = templ.getChildAt(i).getName(); if (!childTypes.Contains(childName)) { childTypes.Add(childName); } } for (int i = 0; i < childTypes.Count; i++) { String childName = (String)childTypes[i]; TreeReference childTemplRef = e.getRef().extendRef(childName, 0); TreeElement childTempl = instance.getTemplatePath(childTemplRef); Boolean repeatable = childTempl.repeatable; int n = ExtUtil.readInt(in_); Boolean 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.getRef().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) { throw new DeserializationException("Null Reference while attempting to deserialize! " + ire.Message); } else { 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_, pf); } } else { TreeElement child = e.getChild(childName, 0); child.setRelevant(relevant); if (relevant) { readTreeElement(child, in_, pf); } } } } else { e.setValue((IAnswerData)ExtUtil.read(in_, new ExtWrapAnswerData(e.dataType))); } }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { constraint = (IConditionExpr)ExtUtil.read(in_, new ExtWrapTagged(), pf); constraintMsg = ExtUtil.nullIfEmpty(ExtUtil.readString(in_)); attemptConstraintCompile(); }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { id = (XPathQName)ExtUtil.read(in_, typeof(XPathQName)); }
public void readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf) { localeData = (OrderedHashtable)ExtUtil.read(in_Renamed, new ExtWrapMap(typeof(String), typeof(String), 1), pf); }
/* (non-Javadoc) * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream) */ public void readExternal(BinaryReader in_, PrototypeFactory pf) { nodeset = ExtUtil.nullIfEmpty(ExtUtil.readString(in_)); ref_ = (TreeReference)ExtUtil.read(in_, typeof(TreeReference), pf); }
public void readExternal(BinaryReader in_Renamed, PrototypeFactory pf) { refLevel = ExtUtil.readInt(in_Renamed); names = (ArrayList)ExtUtil.read(in_Renamed, new ExtWrapList(typeof(String)), pf); multiplicity = (ArrayList)ExtUtil.read(in_Renamed, new ExtWrapList(typeof(int)), pf); }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { data = (IDataPointer)ExtUtil.read(in_, new ExtWrapTagged()); }
public void readExternal(BinaryReader in_Renamed, PrototypeFactory pf) { namespace_ = (String)ExtUtil.read(in_Renamed, new ExtWrapNullable(typeof(String))); name = ExtUtil.readString(in_Renamed); }
/* (non-Javadoc) * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream) */ public void readExternal(BinaryReader in_, PrototypeFactory pf) { s = (Selection)ExtUtil.read(in_, typeof(Selection), pf); }
public void readExternal(BinaryReader in_, PrototypeFactory pf) { a = (XPathExpression)ExtUtil.read(in_, new ExtWrapTagged(), pf); b = (XPathExpression)ExtUtil.read(in_, new ExtWrapTagged(), pf); }
/* (non-Javadoc) * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream) */ public void readExternal(BinaryReader in_, PrototypeFactory pf) { vs = (List <Selection>)ExtUtil.read(in_, new ExtWrapList(typeof(Selection)), pf); }
/* ==== SERIALIZATION ==== */ /* * TODO: * * this new serialization scheme is kind of lame. ideally, we shouldn't have * to sub-class TreeElement at all; we should have an API that can * seamlessly represent complex data model objects (like weight history or * immunizations) as if they were explicity XML subtrees underneath the * parent TreeElement * * failing that, we should wrap this scheme in an ExternalizableWrapper */ /* * (non-Javadoc) * * @see * org.javarosa.core.services.storage.utilities.Externalizable#readExternal * (java.io.DataInputStream) */ public void readExternal(BinaryReader in_renamed, PrototypeFactory pf) { name = ExtUtil.nullIfEmpty(ExtUtil.readString(in_renamed)); multiplicity = ExtUtil.readInt(in_renamed); repeatable = ExtUtil.readBool(in_renamed); value = (IAnswerData)ExtUtil.read(in_renamed, new ExtWrapNullable(new ExtWrapTagged()), pf); // children = ExtUtil.nullIfEmpty((Vector)ExtUtil.read(in, new // ExtWrapList(TreeElement.class), pf)); // Jan 22, 2009 - [email protected] // old line: children = ExtUtil.nullIfEmpty((Vector)ExtUtil.read(in, new // ExtWrapList(TreeElement.class), pf)); // New Child deserialization // 1. read null status as boolean // 2. read number of children // 3. for i < number of children // 3.1 if read boolean true , then create TreeElement and deserialize // directly. // 3.2 if read boolean false then create tagged element and deserialize // child if (!ExtUtil.readBool(in_renamed)) { // 1. children = null; } else { children = new ArrayList(); // 2. int numChildren = (int)ExtUtil.readNumeric(in_renamed); // 3. for (int i = 0; i < numChildren; ++i) { Boolean normal = ExtUtil.readBool(in_renamed); TreeElement child; if (normal) { // 3.1 child = new TreeElement(); child.readExternal(in_renamed, pf); } else { // 3.2 child = (TreeElement)ExtUtil.read(in_renamed, new ExtWrapTagged(), pf); } child.setParent(this); children.Add(child); } } // end Jan 22, 2009 dataType = ExtUtil.readInt(in_renamed); relevant = ExtUtil.readBool(in_renamed); required = ExtUtil.readBool(in_renamed); enabled = ExtUtil.readBool(in_renamed); relevantInherited = ExtUtil.readBool(in_renamed); enabledInherited = ExtUtil.readBool(in_renamed); constraint = (Constraint)ExtUtil.read(in_renamed, new ExtWrapNullable( typeof(Constraint)), pf); preloadHandler = ExtUtil.nullIfEmpty(ExtUtil.readString(in_renamed)); preloadParams = ExtUtil.nullIfEmpty(ExtUtil.readString(in_renamed)); ArrayList attStrings = ExtUtil.nullIfEmpty((ArrayList)ExtUtil.read(in_renamed, new ExtWrapList(typeof(String)), pf)); setAttributesFromSingleStringVector(attStrings); }