Exemplo n.º 1
0
 protected internal InheritedContentTypeProperty(InheritedContentTypePropertyDto inheritedContentTypePropertyDto, IContentTypeProperty parentProperty, ContentType contentType)
     : base(parentProperty.Id, contentType, inheritedContentTypePropertyDto.Metadata)
 {
     _parentProperty = parentProperty;
 }
Exemplo n.º 2
0
        //TODO: Convertir cette méthode en ContentTranslationVersionJsonConverter (aurait l'avantage de pourvoir etre réutilisé) ?
        private Content.ContentTranslationVersion GetContentTranslationVersion(JToken serializedVersion, ContentType contentType)
        {
            var jsonObject = JObject.Load(serializedVersion.CreateReader());

            Guid?    id = null;
            var      propertyDictionary      = new Dictionary <string, Guid>();
            DateTime?creationDate            = null;
            string   cultureName             = null;
            DateTime?publicationCreationDate = null;
            DateTime?publicationStartingDate = null;
            DateTime?publicationEndingDate   = null;
            var      properties = new Dictionary <string, string>();

            foreach (var contentTranslationVersionSerializedProperty in jsonObject.Properties())
            {
                switch (contentTranslationVersionSerializedProperty.Name)
                {
                case "Id":
                    id = contentTranslationVersionSerializedProperty.Value.ToObject <Guid>();
                    break;

                case "PropertyDictionary":
                    var jsonPropertyDictionaryObject = JObject.Load(contentTranslationVersionSerializedProperty.Value.CreateReader());

                    foreach (var property in jsonPropertyDictionaryObject.Properties())
                    {
                        propertyDictionary.Add(property.Name, property.Value.ToObject <Guid>());
                    }
                    break;

                case "CreationDate":
                    creationDate = contentTranslationVersionSerializedProperty.Value.ToObject <DateTime>();
                    break;

                case "CultureName":
                    cultureName = contentTranslationVersionSerializedProperty.Value.ToObject <string>();
                    break;

                case "PublicationCreationDate":
                    publicationCreationDate = contentTranslationVersionSerializedProperty.Value.ToObject <DateTime?>();
                    break;

                case "PublicationStartingDate":
                    publicationStartingDate = contentTranslationVersionSerializedProperty.Value.ToObject <DateTime?>();
                    break;

                case "PublicationEndingDate":
                    publicationEndingDate = contentTranslationVersionSerializedProperty.Value.ToObject <DateTime?>();
                    break;

                case "ContentType":
                    break;

                case "ContentTypeId":
                    break;

                case "ModuleId":
                    break;

                default:
                    //Pas de deserialisation pour les sous objets (Content)... il sont deserialisés a la demande (GetValue<T> - T étant un Content) comme toutes autres propriétés du contenu
                    var serializedValue = contentTranslationVersionSerializedProperty.ToString().ReplaceFirst("\"" + contentTranslationVersionSerializedProperty.Name + "\": ", "");
                    properties.Add(contentTranslationVersionSerializedProperty.Name, serializedValue);
                    break;
                }
            }

            var contentTranslationVersionProperties = properties.Select(property => new ContentTranslationVersionProperty(new DenormalizedContentTypePropertyReference(propertyDictionary[property.Key], property.Key), property.Value)).ToList();

            return(new Content.ContentTranslationVersion(id.Value, creationDate.Value, publicationCreationDate.HasValue ?
                                                         new Publication(publicationStartingDate, publicationEndingDate, publicationCreationDate) :
                                                         null, contentType, new CultureInfo(cultureName), contentTranslationVersionProperties));
        }
Exemplo n.º 3
0
 protected internal InheritedContentTypeProperty(IContentTypeProperty parentProperty, ContentType contentType)
     : base(parentProperty.Id, contentType)
 {
     _parentProperty = parentProperty;
 }