コード例 #1
0
ファイル: FormInstance.cs プロジェクト: ryanbehr/csrosa
        // TODO: include whether form was sent already (or restrict always to unsent
        // forms)

        public FormInstance exportData()
        {
            FormInstance dm = RestoreUtils.createDataModel(this);

            RestoreUtils.addData(dm, "name", name);
            RestoreUtils.addData(dm, "form-id", (int)(formId));
            RestoreUtils.addData(dm, "saved-on", dateSaved,
                                 Constants.DATATYPE_DATE_TIME);
            RestoreUtils.addData(dm, "schema", schema);

            /////////////
            throw new SystemException("FormInstance.exportData(): must be updated to use new transport layer");
            //		ITransportManager tm = TransportManager._();
            //		boolean sent = (tm.getModelDeliveryStatus(id, true) == TransportMessage.STATUS_DELIVERED);
            //		RestoreUtils.addData(dm, "sent", new Boolean(sent));
            /////////////

            //		for (Enumeration e = namespaces.keys(); e.hasMoreElements(); ) {
            //			String key = (String)e.nextElement();
            //			RestoreUtils.addData(dm, "namespace/" + key, namespaces.get(key));
            //		}
            //
            //		RestoreUtils.mergeDataModel(dm, this, "data");
            //		return dm;
        }
コード例 #2
0
ファイル: FormInstance.cs プロジェクト: ryanbehr/csrosa
 public void templateData(FormInstance dm, TreeReference parentRef)
 {
     RestoreUtils.applyDataType(dm, "name", parentRef, typeof(String));
     RestoreUtils.applyDataType(dm, "form-id", parentRef, typeof(int));
     RestoreUtils.applyDataType(dm, "saved-on", parentRef,
                                Constants.DATATYPE_DATE_TIME);
     RestoreUtils.applyDataType(dm, "schema", parentRef, typeof(String));
     RestoreUtils.applyDataType(dm, "sent", parentRef, typeof(Boolean));
     // don't touch data for now
 }
コード例 #3
0
        private static bool IsAnyBackupFile(string filePath)
        {
            if (RestoreUtils.IsBackupOrSnapshot(filePath))
            {
                return(true);
            }

            var extension = Path.GetExtension(filePath);

            return(InProgressExtension.Equals(extension, StringComparison.OrdinalIgnoreCase));
        }
コード例 #4
0
ファイル: FormInstance.cs プロジェクト: ryanbehr/csrosa
        public void importData(FormInstance dm)
        {
            name      = (String)RestoreUtils.getValue("name", dm);
            formId    = ((int)RestoreUtils.getValue("form-id", dm));
            dateSaved = (DateTime)RestoreUtils.getValue("saved-on", dm);
            schema    = (String)RestoreUtils.getValue("schema", dm);

            Boolean sent = RestoreUtils.getBoolean(RestoreUtils
                                                   .getValue("sent", dm));

            TreeElement names = dm.resolveReference(RestoreUtils.absRef("namespace", dm));

            if (names != null)
            {
                for (int i = 0; i < names.getNumChildren(); i++)
                {
                    TreeElement child = names.getChildAt(i);
                    String      name_ = child.getName();
                    Object      value = RestoreUtils.getValue("namespace/" + name_, dm);
                    if (value != null)
                    {
                        namespaces.Add(name_, value);
                    }
                }
            }

            /////////////
            throw new SystemException("FormInstance.importData(): must be updated to use new transport layer");
            //		if (sent) {
            //			ITransportManager tm = TransportManager._();
            //			tm.markSent(id, false);
            //		}
            /////////////

            //		IStorageUtility forms = StorageManager.getStorage(FormDef.STORAGE_KEY);
            //		FormDef f = (FormDef)forms.read(formId);
            //		setRoot(processSavedDataModel(dm.resolveReference(RestoreUtils.absRef("data", dm)), f.getDataModel(), f));
        }