Esempio n. 1
0
 protected internal override void serialize(MappingSerializer serializer)
 {
     foreach (string extension in _outerInstance.extensions.extensionNames())
     {
         serializer.PutRelativeUri(extension, "ext/" + extension);
     }
 }
Esempio n. 2
0
            protected internal override void serialize(MappingSerializer serializer)
            {
                List <Representation> maps = new List <Representation>();

                maps.Add(new MappingRepresentationAnonymousInnerClass7(this, serializer));
                serializer.PutList("foo", new ServerListRepresentation(RepresentationType.MAP, maps));
            }
Esempio n. 3
0
 protected internal override void serialize(MappingSerializer serializer)
 {
     foreach (KeyValuePair <string, string> entry in _outerInstance.services.SetOfKeyValuePairs())
     {
         serializer.PutString(entry.Key, entry.Value);
     }
 }
 public override void SetUp()
 {
     base.SetUp();
     _enumSerializerFactoryStub            = MockRepository.GenerateStub <Func <RdbmsProviderDefinition, IEnumSerializer> >();
     _storageProviderSerializerFactoryStub =
         MockRepository.GenerateStub <Func <RdbmsProviderDefinition, IEnumSerializer, IStorageProviderSerializer> >();
     _mappingSerializer = new MappingSerializer(_enumSerializerFactoryStub, _storageProviderSerializerFactoryStub);
 }
Esempio n. 5
0
            internal virtual void PutTo(MappingSerializer serializer, ObjectRepresentation @object, string key)
            {
                object value = Get(@object);

                if (value != null)
                {
                    (( Representation )value).PutTo(serializer, key);
                }
            }
        protected virtual void ExportMapping()
        {
            var mappingSerializer = new MappingSerializer(
                pd => pd.Factory.CreateEnumSerializer(),
                (pd, enumSerializer) => pd.Factory.CreateStorageProviderSerializer(enumSerializer));

            var xml = mappingSerializer.Serialize(MappingConfiguration.Current.GetTypeDefinitions());

            xml.Save(_rdbmsToolsParameters.MappingExportOutputFileName);
        }
Esempio n. 7
0
            protected internal override void serialize(MappingSerializer resourceSerializer)
            {
                foreach (KeyValuePair <string, string> entry in _outerInstance.uris.SetOfKeyValuePairs())
                {
                    resourceSerializer.PutRelativeUri(entry.Key, entry.Value);
                }

                foreach (KeyValuePair <string, string> entry in _outerInstance.templates.SetOfKeyValuePairs())
                {
                    resourceSerializer.PutRelativeUriTemplate(entry.Key, entry.Value);
                }
            }
Esempio n. 8
0
        public void Serialize()
        {
            var sqlStorageObjectFactory = new SqlStorageObjectFactory();
            var mappingSerializer       =
                new MappingSerializer(
                    d => sqlStorageObjectFactory.CreateEnumSerializer(),
                    (d, enumSerializer) => sqlStorageObjectFactory.CreateStorageProviderSerializer(enumSerializer));

            var actual   = mappingSerializer.Serialize(MappingConfiguration.Current.GetTypeDefinitions());
            var expected = XDocument.Load(new MemoryStream(ResourceManager.GetMappingExportOutput()));

            Assert.That(actual.ToString(), Is.EqualTo(expected.ToString()));
        }
Esempio n. 9
0
        public void Serialize_OutputIsValid()
        {
            var sqlStorageObjectFactory = new SqlStorageObjectFactory();
            var mappingSerializer       =
                new MappingSerializer(
                    d => sqlStorageObjectFactory.CreateEnumSerializer(),
                    (d, enumSerializer) => sqlStorageObjectFactory.CreateStorageProviderSerializer(enumSerializer));

            var actual = mappingSerializer.Serialize(MappingConfiguration.Current.GetTypeDefinitions());

            var schemaSet = new XmlSchemaSet();

            schemaSet.Add(XmlSchema.Read(new MemoryStream(ResourceManager.GetRdbmsMappingSchema()), null));
            actual.Validate(schemaSet, null);
        }
Esempio n. 10
0
 protected void ConfirmButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (ValidateInput())
         {
             Mapping           mapping    = CreateMappingFromInput();
             MappingSerializer serializer = new MappingSerializer();
             MappingHiddenField.Value = serializer.SerializeMapping(mapping);
             MappingControl.Mapping   = mapping;
             string    parametersIdentifier = QueryHelper.GetString("pid", null);
             Hashtable parameters           = WindowHelper.GetItem(parametersIdentifier) as Hashtable;
             parameters["Mapping"] = MappingHiddenField.Value;
             WindowHelper.Add(parametersIdentifier, parameters);
         }
     }
     catch (Exception exception)
     {
         HandleError(exception);
     }
 }
Esempio n. 11
0
    private void RestoreParameters()
    {
        // Validate parameters
        if (!QueryHelper.ValidateHash("hash"))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: Invalid query hash.");
        }
        Hashtable parameters = WindowHelper.GetItem(QueryHelper.GetString("pid", null)) as Hashtable;

        if (parameters == null)
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are missing, the session might have been lost.");
        }

        // Restore parameters
        mEntityModelName = ValidationHelper.GetString(parameters["EntityModelName"], null);
        mSourceMappingHiddenFieldClientId = ValidationHelper.GetString(parameters["MappingHiddenFieldClientId"], null);
        mSourceMappingPanelClientId       = ValidationHelper.GetString(parameters["MappingPanelClientId"], null);

        // Restore mapping
        string content = ValidationHelper.GetString(parameters["Mapping"], null);

        if (String.IsNullOrEmpty(content))
        {
            mSourceMapping = new Mapping();
        }
        else
        {
            MappingSerializer serializer = new MappingSerializer();
            mSourceMapping = serializer.DeserializeMapping(content);
        }

        // Restore credentials
        content = ValidationHelper.GetString(parameters["Credentials"], null);
        if (String.IsNullOrEmpty(content))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are corrupted.");
        }
        mCredentials = OrganizationCredentials.Deserialize(EncryptionHelper.DecryptData(content).TrimEnd('\0'));
    }
Esempio n. 12
0
 private void InitializeControls()
 {
     try
     {
         string content = Value as string;
         if (!String.IsNullOrEmpty(content))
         {
             MappingSerializer serializer = new MappingSerializer();
             Mapping           mapping    = serializer.DeserializeMapping(content);
             MappingControl.Mapping = mapping;
             MappingControl.Enabled = Enabled;
         }
         if (Enabled)
         {
             string credentials = GetCredentials();
             if (!String.IsNullOrEmpty(credentials))
             {
                 InitializeEditButton();
             }
             else
             {
                 MessageLabel.InnerHtml = GetString("sf.credentialsrequiredformapping");
                 MessageLabel.Attributes.Add("class", "Red");
                 MessageLabel.Visible      = true;
                 EditMappingButton.Visible = false;
             }
         }
         else
         {
             EditMappingButton.Visible = false;
         }
     }
     catch (Exception exception)
     {
         HandleError(exception);
     }
 }
Esempio n. 13
0
 internal abstract void PutTo(MappingSerializer serializer, string key);
Esempio n. 14
0
 internal override void putTo(MappingSerializer serializer, string key)
 {
 }
Esempio n. 15
0
 public override void Serialize(MappingSerializer serializer)
 {
     serializer.PutMapping("resources", new MappingRepresentationAnonymousInnerClass(this));
 }
Esempio n. 16
0
 protected internal abstract void Serialize(MappingSerializer serializer);
Esempio n. 17
0
 internal override void PutTo(MappingSerializer serializer, string key)
 {
     serializer.PutMapping(key, this);
 }
Esempio n. 18
0
 protected internal override void serialize(MappingSerializer serializer)
 {
 }
Esempio n. 19
0
 public MappingRepresentationAnonymousInnerClass7(MappingRepresentationAnonymousInnerClass6 outerInstance, MappingSerializer serializer) : base("map")
 {
     this.outerInstance = outerInstance;
     this._serializer   = serializer;
 }
Esempio n. 20
0
        protected internal override void Serialize(MappingSerializer serializer)
        {
            MappingRepresentation apa = new MappingRepresentationAnonymousInnerClass(this, serializer);

            serializer.PutMapping("services", apa);
        }
    private void RestoreParameters()
    {
        // Validate parameters
        if (!QueryHelper.ValidateHash("hash"))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: Invalid query hash.");
        }
        Hashtable parameters = WindowHelper.GetItem(QueryHelper.GetString("pid", null)) as Hashtable;
        if (parameters == null)
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are missing, the session might have been lost.");
        }

        // Restore parameters
        mEntityModelName = ValidationHelper.GetString(parameters["EntityModelName"], null);
        mSourceMappingHiddenFieldClientId = ValidationHelper.GetString(parameters["MappingHiddenFieldClientId"], null);
        mSourceMappingPanelClientId = ValidationHelper.GetString(parameters["MappingPanelClientId"], null);

        // Restore mapping
        string content = ValidationHelper.GetString(parameters["Mapping"], null);
        if (String.IsNullOrEmpty(content))
        {
            mSourceMapping = new Mapping();
        }
        else
        {
            MappingSerializer serializer = new MappingSerializer();
            mSourceMapping = serializer.DeserializeMapping(content);
        }

        // Restore credentials
        content = ValidationHelper.GetString(parameters["Credentials"], null);
        if (String.IsNullOrEmpty(content))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are corrupted.");
        }
        mCredentials = OrganizationCredentials.Deserialize(EncryptionHelper.DecryptData(content).TrimEnd('\0'));
    }
 protected void ConfirmButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (ValidateInput())
         {
             Mapping mapping = CreateMappingFromInput();
             MappingSerializer serializer = new MappingSerializer();
             MappingHiddenField.Value = serializer.SerializeMapping(mapping);
             MappingControl.Mapping = mapping;
             string parametersIdentifier = QueryHelper.GetString("pid", null);
             Hashtable parameters = WindowHelper.GetItem(parametersIdentifier) as Hashtable;
             parameters["Mapping"] = MappingHiddenField.Value;
             WindowHelper.Add(parametersIdentifier, parameters);
         }
     }
     catch (Exception exception)
     {
         HandleError(exception);
     }
 }
Esempio n. 23
0
 protected internal override void serialize(MappingSerializer serializer)
 {
     serializer.PutString("key", "expected string");
 }
Esempio n. 24
0
 public override void Serialize(MappingSerializer serializer)
 {
     base.Serialize(serializer);
     serializer.PutList("engines", ListRepresentation.@string(_engines));
 }
Esempio n. 25
0
 protected internal override void serialize(MappingSerializer serializer)
 {
     serializer.PutMapping("nested", new MappingRepresentationAnonymousInnerClass5(this));
 }
Esempio n. 26
0
 protected internal override void serialize(MappingSerializer serializer)
 {
     serializer.PutRelativeUri("URL", "subpath");
 }
 private void InitializeControls()
 {
     try
     {
         string content = Value as string;
         if (!String.IsNullOrEmpty(content))
         {
             MappingSerializer serializer = new MappingSerializer();
             Mapping mapping = serializer.DeserializeMapping(content);
             MappingControl.Mapping = mapping;
             MappingControl.Enabled = Enabled;
         }
         if (Enabled)
         {
             string credentials = GetCredentials();
             if (!String.IsNullOrEmpty(credentials))
             {
                 InitializeEditButton();
             }
             else
             {
                 MessageLabel.InnerHtml = GetString("sf.credentialsrequiredformapping");
                 MessageLabel.Attributes.Add("class", "Red");
                 MessageLabel.Visible = true;
                 EditMappingButton.Visible = false;
             }
         }
         else
         {
             EditMappingButton.Visible = false;
         }
     }
     catch (Exception exception)
     {
         HandleError(exception);
     }
 }
Esempio n. 28
0
 protected internal override void serialize(MappingSerializer serializer)
 {
     serializer.PutString("foo", "bar");
 }
Esempio n. 29
0
 public MappingRepresentationAnonymousInnerClass(ServerRootRepresentation outerInstance, MappingSerializer serializer) : base("services")
 {
     this.outerInstance = outerInstance;
     this._serializer   = serializer;
 }
Esempio n. 30
0
 protected internal override void serialize(MappingSerializer nested)
 {
     nested.PutString("data", "expected data");
 }
Esempio n. 31
0
 internal override void ExtraData(MappingSerializer serializer)
 {
     @delegate.extraData(serializer);
 }