Ejemplo n.º 1
0
 public DsmModel(string processStep, Assembly executingAssembly)
 {
     _metaDataModel      = new MetaDataModel(processStep, executingAssembly);
     _elementsDataModel  = new DsmElementModel();
     _relationsDataModel = new DsmRelationModel(_elementsDataModel);
     _actionsDataModel   = new DsmActionModel();
 }
Ejemplo n.º 2
0
 public TemplateService(string latexContent, StatisticModel statisticModel, MetaDataModel metaDataModel, string templateName)
 {
     _latexContent   = latexContent;
     _statisticModel = statisticModel;
     _metaDataModel  = metaDataModel;
     _templateName   = templateName;
 }
Ejemplo n.º 3
0
        private MetaDataModel MapToModel(MetaData entity, string requestId = "")
        {
            // Perform mapping
            var model = new MetaDataModel();

            model.Id          = entity.Id ?? String.Empty;
            model.DisplayName = entity.DisplayName ?? String.Empty;
            model.Screen      = entity.Screen ?? String.Empty;
            model.FieldType   = entity.FieldType ?? FieldType.None;
            model.Required    = entity.Required;
            model.UniqueId    = entity.UniqueId;
            if (model.FieldType == FieldType.DropDown)
            {
                model.Values = new List <DropDownMetaDataValue>();
                foreach (DropDownMetaDataValue metaValue in entity.Values)
                {
                    model.Values.Add(metaValue);
                }
            }
            else
            {
                model.Values = entity.Values ?? String.Empty;
            }
            return(model);
        }
Ejemplo n.º 4
0
        public void Given_MetaDataIsPresent_When_ModelIsCleared_Then_OnlyDefaultGroupAndItemsArePresent()
        {
            string        defaultGroupName = "DefaultGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());

            string groupName = "ImportedGroupName";
            string name1     = "SomeItemName1";
            string value1    = "SomeItemValue2";

            model.AddMetaDataItem(groupName, name1, value1);
            string name2  = "SomeItemName";
            string value2 = "SomeItemValue1";

            model.AddMetaDataItem(groupName, name2, value2);

            List <string> groupsBefore = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(2, groupsBefore.Count);

            model.Clear();

            List <string> groupsAfter = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(1, groupsAfter.Count);

            List <IMetaDataItem> items = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList();

            Assert.AreEqual(1, items.Count);
            Assert.IsTrue(items[0].Name == "Executable");
            Assert.IsTrue(items[0].Value.Contains("DsmSuite.Common.Model.Test"));
        }
Ejemplo n.º 5
0
        public void GivenItemNameUsedBeforeWhenAddMetaDataItemToDefaultGroupIsCalledThenItemIsUpdated()
        {
            string               defaultGroupName = "DefaultGroupName";
            MetaDataModel        model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());
            List <IMetaDataItem> itemsBefore      = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList();

            Assert.AreEqual(1, itemsBefore.Count);

            string name   = "SomeItemName";
            string value1 = "SomeItemValue1";

            model.AddMetaDataItemToDefaultGroup(name, value1);

            string value2 = "SomeItemValue2";

            model.AddMetaDataItemToDefaultGroup(name, value2);

            List <IMetaDataItem> itemsAfter = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList();

            Assert.AreEqual(2, itemsAfter.Count);
            Assert.AreEqual(itemsBefore[0].Name, itemsAfter[0].Name);
            Assert.AreEqual(itemsBefore[0].Value, itemsAfter[0].Value);
            Assert.AreEqual(name, itemsAfter[1].Name);
            Assert.AreEqual(value2, itemsAfter[1].Value);
        }
Ejemplo n.º 6
0
        public NewMetaHeader(String MHDFPath, OPType opType)
        {
            InitializeComponent();
            tcMetaInfo.TabPages.Remove(tpMISummary);
            this.MHDFPath = MHDFPath;

            if (opType == OPType.Modify)
            {
                //Deserialize XML file
                if (CoreData.CommonData.mdm != null)
                {
                    mdm = CoreData.CommonData.mdm;
                }

                else
                {
                    MetaXMLReader mxReader = new MetaXMLReader();
                    mdm = mxReader.readMetaHeaderFile(MHDFPath);
                }
            }

            else if (opType == OPType.New)
            {
                mdm = new MetaDataModel();
            }
        }
Ejemplo n.º 7
0
        private MetaData MapToEntity(MetaDataModel model, string requestId = "")
        {
            // Perform mapping
            var entity = MetaData.Empty;

            entity.Id          = model.Id ?? String.Empty;
            entity.DisplayName = model.DisplayName ?? String.Empty;
            entity.Screen      = model.Screen ?? String.Empty;
            entity.FieldType   = model.FieldType ?? FieldType.None;
            entity.Required    = model.Required;
            entity.UniqueId    = model.UniqueId;
            if (entity.FieldType.Name == FieldType.DropDown.Name)
            {
                JArray jsonArray = JArray.Parse(model.Values.ToString());
                entity.Values = new List <DropDownMetaDataValue>();
                foreach (var metaValue in jsonArray)
                {
                    if (!string.IsNullOrEmpty(metaValue["name"].ToString()))
                    {
                        entity.Values.Add(new DropDownMetaDataValue {
                            Id = metaValue["id"].ToString(), Name = metaValue["name"].ToString()
                        });
                    }
                }
            }
            else
            {
                entity.Values = model.Values ?? String.Empty;
            }
            return(entity);
        }
Ejemplo n.º 8
0
 public KafkaMessage()
 {
     MetaData = new MetaDataModel()
     {
         MessageType    = MessageTypeEnum.UndefinedMessage,
         MessageCreated = DateTime.Now
     };
 }
Ejemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MetaXMLWriter xmlWriter = new MetaXMLWriter(MHDFPath);
            MetaDataModel mdm       = new MetaDataModel();

            mdm.title           = tbTitle.Text;
            mdm.releaseDate     = tbReleaseDate.Text;
            mdm.director        = tbDirector.Text;
            mdm.writer          = tbWriter.Text;
            mdm.cast            = tbCast.Text;
            mdm.description     = tbDescription.Text;
            mdm.longDescription = tbLongDescription.Text;
            mdm.posterPath      = pbPoster.ImageLocation;
            mdm.mediaType       = cbMediaType.Text;
            mdm.contentRate     = cbContentRating.Text;
            mdm.hd = cbHD.Text;
            mdm.chaptersFilePath = tbChaptersFile.Text;

            foreach (ListViewItem item in lvSubtitles.Items)
            {
                mdm.subtitles.Add(new KeyValuePair <String, String>(item.SubItems[0].Text, item.SubItems[1].Text));
            }

            if (tvsc != null)
            {
                mdm.tvShow     = tvsc.tvShow;
                mdm.tvNetwork  = tvsc.tvNetwork;
                mdm.seasonNum  = tvsc.seasonNum;
                mdm.episodeNum = tvsc.episodeNum;

                if (cbMediaType.Text == "电视剧")
                {
                    mdm.genre  = tvsc.genre;
                    mdm.rating = tvsc.rating;
                }
            }

            if (msc != null)
            {
                if (cbMediaType.Text == "电影")
                {
                    mdm.genre  = msc.genre;
                    mdm.rating = msc.rating;
                }
            }

            xmlWriter.SaveFile(mdm);
            CommonData.mdm = mdm;

            this.Close();
        }
Ejemplo n.º 10
0
 public CategoryModel(
     string name, string title, string imageRelativeUrl, string bannerImageRelativeUrl, bool comingSoon,
     IEnumerable <ProductModel> products, IEnumerable <ContentSectionModel> contentSections,
     MetaDataModel metaData
     )
 {
     Name                   = name;
     Title                  = title;
     ImageRelativeUrl       = imageRelativeUrl;
     ComingSoon             = comingSoon;
     Products               = products;
     ContentSections        = contentSections;
     BannerImageRelativeUrl = bannerImageRelativeUrl;
     MetaData               = metaData;
 }
Ejemplo n.º 11
0
        public async Task <MetaDataModel> AddMetaData(MetaDataModel metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException("metadata");
            }

            var newId = _database.MetaData.Select(x => x.Id).OrderBy(x => x).LastOrDefault() + 1;

            metadata.Id = newId;

            _database.MetaData.Add(metadata);

            return(metadata);
        }
Ejemplo n.º 12
0
        public void When_ModelIsConstructed_Then_OnlyDefaultGroupAndItemsArePresen()
        {
            string        defaultGroupName = "SomeGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());

            List <string> groups = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(1, groups.Count);
            Assert.AreEqual(defaultGroupName, groups[0]);

            List <IMetaDataItem> items = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList();

            Assert.AreEqual(1, items.Count);
            Assert.IsTrue(items[0].Name == "Executable");
            Assert.IsTrue(items[0].Value.Contains("DsmSuite.Common.Model.Test"));
        }
Ejemplo n.º 13
0
 public ProductModel(
     string name, string title, string imageRelativeUrl, string bannerImageRelativeUrl,
     IEnumerable <ContentSectionModel> contentSections, IEnumerable <ImageModel> galleryImages,
     IEnumerable <string> overviewParagraphs, IEnumerable <string> features,
     MetaDataModel metaData
     )
 {
     Name                   = name;
     Title                  = title;
     ImageRelativeUrl       = imageRelativeUrl;
     ContentSections        = contentSections;
     GalleryImages          = galleryImages;
     OverviewParagraphs     = overviewParagraphs;
     Features               = features;
     BannerImageRelativeUrl = bannerImageRelativeUrl;
     MetaData               = metaData;
 }
Ejemplo n.º 14
0
        public void WhenAddMetaDataItemIsCalledThenItemIsAdded()
        {
            string        defaultGroupName = "DefaultGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());

            string groupName = "ImportedGroupName";
            string name      = "SomeItemName";
            string value     = "SomeItemValue1";

            model.AddMetaDataItem(groupName, name, value);

            List <IMetaDataItem> itemsAfter = model.GetExportedMetaDataGroupItems(groupName).ToList();

            Assert.AreEqual(1, itemsAfter.Count);
            Assert.AreEqual(name, itemsAfter[0].Name);
            Assert.AreEqual(value, itemsAfter[0].Value);
        }
Ejemplo n.º 15
0
        public async Task <JObject> CreateItemAsync(MetaDataModel modelObject, string requestId = "")
        {
            _logger.LogInformation($"RequestId: {requestId} - MetaData_CreateItemAsync called.");

            Guard.Against.Null(modelObject, nameof(modelObject), requestId);
            try
            {
                var entityObject = MapToEntity(modelObject, requestId);

                return(await _metaDataRepository.CreateItemAsync(entityObject, requestId));
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestId: {requestId} - MetaData_CreateItemAsync Service Exception: {ex}");
                throw new ResponseException($"RequestId: {requestId} - MetaData_CreateItemAsync Service Exception: {ex}");
            }
        }
Ejemplo n.º 16
0
        public void WhenAddMetaDataItemIsCalledThenGroupIsAdded()
        {
            string        defaultGroupName = "DefaultGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());
            List <string> groupsBefore     = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(1, groupsBefore.Count);

            string groupName = "ImportedGroupName";
            string name      = "SomeItemName";
            string value     = "SomeItemValue1";

            model.AddMetaDataItem(groupName, name, value);

            List <string> groupsAfter = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(2, groupsAfter.Count);
            Assert.AreEqual(groupsBefore[0], groupsAfter[0]);
            Assert.AreEqual(groupName, groupsAfter[1]);
        }
Ejemplo n.º 17
0
        public ActionResult MetaData(MetaDataModel model)
        {
            SessionModelCollector sessionModel = this.GetFromSession <SessionModelCollector>("ProjectInfo");

            if (sessionModel == null) //if the sessionmodel is not exists
            {
                sessionModel = new SessionModelCollector
                {
                    MetaData  = model,
                    SessionId = this.SessionId()
                };
            }
            else //if exists just update (so the user edited the metadata)
            {
                sessionModel.MetaData = model;
            }

            this.AddToSession("ProjectInfo", sessionModel); //add metadata to the session
            return(RedirectToAction("AuthorList"));
        }
Ejemplo n.º 18
0
        public void WhenAddMetaDataItemIsCalledTwiceThenTwoItemIAreAddedAndOrderIsMaintained()
        {
            string        defaultGroupName = "DefaultGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());

            string groupName = "ImportedGroupName";
            string name1     = "SomeItemName1";
            string value1    = "SomeItemValue2";

            model.AddMetaDataItem(groupName, name1, value1);
            string name2  = "SomeItemName";
            string value2 = "SomeItemValue1";

            model.AddMetaDataItem(groupName, name2, value2);

            List <IMetaDataItem> itemsAfter = model.GetExportedMetaDataGroupItems(groupName).ToList();

            Assert.AreEqual(2, itemsAfter.Count);
            Assert.AreEqual(name1, itemsAfter[0].Name);
            Assert.AreEqual(value1, itemsAfter[0].Value);
            Assert.AreEqual(name2, itemsAfter[1].Name);
            Assert.AreEqual(value2, itemsAfter[1].Value);
        }
Ejemplo n.º 19
0
        public async Task <StatusCodes> UpdateItemAsync(MetaDataModel modelObject, string requestId = "")
        {
            _logger.LogInformation($"RequestId: {requestId} - MetaData_UpdateItemAsync called.");

            Guard.Against.Null(modelObject, nameof(modelObject), requestId);
            Guard.Against.NullOrEmpty(modelObject.Id, nameof(modelObject.Id), requestId);

            try
            {
                var entityObject = MapToEntity(modelObject, requestId);

                var result = await _metaDataRepository.UpdateItemAsync(entityObject, requestId);

                Guard.Against.NotStatus200OK(result, "MetaData_UpdateItemAsync", requestId);

                return(result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestId: {requestId} - MetaData_UpdateItemAsync Service Exception: {ex}");
                throw new ResponseException($"RequestId: {requestId} - MetaDatapdateItemAsync Service Exception: {ex}");
            }
        }
Ejemplo n.º 20
0
 public PageModel(string mainHeading, MetaDataModel metaData)
 {
     MainHeading = mainHeading;
     MetaData    = metaData;
 }
Ejemplo n.º 21
0
 public HomePageModel(
     string mainHeading, IEnumerable <HomeBannerModel> banners, IEnumerable <CategoryTileModel> categoryTiles, MetaDataModel metaData
     ) :
     base(mainHeading, metaData)
 {
     Banners       = banners;
     CategoryTiles = categoryTiles;
 }
Ejemplo n.º 22
0
 public FexVersionService(MetaDataModel metaDataModel, string folder, string filenamePrefix)
 {
     _metaDataModel  = metaDataModel;
     _folder         = folder;
     _filenamePrefix = filenamePrefix;
 }
Ejemplo n.º 23
0
        public async Task <IActionResult> Post(MetaDataModel metadata)
        {
            var newMovie = await _movieService.AddMetaData(metadata);

            return(CreatedAtRoute("GetMovieMetadata", new { movieId = newMovie.MovieId.Value }, newMovie));
        }
Ejemplo n.º 24
0
 public GenerationService(StatisticModel statisticModel, MetaDataModel metaDataModel, List <Section> content)
 {
     _statisticModel = statisticModel;
     _metaDataModel  = metaDataModel;
     _content        = content;
 }