// TODO E' possibile semplificare e irrobustire questo codice? // TODO Potrebero esserci problemi di cache e dipendenze? Da ottimizzare in qualche modo? public override PageDefinition Parse(string resourceLocation) { var result = new PageDefinition(); var action = new PageAction("GET"); var moduleDefinitionList = new ModuleDefinitionList(); var pageParameters = new PageParameterList(); var viewComponentDefinition = _viewCatalog.Get(typeof(XsltView).Name); if (viewComponentDefinition == null) throw new XrcException(string.Format("View '{0}' not found on catalog.", typeof(XsltView).Name)); var view = new ViewDefinition(viewComponentDefinition, null); XDocument xsltContent = _resourceProvider.ResourceToXml(resourceLocation); AddProperty(viewComponentDefinition, view, "Xslt", xsltContent); string dataVirtualPath = resourceLocation.Replace(".xrc.xslt", ".xml"); if (_resourceProvider.ResourceExists(dataVirtualPath)) { AddProperty(viewComponentDefinition, view, "Data", _resourceProvider.ResourceToXml(dataVirtualPath)); } action.Views.Add(view); result.Actions.Add(action); return result; }
public override PageDefinition Parse(string resourceLocation) { var result = new PageDefinition(); var action = new PageAction("GET"); var moduleDefinitionList = new ModuleDefinitionList(); var pageParameters = new PageParameterList(); var viewComponentDefinition = _viewCatalog.Get(typeof(XHtmlView).Name); if (viewComponentDefinition == null) throw new XrcException(string.Format("View '{0}' not found on catalog.", typeof(XHtmlView).Name)); var view = new ViewDefinition(viewComponentDefinition, null); string propertyName = "Content"; var viewProperty = viewComponentDefinition.Type.GetProperty(propertyName); if (viewProperty == null) throw new XrcException(string.Format("Property '{0}' for type '{1}' not found.", propertyName, viewComponentDefinition.Type.FullName)); XDocument content = _resourceProvider.ResourceToXml(resourceLocation); var propertyValue = new XValue(viewProperty.PropertyType, content); view.Properties.Add(new XProperty(viewProperty, propertyValue)); action.Views.Add(view); result.Actions.Add(action); return result; }
public CompiledViewDefinitionImpl(ViewDefinition viewDefinition, IPortfolio portfolio, DateTimeOffset latestValidity, DateTimeOffset earliestValidity, Dictionary<string, ICompiledViewCalculationConfiguration> compiledCalculationConfigurations) { _viewDefinition = viewDefinition; _compiledCalculationConfigurations = compiledCalculationConfigurations; _earliestValidity = earliestValidity; _latestValidity = latestValidity; _portfolio = portfolio; }
private static void AddProperty(ComponentDefinition viewComponentDefinition, ViewDefinition view, string propertyName, object propertyValue) { var viewProperty = viewComponentDefinition.Type.GetProperty(propertyName); if (viewProperty == null) throw new XrcException(string.Format("Property '{0}' for type '{1}' not found.", propertyName, viewComponentDefinition.Type.FullName)); var propertyXValue = new XValue(viewProperty.PropertyType, propertyValue); view.Properties.Add(new XProperty(viewProperty, propertyXValue)); }
protected override void OnPageDestroy(int newWindowId) { _currentLevel = handler.CurrentLevel; _currentView = ((MusicViewHandler)handler).GetView(); m_iItemSelected = facadeLayout.SelectedListItemIndex; if (GUIMusicFiles.IsMusicWindow(newWindowId)) { MusicState.StartWindow = newWindowId; } else { MusicState.StartWindow = GetID; } base.OnPageDestroy(newWindowId); }
public ViewLink Make(ViewDefinition definition, Section parentNode) { var viewLink = new ViewLink() { ViewLinkType = ViewLinkType.Default, ParentNode = parentNode }; viewLink.Props = new Dictionary <string, object>() { { "Name", definition.Name }, { "DisplayName", definition.DisplayName } }; viewLink.Events = new List <Event>() { new Event() { EventType = EventType.Click, Virtual = true, Actions = new List <UI.Action>() { new UI.Action() { ActionType = ActionType.OpenSection, Virtual = true, Parameters = new List <Parameter>() { new Parameter() { Virtual = true, ParameterType = ParameterType.FilterId, DefaultValue = definition .Filters .FirstOrDefault(f => f.ViewId == definition.Id)? .Id.ToString() } } } } } }; return(viewLink); }
/// <summary> /// Store the Grid Values in the View /// </summary> private void StoreGridInView() { if (updating) { return; } if (dataGrid.DataSource == null) { return; } if (currentView == null) { return; } settingsChanged = true; ViewDefinition view = currentView; DataTable dt = dataGrid.DataSource as DataTable; view.Filters.Clear(); foreach (DataRow row in dt.Rows) { FilterDefinition def = new FilterDefinition(); def.Where = row[0] as string; if (def.Where == string.Empty) { continue; } def.SqlOperator = row[1].ToString(); def.Restriction = row[2].ToString(); try { def.Limit = Int32.Parse(row[3].ToString()); } catch (Exception) { def.Limit = -1; } def.DefaultView = row[4].ToString(); def.DefaultSort = row[5].ToString(); def.SortAscending = (bool)row[6]; def.SkipLevel = (bool)row[7]; view.Filters.Add(def); } }
public void CanCombineSnapshots() { ViewDefinition vd = Context.ViewProcessor.ViewDefinitionRepository.GetViewDefinition(@"Demo Equity Option Test View"); var snapshotManager = Context.MarketDataSnapshotManager; Tuple <ManageableMarketDataSnapshot, ManageableMarketDataSnapshot> snaps; using (var proc = snapshotManager.CreateFromViewDefinition(vd.Name)) { var snapshot = proc.Snapshot; snaps = Halve(snapshot); snaps.Item1.Name = TestUtils.GetUniqueName(); snaps.Item2.Name = TestUtils.GetUniqueName(); Context.MarketDataSnapshotMaster.Add(new MarketDataSnapshotDocument(null, snaps.Item1)); Context.MarketDataSnapshotMaster.Add(new MarketDataSnapshotDocument(null, snaps.Item2)); } try { var snapOptions = ExecutionOptions.GetSingleCycle(new CombinedMarketDataSpecification(new UserMarketDataSpecification(snaps.Item2.UniqueId), new UserMarketDataSpecification(snaps.Item1.UniqueId))); var withSnapshot = GetFirstResult(snapOptions, vd.Name); var options = ExecutionOptions.SingleCycle; IViewComputationResultModel withoutSnapshot = GetFirstResult(options, vd.Name); var withoutCount = CountResults(withoutSnapshot); var withCount = CountResults(withSnapshot); if (withoutCount != withCount) { var withSpecs = new HashSet <ValueSpecification>(withSnapshot.AllResults.Select(r => r.ComputedValue.Specification)); var withoutSpecs = new HashSet <ValueSpecification>(withoutSnapshot.AllResults.Select(r => r.ComputedValue.Specification)); withoutSpecs.SymmetricExceptWith(withSpecs); Assert.True(false, string.Format("Running snapshot of {0} only had {1}, live had {2}", vd.Name, withCount, withoutCount)); } Assert.Equal(withoutCount, withCount); } finally { Context.MarketDataSnapshotMaster.Remove(snaps.Item1.UniqueId); Context.MarketDataSnapshotMaster.Remove(snaps.Item2.UniqueId); } }
private static IEnumerable <ColumnHeader> GetPrimitiveColumns(ViewDefinition viewDefinition, ICompiledViewDefinition compiledViewDefinition) { var columns = new HashSet <ColumnHeader>(); foreach (var configuration in viewDefinition.CalculationConfigurationsByName) { Dictionary <ValueSpecification, HashSet <ValueRequirement> > specs = compiledViewDefinition.CompiledCalculationConfigurations[configuration.Key].TerminalOutputSpecifications; foreach (var req in configuration.Value.SpecificRequirements.Where(r => r.TargetSpecification.Type == ComputationTargetType.Primitive)) { //TODO less slow if (Satisfies(specs, Tuple.Create(req.ValueName, req.Constraints))) { columns.Add(new ColumnHeader(configuration.Key, req.ValueName, req.Constraints)); } } } return(columns); }
public void ViewResultsMatchDefinition(ViewDefinition viewDefinition) { using (var remoteViewClient = Context.ViewProcessor.CreateClient()) { ICompiledViewDefinition compiledViewDefinition = null; IViewComputationResultModel viewComputationResultModel = null; var resultsReady = new ManualResetEvent(false); var listener = new EventViewResultListener(); listener.ViewDefinitionCompiled += delegate(object sender, ViewDefinitionCompiledArgs e) { compiledViewDefinition = e.CompiledViewDefinition; }; listener.CycleCompleted += delegate(object sender, CycleCompletedArgs e) { viewComputationResultModel = e.FullResult; resultsReady.Set(); }; remoteViewClient.SetResultListener(listener); remoteViewClient.AttachToViewProcess(viewDefinition.UniqueID, ExecutionOptions.RealTime); if (!resultsReady.WaitOne(TimeSpan.FromMinutes(2))) { throw new TimeoutException("Failed to get results for " + viewDefinition.Name + " client " + remoteViewClient.GetUniqueId()); } Assert.NotNull(compiledViewDefinition); foreach (var viewResultEntry in viewComputationResultModel.AllResults) { Assert.NotNull(viewResultEntry.ComputedValue.Value); AssertDefinitionContains(viewDefinition, viewResultEntry); } var countActualValues = viewComputationResultModel.AllResults.Count(); var countMaxExpectedValues = CountMaxExpectedValues(compiledViewDefinition); Console.Out.WriteLine("{0} {1} {2}", viewDefinition.Name, countActualValues, countMaxExpectedValues); Assert.InRange(countActualValues, 1, countMaxExpectedValues); } }
public void CanCreateFromView(ViewDefinition viewDefinition) { var snapshotManager = Context.MarketDataSnapshotManager; using (var proc = snapshotManager.CreateFromViewDefinition(viewDefinition)) { var manageableMarketDataSnapshot = proc.Snapshot; Assert.Null(manageableMarketDataSnapshot.Name); Assert.Null(manageableMarketDataSnapshot.UniqueId); Assert.True(manageableMarketDataSnapshot.Values.Any() || manageableMarketDataSnapshot.YieldCurves.Any(c => c.Value.Values.Values.Any()) || manageableMarketDataSnapshot.VolatilityCubes.Any(v => v.Value.Values.Any())); foreach (var valueSnapshot in manageableMarketDataSnapshot.Values) { foreach (var snapshot in valueSnapshot.Value) { ValueAssertions.AssertSensibleValue(snapshot.Value.MarketValue); Assert.Null(snapshot.Value.OverrideValue); } } if (viewDefinition.Name != "GlobeOp Bond View Implied" /* LAP-38 */ && viewDefinition.Name != "Simple Cash Test View 2" /* LAP-82 */) { Assert.InRange(manageableMarketDataSnapshot.YieldCurves.Count, ExpectedYieldCurves(viewDefinition), int.MaxValue); } if (viewDefinition.Name == "Equity Option Test View 1") { Assert.Equal(2, manageableMarketDataSnapshot.YieldCurves.Count); var yieldCurveSnapshot = manageableMarketDataSnapshot.YieldCurves.First(); Assert.NotNull(yieldCurveSnapshot); Assert.NotEmpty(yieldCurveSnapshot.Value.Values.Values); } foreach (var curve in manageableMarketDataSnapshot.YieldCurves.Values) { AssertSaneValue(curve); Assert.True(curve.Values.Values.Keys.Any(s => !manageableMarketDataSnapshot.GlobalValues.Values.ContainsKey(s))); //LAP-37 } foreach (var cube in manageableMarketDataSnapshot.VolatilityCubes.Values) { Assert.True(cube.Values.Any(v => v.Value.MarketValue == null)); } } }
protected override SnapshotDataStream Build(CancellationToken ct) { _constructedEvent.Wait(ct); ViewDefinition viewDefinition = null; Dictionary <YieldCurveKey, Dictionary <string, ValueRequirement> > specs = null; _liveStream.With(ct, liveDataStream => liveDataStream.WithLastResults(ct, (cycle, results) => { var tempViewName = string.Format("{0}-{1}", typeof(SnapshotDataStream).Name, Guid.NewGuid()); specs = _remoteEngineContext.ViewProcessor.MarketDataSnapshotter.GetYieldCurveRequirements(liveDataStream.RemoteViewClient, cycle); viewDefinition = GetViewDefinition(specs); viewDefinition.Name = tempViewName; var uid = _financialClient.ViewDefinitionRepository. AddViewDefinition(new AddViewDefinitionRequest(viewDefinition)); viewDefinition.UniqueID = uid; })); return(new SnapshotDataStream(viewDefinition, _remoteEngineContext, _snapshotId.ToLatest(), specs)); }
public void QueryOnView() { var client = BigQueryClient.Create(_fixture.ProjectId); var table = client.GetTable(_fixture.DatasetId, _fixture.HighScoreTableId); var viewDefinition = new ViewDefinition { Query = $"SELECT player, MAX(score) AS score FROM {table} WHERE player IS NOT NULL GROUP BY player ORDER BY 2 DESC", UseLegacySql = false }; var view = client.CreateTable(_fixture.DatasetId, "highscore_view", schema: null, options: new CreateTableOptions { View = viewDefinition }); // This is how a client can check that a BigQueryTable is a view. Assert.NotNull(view.Resource.View); var queryResults = client.ExecuteQuery($"SELECT * FROM {view} WHERE player = 'Bob'", parameters: null).ToList(); Assert.Equal(1, queryResults.Count); // The earlier game is not present in the view Assert.Equal(85L, (long)queryResults[0]["score"]); }
private static IEnumerable <ColumnHeader> GetPortfolioColumns(ViewDefinition viewDefinition, ICompiledViewDefinition compiledViewDefinition) { var columns = new HashSet <ColumnHeader>(); foreach (var configuration in viewDefinition.CalculationConfigurationsByName) { Dictionary <ValueSpecification, HashSet <ValueRequirement> > specs = compiledViewDefinition.CompiledCalculationConfigurations[configuration.Key].TerminalOutputSpecifications; foreach (var secType in configuration.Value.PortfolioRequirementsBySecurityType) { foreach (var req in secType.Value) { if (Satisfies(specs, req)) { columns.Add(new ColumnHeader(configuration.Key, req.Item1, req.Item2)); } } } } return(columns); }
public void RoundTrippedViewsInit(ViewDefinition viewDefinition) { using (var remoteClient = Context.CreateFinancialClient()) { viewDefinition.Name = viewDefinition.Name; remoteClient.ViewDefinitionRepository.AddViewDefinition(new AddViewDefinitionRequest(viewDefinition)); try { AssertEquivalent(Context.ViewProcessor.ViewDefinitionRepository.GetViewDefinition(viewDefinition.UniqueID), viewDefinition); using (var remoteViewClient = Context.ViewProcessor.CreateClient()) { Assert.NotNull(remoteViewClient.GetResults(viewDefinition.UniqueID, ExecutionOptions.SingleCycle).First()); } } finally { remoteClient.ViewDefinitionRepository.RemoveViewDefinition(viewDefinition.Name); } } }
// Open window with exploration graph result. static void Viewer(string FileName) { // Create a Spec Explorer view definition. ViewDefinition ViewDef = new ViewDefinition(); // Load the exploration result in seexpl-format. Graph ExplorationGraph = ViewDocumentControl.PersistenceFileToGraphForTest(FileName, ViewDef); // Create a form. Form form = new Form(); // Create an MSAGL viewer object. GViewer viewer = new GViewer(); // Bind the graph to the viewer. viewer.Graph = ExplorationGraph; // Associate the viewer with the form. form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); //Show the form form.ShowDialog(); }
internal NonscalarTypeHeader(OutGridViewCommand parentCmd, PSObject input) : base(parentCmd) { // Prepare a table view. TableView tableView = new TableView(); tableView.Initialize(parentCmd._expressionFactory, parentCmd._typeInfoDataBase); // Request a view definition from the type database. ViewDefinition viewDefinition = DisplayDataQuery.GetViewByShapeAndType(parentCmd._expressionFactory, parentCmd._typeInfoDataBase, FormatShape.Table, input.TypeNames, null); if (viewDefinition != null) { // Create a header using a view definition provided by the types database. parentCmd._windowProxy.AddColumnsAndItem(input, tableView, (TableControlBody)viewDefinition.mainControl); // Remember all type names and type groups the current view applies to. _appliesTo = viewDefinition.appliesTo; } else { // Create a header using only the input object's properties. parentCmd._windowProxy.AddColumnsAndItem(input, tableView); _appliesTo = new AppliesTo(); // Add all type names except for Object and MarshalByRefObject types because they are too generic. // Leave the Object type name if it is the only type name. int index = 0; foreach (string typeName in input.TypeNames) { if (index > 0 && (typeName.Equals(typeof(Object).FullName, StringComparison.OrdinalIgnoreCase) || typeName.Equals(typeof(MarshalByRefObject).FullName, StringComparison.OrdinalIgnoreCase))) { break; } _appliesTo.AddAppliesToType(typeName); index++; } } }
public void CanGetOutputs(ViewDefinition defn) { UniqueId portfolio = defn.PortfolioIdentifier; if (portfolio == null) { return; } var remoteAvailableOutputs = Context.RemoteAvailableOutputs; remoteAvailableOutputs.MaxNodes = 2; remoteAvailableOutputs.MaxPositions = 2; var availableOutputs = remoteAvailableOutputs.GetPortfolioOutputs(portfolio); Assert.NotNull(availableOutputs); foreach (var securityType in availableOutputs.SecurityTypes) { ICollection <AvailableOutput> positionOutputs = availableOutputs.GetPositionOutputs(securityType); Assert.NotEmpty(positionOutputs); foreach (var availableOutput in positionOutputs) { Assert.Null(availableOutput.PortfolioNodeProperties); Assert.True(new[] { securityType }.SequenceEqual(availableOutput.PositionProperties.Keys)); ValueProperties positionProperty = availableOutput.PositionProperties[securityType]; Assert.NotNull(positionProperty); Assert.NotNull(positionProperty.GetValues("Function")); } } ICollection <AvailableOutput> portfolioNodeOutputs = availableOutputs.GetPortfolioNodeOutputs(); Assert.NotNull(portfolioNodeOutputs); foreach (var availableOutput in portfolioNodeOutputs) { Assert.Empty(availableOutput.PositionProperties); ValueProperties properties = availableOutput.PortfolioNodeProperties; Assert.NotNull(properties); Assert.NotNull(properties.GetValues("Function")); } }
public void NumberOfResultsIsConsistentOnRecompile(ViewDefinition viewDefinition) { var results = new List <IViewComputationResultModel>(); var viewProcess = new HashSet <UniqueId>(); for (int i = 0; i < 10; i++) { using (var remoteViewClient = Context.ViewProcessor.CreateClient()) { var options = ExecutionOptions.SingleCycle; var resultsEnum = remoteViewClient.GetResults(viewDefinition.UniqueID, options, true); var result = resultsEnum.Take(1).ToList().Single(); if (!viewProcess.Add(result.ViewProcessId)) { throw new Exception("Shared process"); } results.Add(result); } } AssertNumberOfResultsIsConsistentOnRecompile(results); }
internal CustomControl(ComplexControlBody body, ViewDefinition viewDefinition) { // viewDefinition can be null for nested controls if (viewDefinition != null) { OutOfBand = viewDefinition.outOfBand; GroupBy = PSControlGroupBy.Get(viewDefinition.groupBy); } Entries = new List <CustomControlEntry>(); // Default entry var cce = new CustomControlEntry(body.defaultEntry); Entries.Add(cce); foreach (var entry in body.optionalEntryList) { cce = new CustomControlEntry(entry); Entries.Add(cce); } }
private void UpdateView() { datasetFilters.Clear(); int selectedRow = 0; if (dataGridViews.SelectedRows.Count > 0) { selectedRow = dataGridViews.SelectedRows[0].Index; } currentView = (ViewDefinition)datasetViews.Rows[selectedRow][2]; if (currentView == null) { return; } //fill in all rows... for (int i = 0; i < currentView.Filters.Count; ++i) { FilterDefinition def = (FilterDefinition)currentView.Filters[i]; string limit = def.Limit.ToString(); if (def.Limit < 0) { limit = ""; } datasetFilters.Rows.Add( new object[] { def.Where, def.SqlOperator, def.Restriction, limit, def.DefaultView, def.DefaultSort, def.SortAscending, def.SkipLevel, } ); } }
//PLAT-1108 [InlineData("Colons:")] //PLAT-1108 [InlineData("Equals=")] //PLAT-1108 [InlineData("Evil\\/.?#^5%")] public void CanAddAndRemovePrimitiveView(string hardUriPart) { ValueRequirement req = GetRequirement(); using (var remoteClient = Context.CreateFinancialClient()) { ViewDefinition vd = GetViewDefinition(req, TestUtils.GetUniqueName() + hardUriPart); Assert.Null(vd.UniqueID); remoteClient.ViewDefinitionRepository.AddViewDefinition(new AddViewDefinitionRequest(vd)); var roundTripped = Context.ViewProcessor.ViewDefinitionRepository.GetViewDefinition(vd.Name); Assert.NotNull(roundTripped); AssertEquivalent(vd, roundTripped); remoteClient.ViewDefinitionRepository.RemoveViewDefinition(vd.Name); Assert.DoesNotContain(vd.Name, Context.ViewProcessor.ViewDefinitionRepository.GetDefinitionNames()); } }
public void ViewHasRightValue() { ValueRequirement req = GetRequirement(); using (var remoteClient = Context.CreateFinancialClient()) { ViewDefinition vd = GetViewDefinition(req, TestUtils.GetUniqueName()); var uid = remoteClient.ViewDefinitionRepository.AddViewDefinition(new AddViewDefinitionRequest(vd)); Assert.NotNull(uid); vd.UniqueID = uid; using (var remoteViewClient = Context.ViewProcessor.CreateClient()) { var viewComputationResultModel = remoteViewClient.GetResults(vd.UniqueID, ExecutionOptions.SingleCycle).First(); Assert.NotNull(viewComputationResultModel); var count = viewComputationResultModel.AllResults.Where(spec => req.IsSatisfiedBy(spec.ComputedValue.Specification)).Count(); Assert.Equal(1, count); } remoteClient.ViewDefinitionRepository.RemoveViewDefinition(vd.Name); } }
public View Make(ViewDefinition definition, DAL.Models.DbSearchResponse ticketSet, View parentNode, Action <UI.View> viewAction) { var view = new UI.View() { ViewType = ViewType.TableRecord, ParentNode = parentNode, Virtual = true }; view.Props.Add("GridIndex", 0); foreach (var controlGroup in definition.Controls.Where(c => c.GridIndex >= 0).GroupBy(c => c.GridIndex).OrderBy(c => c.Key)) { view.Props["GridIndex"] = controlGroup.Key; var childView = new TableCellViewBehaviour(CurrentUser).Make(definition, ticketSet, view, null); view.ChildViews.Add(childView); } view.Props.Remove("GridIndex"); return(view); }
public View Make(ViewDefinition definition, DAL.Models.DbSearchResponse ticketSet, View parentNode, Action <UI.View> viewAction) { var view = new UI.View() { ViewType = ViewType.TableCell, ParentNode = parentNode, Virtual = true }; var gridIndex = Convert.ToInt32(parentNode.Props["GridIndex"]); view.Props = new Dictionary <string, object>() { { "TemplateId", definition.TemplateId }, { "GridIndex", gridIndex } }; view.Controls = definition .Controls.Where(c => c.GridIndex >= 0 && c.GridIndex == gridIndex).OrderBy(c => c.OrderIndex) .Select(c => BehaviourSelector.ControlBehaviours[Mapper.Map <UI.ControlType>(c.ControlType)](CurrentUser).Make(c, ticketSet, view, null)) .ToList(); return(view); }
public UI.View Make(ViewDefinition definition, CMS.DAL.Models.DbSearchResponse ticketSet, View parentNode, Action <UI.View> viewAction) { var view = new View() { ViewType = Mapper.Map <UI.ViewType>(definition.ViewType), ParentNode = parentNode }; var ticket = ticketSet.Tickets.FirstOrDefault(); // TODO //view.DocId = (ticket != null) ? (int?)Convert.ToInt32(ticket["Id"]) : null; view.Props = new Dictionary <string, object>() { { "Name", definition.Name }, { "TemplateId", definition.TemplateId }, { "OrderIndex", definition.OrderIndex }, { "GridWidth", definition.GridWidth }, { "LinkedFieldId", definition.LinkedFieldId } }; return(view); }
public void CanGetCompilationResults(ViewDefinition definition) { using (var remoteViewClient = Context.ViewProcessor.CreateClient()) { var compilationResult = new BlockingCollection <object>(); var eventViewResultListener = new EventViewResultListener(); eventViewResultListener.ViewDefinitionCompiled += (sender, e) => compilationResult.Add(e.CompiledViewDefinition); eventViewResultListener.ViewDefinitionCompilationFailed += (sender, e) => compilationResult.Add(e.Exception); remoteViewClient.SetResultListener(eventViewResultListener); remoteViewClient.AttachToViewProcess(definition.UniqueID, ExecutionOptions.GetCompileOnly()); var result = compilationResult.Take(); Assert.IsNotType(typeof(Exception), result); Debug.WriteLine(definition.UniqueID); Assert.IsAssignableFrom(typeof(ICompiledViewDefinition), result); var viewDefin = (ICompiledViewDefinition)result; ValueAssertions.AssertSensibleValue(viewDefin); } }
/// <summary> /// Save the Views /// </summary> /// <param name="mediaType"></param> protected void SaveSettings(string mediaType) { StoreGridInView(); // Save pending changes string customViews = Config.GetFile(Config.Dir.Config, mediaType + "Views.xml"); if (settingsChanged) { // Rebuild the Arraylist with the views out of the Datagrid views.Clear(); foreach (DataGridViewRow row in dataGridViews.Rows) { ViewDefinition view = (ViewDefinition)datasetViews.Rows[row.Index][2]; if (view.Filters.Count > 0) { views.Add(view); } } try { // Don't use FileInfo.OpenWrite // From msdn: // If you overwrite a longer string (such as "This is a test of the OpenWrite method") with a shorter string (like "Second run"), the file will contain a mix of the strings ("Second runtest of the OpenWrite method"). using (FileStream fileStream = new FileStream(customViews, FileMode.Truncate)) { SoapFormatter formatter = new SoapFormatter(); formatter.Serialize(fileStream, views); fileStream.Close(); } } catch (Exception ex) { Log.Error("BaseViews:SaveSettings: {0}", ex.Message); } } }
public AddViewDefinitionRequest(ViewDefinition viewDefinition) { _viewDefinition = viewDefinition; }
/// <summary> /// Performs the comparing based on instance's public contents between /// two instances, these two instances must be declared as the same class. /// </summary> /// <param name="viewDefinition1">The first instance to be compared.</param> /// <param name="viewDefinition2">The second instance to be compared.</param> /// <returns>Return true if they are equal, else return false.</returns> protected bool DoCompare(ViewDefinition viewDefinition1, ViewDefinition viewDefinition2) { string viewString1 = SerializerHelp(viewDefinition1, typeof(ViewDefinition)); string viewString2 = SerializerHelp(viewDefinition2, typeof(ViewDefinition)); return viewString1 == viewString2; }
/// <summary> /// Copy view layout form source view to all specified target views /// </summary> /// <param name="sourceView">Source view</param> /// <param name="targetViews">List of target views</param> /// <param name="includeSorting">Indicates if sorting must be included in replication operation</param> /// <param name="service">Crm organization service</param> /// <returns>Indicates if all views have been updated</returns> public static List <Tuple <string, string> > PropagateLayout(ViewDefinition sourceView, List <ViewDefinition> targetViews, bool includeSorting, IOrganizationService service) { var errors = new List <Tuple <string, string> >(); string multiObjectAttribute = string.Empty; try { foreach (ViewDefinition targetView in targetViews) { if (targetView.Id != sourceView.Id) { #region Replace target view cells by source view cells // Update grid cells XmlDocument targetLayout = new XmlDocument(); targetLayout.LoadXml(targetView.LayoutXml); XmlAttribute multiAttr = targetLayout.SelectSingleNode("grid/row").Attributes["multiobjectidfield"]; if (multiAttr != null) { multiObjectAttribute = multiAttr.Value; } // We empty the existing cells for (int i = targetLayout.SelectSingleNode("grid/row").ChildNodes.Count; i > 0; i--) { XmlNode toDelete = targetLayout.SelectSingleNode("grid/row").ChildNodes[i - 1]; targetLayout.SelectSingleNode("grid/row").RemoveChild(toDelete); } XmlDocument sourceLayout = new XmlDocument(); sourceLayout.LoadXml(sourceView.LayoutXml); XmlNodeList sourceCellNodes = sourceLayout.SelectNodes("grid/row/cell"); var cells = new List <string>(); foreach (XmlNode cellNode in sourceCellNodes) { if (!cellNode.Attributes["name"].Value.Contains(".") || targetView.Type != VIEW_ASSOCIATED) { cells.Add(cellNode.Attributes["name"].Value); XmlNode nodeDest = targetLayout.ImportNode(cellNode.Clone(), true); targetLayout.SelectSingleNode("grid/row").AppendChild(nodeDest); } } targetView.LayoutXml = targetLayout.OuterXml; #endregion Replace target view cells by source view cells // Retrieve target fetch data if (!string.IsNullOrEmpty(targetView.FetchXml)) { XmlDocument targetFetchDoc = new XmlDocument(); targetFetchDoc.LoadXml(targetView.FetchXml); XmlDocument sourceFetchDoc = new XmlDocument(); sourceFetchDoc.LoadXml(sourceView.FetchXml); XmlNodeList sourceAttrNodes = sourceFetchDoc.SelectNodes("fetch/entity/attribute"); foreach (XmlNode attrNode in sourceAttrNodes) { if (targetFetchDoc.SelectSingleNode("fetch/entity/attribute[@name='" + attrNode.Attributes["name"].Value + "']") == null) { XmlNode attrNodeToAdd = targetFetchDoc.ImportNode(attrNode, true); targetFetchDoc.SelectSingleNode("fetch/entity").AppendChild(attrNodeToAdd); } } foreach (XmlNode cellNode in sourceCellNodes) { string name = cellNode.Attributes["name"].Value; if (!name.Contains(".") && targetFetchDoc.SelectSingleNode("fetch/entity/attribute[@name='" + name + "']") == null) { XmlElement attrNodeToAdd = targetFetchDoc.CreateElement("attribute"); attrNodeToAdd.SetAttribute("name", name); targetFetchDoc.SelectSingleNode("fetch/entity").AppendChild(attrNodeToAdd); } } if (includeSorting) { #region Copy Sorting settings to target views XmlNodeList sourceSortNodes = sourceFetchDoc.SelectNodes("fetch/entity/order"); XmlNodeList targetSortNodes = targetFetchDoc.SelectNodes("fetch/entity/order"); // Removes existing sorting for (int i = targetSortNodes.Count; i > 0; i--) { XmlNode toDelete = targetSortNodes[i - 1]; targetSortNodes[i - 1].ParentNode.RemoveChild(toDelete); } // Append source sorting foreach (XmlNode orderNode in sourceSortNodes) { XmlNode orderNodeToAdd = targetFetchDoc.ImportNode(orderNode, true); targetFetchDoc.SelectSingleNode("fetch/entity").AppendChild(orderNodeToAdd); } #endregion Copy Sorting settings to target views } #region Replicate link entities information // Retrieve source fetch data if (!string.IsNullOrEmpty(sourceView.FetchXml)) { //XmlDocument sourceFetchDoc = new XmlDocument(); //sourceFetchDoc.LoadXml(sourceView["fetchxml"].ToString()); XmlNodeList linkNodes = sourceFetchDoc.SelectNodes("fetch/entity/link-entity"); foreach (XmlNode sourceLinkNode in linkNodes) { var alias = sourceLinkNode.Attributes["alias"].Value; if (cells.FirstOrDefault(c => c.StartsWith(alias + ".")) == null) { continue; } XmlNode targetLinkNode = targetFetchDoc.SelectSingleNode("fetch/entity/link-entity[@alias=\"" + alias + "\"]"); // Adds the missing link-entity node if (targetLinkNode == null) { XmlNode nodeDest = targetFetchDoc.ImportNode(sourceLinkNode.Clone(), true); XmlAttribute typeAttr = nodeDest.Attributes["link-type"]; if (typeAttr == null) { typeAttr = targetFetchDoc.CreateAttribute("link-type"); typeAttr.Value = "outer"; nodeDest.Attributes.Append(typeAttr); } else { typeAttr.Value = "outer"; } targetFetchDoc.SelectSingleNode("fetch/entity").AppendChild(nodeDest); } // Retrieves node again (if it was added) targetLinkNode = targetFetchDoc.SelectSingleNode("fetch/entity/link-entity[@alias=\"" + alias + "\"]"); // Removes existing attributes for (int i = targetLinkNode.ChildNodes.Count; i > 0; i--) { if (targetLinkNode.ChildNodes[i - 1].Name == "attribute") { XmlNode toDelete = targetLinkNode.ChildNodes[i - 1]; targetLinkNode.RemoveChild(toDelete); } } // Adds the attribute nodes from the source node foreach (XmlNode node in sourceLinkNode.ChildNodes) { if (node.Name == "attribute") { XmlNode attributeNode = targetLinkNode.SelectSingleNode("attribute[@name='" + node.Attributes["name"].Value + "']"); if (attributeNode == null) { XmlNode nodeDest = targetFetchDoc.ImportNode(node.Clone(), true); targetLinkNode.AppendChild(nodeDest); } } } } } // Suppression des éléments Attribute inutiles dans la requête List <string> attributesToRemove = new List <string>(); foreach (XmlNode attributeNode in targetFetchDoc.SelectNodes("//attribute")) { if (attributeNode.Attributes["name"].Value == multiObjectAttribute) { break; } bool isFoundInCell = false; foreach (XmlNode cellNode in sourceLayout.SelectNodes("grid/row/cell")) { if (attributeNode.ParentNode.Name == "link-entity") { if (cellNode.Attributes["name"].Value == attributeNode.ParentNode.Attributes["alias"].Value + "." + attributeNode.Attributes["name"].Value) { isFoundInCell = true; break; } } else { if (attributeNode.Attributes["name"].Value == (attributeNode.ParentNode.Attributes["name"].Value + "id") || cellNode.Attributes["name"].Value == attributeNode.Attributes["name"].Value) { isFoundInCell = true; break; } } } if (!isFoundInCell) { if (attributeNode.ParentNode.Name == "link-entity") { attributesToRemove.Add(attributeNode.ParentNode.Attributes["alias"].Value + "." + attributeNode.Attributes["name"].Value); } else { attributesToRemove.Add(attributeNode.Attributes["name"].Value); } } } foreach (string attributeName in attributesToRemove) { XmlNode node; if (attributeName.Contains(".")) { node = targetFetchDoc.SelectSingleNode("fetch/entity/link-entity[@alias='" + attributeName.Split('.')[0] + "']/attribute[@name='" + attributeName.Split('.')[1] + "']"); targetFetchDoc.SelectSingleNode("fetch/entity/link-entity[@alias='" + node.ParentNode.Attributes["alias"].Value + "']").RemoveChild(node); } else { node = targetFetchDoc.SelectSingleNode("fetch/entity/attribute[@name='" + attributeName + "']"); targetFetchDoc.SelectSingleNode("fetch/entity").RemoveChild(node); } } foreach (XmlNode linkentityNode in targetFetchDoc.SelectNodes("fetch/entity/link-entity")) { if (linkentityNode != null && linkentityNode.ChildNodes.Count == 0) { targetFetchDoc.SelectSingleNode("fetch/entity").RemoveChild(linkentityNode); } } targetView.FetchXml = targetFetchDoc.OuterXml; #endregion Replicate link entities information } #region Save target view try { targetView.InnerRecord.Attributes.Remove("statecode"); targetView.InnerRecord.Attributes.Remove("statuscode"); service.Update(targetView.InnerRecord); } catch (Exception error) { errors.Add(new Tuple <string, string>(targetView.Name, error.Message)); } #endregion Save target view } } return(errors); } catch (Exception error) { string errorMessage = CrmExceptionHelper.GetErrorMessage(error, false); throw new Exception("Error while copying layout to target views: " + errorMessage); } }
private void ConvertTemplate(TemplateData template) { _log.Debug($"Converting template {template.Title}"); ViewDefinition viewDefinition; if (this.ContainsView(template.Id)) { _log.Debug($"schema {template.Title} was already in the model registry"); viewDefinition = Views.First(m => m.TcmUri == template.Id); } else { _log.Debug($"creating new ViewDefinition for template {template.Title}"); viewDefinition = new ViewDefinition(); viewDefinition.Title = template.Title; viewDefinition.TcmUri = template.Id; if (string.IsNullOrEmpty(template.Metadata)) { viewDefinition.ViewName = MakeCsName(template.Title, true); } else { viewDefinition.ViewName = GetFieldValue(template.Metadata, "view"); } if (template is ComponentTemplateData) { viewDefinition.ViewPurpose = ViewPurpose.Entity; UsedItemsFilterData filter = new UsedItemsFilterData() { ItemTypes = new[] { ItemType.Schema } }; var associatedSchemas = Client.GetList(template.Id, filter).Cast <SchemaData>(); var allAssociatedModels = associatedSchemas?.Select(s => ModelRegistry.GetViewModelDefinition(s.Id)).Where(a => a.Purpose == SchemaPurpose.Component); if (allAssociatedModels.Count() > 1) { _log.Warn($"found component template {template.Title} ({template.Id}) with multiple associated schemas. We will use the base class {Config.BaseClasses.FirstOrDefault()} instead"); viewDefinition.ModelTypeName = Config.BaseClasses.FirstOrDefault(); //_log.Info($"Template {template.Title} is linked to more than one schema. We need to merge models before we can continue"); //var mergedModel = ModelRegistry.MergeModelDefinitions(allAssociatedModels); //viewDefinition.AssociatedModelDefinition = mergedModel; //viewDefinition.ModelTypeName = mergedModel.TypeName; } else if (allAssociatedModels.Count() == 0) { _log.Warn($"found component template {template.Title} ({template.Id}) without any associated schema. We will use the base class {Config.BaseClasses.FirstOrDefault()} instead"); viewDefinition.ModelTypeName = Config.BaseClasses.FirstOrDefault(); } else { viewDefinition.AssociatedModelDefinition = allAssociatedModels.First(); viewDefinition.ModelTypeName = viewDefinition.AssociatedModelDefinition.TypeName; } } else // this is a page template, so it has its own associated model definition { viewDefinition.AssociatedModelDefinition = ModelRegistry.GetViewModelDefinition(template.Id); viewDefinition.ModelTypeName = viewDefinition.AssociatedModelDefinition.TypeName; viewDefinition.ViewPurpose = ViewPurpose.Page; } } currentView = viewDefinition; if (this.ContainsView(template.Id)) { Views.Add(viewDefinition); } else { Views.Add(viewDefinition); } }
protected virtual void SetView(int selectedViewId) { bool isVideoWindow = (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_VIDEO_TITLE); switch (selectedViewId) { case 0: // Shares { int nNewWindow; if (isVideoWindow) { nNewWindow = (int)Window.WINDOW_VIDEOS; } else { nNewWindow = (int)Window.WINDOW_MUSIC_FILES; } StateBase.StartWindow = nNewWindow; if (nNewWindow != GetID) { if (isVideoWindow) { MediaPortal.GUI.Video.GUIVideoFiles.Reset(); } GUIWindowManager.ReplaceWindow(nNewWindow); } } break; case 4540: // Now playing { int nPlayingNowWindow = (int)Window.WINDOW_MUSIC_PLAYING_NOW; MediaPortal.GUI.Music.GUIMusicPlayingNow guiPlayingNow = (MediaPortal.GUI.Music.GUIMusicPlayingNow)GUIWindowManager.GetWindow(nPlayingNowWindow); if (guiPlayingNow != null) { guiPlayingNow.MusicWindow = (MediaPortal.GUI.Music.GUIMusicBaseWindow) this; GUIWindowManager.ActivateWindow(nPlayingNowWindow); } } break; default: // a db view { ViewDefinition selectedView = (ViewDefinition)handler.Views[selectedViewId - 1]; handler.CurrentView = selectedView.Name; StateBase.View = selectedView.Name; int nNewWindow; if (isVideoWindow) { nNewWindow = (int)Window.WINDOW_VIDEO_TITLE; // Reset search variables if (GUIVideoTitle.CurrentViewHistory != handler.CurrentLevelWhere) { GUIVideoTitle.IsActorSearch = false; GUIVideoTitle.IsMovieSearch = false; GUIVideoTitle.ActorSearchString = string.Empty; GUIVideoTitle.MovieSearchString = string.Empty; GUIVideoTitle.MovieSearchDbFieldString = string.Empty; } } else { nNewWindow = (int)Window.WINDOW_MUSIC_GENRE; } if (GetID != nNewWindow) { StateBase.StartWindow = nNewWindow; if (nNewWindow != GetID) { GUIWindowManager.ReplaceWindow(nNewWindow); } } else { LoadDirectory(string.Empty); if (facadeLayout.Count <= 0) { GUIControl.FocusControl(GetID, btnLayouts.GetID); } } } break; } }
private ViewDefinition ParseView(XElement xElement, PageDefinition parserResult) { string viewTypeName = xElement.Name.LocalName; ComponentDefinition viewComponent = _viewCatalog.Get(viewTypeName); if (viewComponent == null) throw new XrcException(string.Format("View '{0}' not found.", viewTypeName)); if (!typeof(IView).IsAssignableFrom(viewComponent.Type)) throw new ApplicationException(string.Format("Type '{0}' is not a view.", viewComponent.Type)); string slot = string.Empty; if (xElement.Attribute(SLOT) != null) slot = xElement.AttributeAs<string>(SLOT); ViewDefinition view = new ViewDefinition(viewComponent, slot); // TODO Escludere le property con un namespace? O usare un namespace particolare per le property? foreach (var element in xElement.Elements()) { var property = ParseProperty(element, viewComponent.Type, parserResult); view.Properties.Add(property); } return view; }
public View Make(ViewDefinition definition, DAL.Models.DbSearchResponse ticketSet, View parentNode, Action <UI.View> viewAction) { var view = new View() { ViewType = Mapper.Map <UI.ViewType>(definition.ViewType), ParentNode = parentNode }; var ticket = ticketSet.Tickets.FirstOrDefault(); // TODO //view.DocId = (ticket != null) ? (int?)Convert.ToInt32(ticket["Id"]) : null; view.Props = new Dictionary <string, object>() { { "Name", definition.Name }, { "TemplateId", definition.TemplateId }, { "OrderIndex", definition.OrderIndex }, { "DisplayName", definition.DisplayName }, { "GridWidth", definition.GridWidth }, { "LinkedFieldId", definition.LinkedFieldId }, { "Active", false } }; view.Controls = definition .Controls .Select(c => BehaviourSelector.ControlBehaviours[Mapper.Map <UI.ControlType>(c.ControlType)](CurrentUser).Make(c, ticketSet, view, null)) .ToList(); view.Filters = definition .Filters .Select(f => BehaviourSelector.FilterBehaviours[Mapper.Map <UI.FilterType>(f.FilterType)](CurrentUser).Make(f, view)) .ToList(); foreach (var childViewDef in definition.ChildViews) { View childView; if (childViewDef.ViewType == DAL.Models.ViewType.Table) { var parentFilters = ticketSet.Request.Filters; var searchParams = DAL.Models.DbSearchRequestParams.GetDefault((DAL.Models.View)childViewDef.Entity); searchParams.SearchWithInnerJoin = true; var linkedTickets = DbDocumentService.GetDocuments((DAL.Models.View)childViewDef.Entity, parentFilters, searchParams); childView = BehaviourSelector.ViewBehaviours[Mapper.Map <UI.ViewType>(childViewDef.ViewType)](CurrentUser) .Make(childViewDef, linkedTickets, null, null); } else { childView = BehaviourSelector.ViewBehaviours[Mapper.Map <UI.ViewType>(childViewDef.ViewType)](CurrentUser) .Make(childViewDef, ticketSet, null, null); } view.ChildViews.Add(childView); } if (definition.ChildViews.Any(cv => cv.ViewType == DAL.Models.ViewType.Tab)) { var parentView = new View() { ViewType = ViewType.TabContainer, ParentNode = parentNode }; var tabViews = view.ChildViews.Where(v => v.ViewType == ViewType.Tab); view.ChildViews = view.ChildViews.Except(tabViews).ToList(); view.ViewType = ViewType.Tab; view.ParentNode = parentView; view.Props["Active"] = true; parentView.DocId = view.DocId; parentView.Props = view.Props; parentView.ChildViews.AddRange((new List <View>() { view }).Union(tabViews)); return(parentView); } else { return(view); } }
/// <summary> /// Used to validate the View Definition /// </summary> /// <param name="view">specify the type of the view</param> private void ValidateViewDefinition(ViewDefinition view) { if (view != null) { // If the element view is not null, and its schema has been validated before de-serialization; so this requirement MS-WSSCAML_R799 can be captured. Site.CaptureRequirementIfIsTrue( this.PassSchemaValidation, "MS-WSSCAML", 799, @"[In Schema] [The schema definition of ViewDefinition type is as follows:] <xs:complexType name=""ViewDefinition""> <xs:group ref=""ViewDefinitionChildElementGroup""/> <xs:attribute name=""AggregateView"" type=""TRUEFALSE"" default=""FALSE""/> <xs:attribute name=""BaseViewID"" type=""xs:int"" /> <xs:attribute name=""CssStyleSheet"" type=""xs:string"" /> <xs:attribute name=""DefaultView"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""DisplayName"" type=""xs:string"" /> <xs:attribute name=""FailIfEmpty"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""FileDialog"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""FPModified"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""Hidden"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""List"" type=""UniqueIdentifierWithoutBraces"" /> <xs:attribute name=""Name"" type=""UniqueIdentifierWithBraces"" /> <xs:attribute name=""ContentTypeID"" type=""ContentTypeId"" /> <xs:attribute name=""OrderedView"" type=""TRUEFALSE"" /> <xs:attribute name=""DefaultViewForContentType"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""IncludeRootFolder"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""PageType"" type=""xs:string"" /> <xs:attribute name=""Path"" type=""RelativeFilePath"" /> <xs:attribute name=""Personal"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""ReadOnly"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""RecurrenceRowset"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""RequiresClientIntegration"" type=""TRUEFALSE"" default=""FALSE""/> <xs:attribute name=""RowLimit"" type=""xs:int"" /> <xs:attribute name=""ShowHeaderUI"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""Type"" type=""ViewType"" default=""HTML""/> <xs:attribute name=""Url"" type=""RelativeUrl"" /> <xs:attribute name=""UseSchemaXmlToolbar"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""WebPartOrder"" type=""xs:int"" /> <xs:attribute name=""WebPartZoneID"" type=""xs:string"" /> <xs:attribute name=""FreeForm"" type=""TRUEFALSE"" /> <xs:attribute name=""ImageUrl"" type=""xs:string"" /> <xs:attribute name=""SetupPath"" type=""RelativeFilePath"" /> <xs:attribute name=""ToolbarTemplate"" type=""xs:string"" /> <xs:attribute name=""MobileView"" type=""TRUEFALSE"" default=""FALSE""/> <xs:attribute name=""MobileDefaultView"" type=""TRUEFALSE"" /> <xs:attribute name=""MobileUrl"" type=""RelativeUrl"" /> <xs:attribute name=""Level"" type=""ViewPageLevel"" default=""1"" /> <xs:attribute name=""FrameState"" type=""xs:string"" default=""Normal"" /> <xs:attribute name=""IsIncluded"" type=""TRUEFALSE"" default=""TRUE"" /> <xs:attribute name=""IncludeVersions"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""HackLockWeb"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""ModerationType"" type=""ViewModerationType"" default="""" /> <xs:attribute name=""Scope"" type=""ViewScope"" default="""" /> <xs:attribute name=""Threaded"" type=""TRUEFALSE"" default=""FALSE"" /> <xs:attribute name=""TabularView"" type=""FALSE_Case_Insensitive_Else_Anything"" default=""TRUE"" /> </xs:complexType> <xs:group name=""ViewDefinitionChildElementGroup""> <xs:all> <xs:element name=""PagedRowset"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""Toolbar"" type=""ToolbarDefinition"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""Query"" type=""CamlQueryRoot"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""ViewFields"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:element name=""FieldRef"" type=""FieldRefDefinitionView"" minOccurs=""0"" maxOccurs=""unbounded"" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name=""GroupByHeader"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""GroupByFooter"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""ViewHeader"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""ViewBody"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""ViewFooter"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""RowLimitExceeded"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""ViewEmpty"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""PagedRecurrenceRowset"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""PagedClientCallbackRowset"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""Aggregations"" type=""AggregationsDefinition"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""OpenApplicationExtension"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""RowLimit"" type=""RowLimitDefinition"" minOccurs=""0"" maxOccurs=""1"" default=""2147483647"" /> <xs:element name=""Mobile"" type=""MobileViewDefinition"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""ViewStyle"" type=""ViewStyleReference"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""CalendarSettings"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""CalendarViewStyles"" type=""CalendarViewStylesDefinition"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""ViewBidiHeader"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""Script"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""ViewData"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:element name=""FieldRef"" type=""FieldRefDefinitionViewData"" minOccurs=""3"" maxOccurs=""5"" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name=""Formats"" type=""ViewFormatDefinitions"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""InlineEdit"" type=""TRUE_If_Present"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""ProjectedFields"" type=""ProjectedFieldsDefinitionType"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""Joins"" type=""ListJoinsDefinitionType"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""Method"" type=""ViewMethodDefinition"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""ParameterBindings"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""Xsl"" minOccurs=""0"" maxOccurs=""1""> <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> <xs:element name=""XslLink"" minOccurs=""0"" maxOccurs=""1"" > <xs:complexType> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:anyAttribute processContents=""skip"" /> </xs:complexType> </xs:element> </xs:all> </xs:group>"); if (view.Query != null) { // Validate common query requirements. this.ValidateQuery(view.Query); } if (view.RowLimit != null) { // Validate row limit related schema requirements. this.ValidateRowLimit(); } if (view.ViewFields != null && view.ViewFields.Length > 0) { // Validate view fields related schema requirements. this.ValidateViewFields(); } // If the string of Type equals one of enumeration values of the ViewType type, and its schema has been verified as conforming to the schema in WSDL, then this requirement MS-WSSCAML_R194 can be captured. bool isViewType = view.Type.ToString().Equals("HTML") || view.Type.ToString().Equals("GRID") || view.Type.ToString().Equals("CALENDAR") || view.Type.ToString().Equals("RECURRENCE") || view.Type.ToString().Equals("CHART") || view.Type.ToString().Equals("GANTT") || view.Type.ToString().Equals("TABLE"); Site.CaptureRequirementIfIsTrue( isViewType, "MS-WSSCAML", 194, @"[In ViewType] The ViewType type specifies the type of view rendering. <xs:simpleType name=""ViewType""> <xs:restriction base=""xs:string""> <xs:enumeration value=""HTML"" /> <xs:enumeration value=""GRID"" /> <xs:enumeration value=""CALENDAR"" /> <xs:enumeration value=""RECURRENCE"" /> <xs:enumeration value=""CHART"" /> <xs:enumeration value=""GANTT"" /> <xs:enumeration value=""TABLE"" /> </xs:restriction> </xs:simpleType>"); // If level equals one of the enumeration integer values of the ViewPageLevel type, and its schema has been verified as conforming to the schema in WSDL, then this requirement MS-WSSCAML_R188 can be captured. bool isViewPageLevel = view.Level == 1 || view.Level == 2 || view.Level == 255; Site.CaptureRequirementIfIsTrue( isViewPageLevel, "MS-WSSCAML", 188, @"[In ViewPageLevel] [The schema definition of ViewPageLevel is as follows:] <xs:simpleType name=""ViewPageLevel""> <xs:restriction base=""xs:int ""> <xs:enumeration value=""1"" /> <xs:enumeration value=""2"" /> <xs:enumeration value=""255"" /> </xs:restriction> </xs:simpleType>"); // If this attribute ContentTypeID exists, and its schema has been verified as conforming to the schema in WSDL, then this requirement MS-WSSCAML_R140 can be captured. if (view.ContentTypeID != null) { Site.CaptureRequirementIfIsTrue( this.PassSchemaValidation, "MS-WSSCAML", 140, @"[In ContentTypeId Type] The ContentTypeId type is the identifier for the specified content type. See [MS-WSSTS] section 2.1.2.8.1 for more information about the structure of a content type identifier. <xs:simpleType name=""ContentTypeId""> <xs:restriction base=""xs:string""> <xs:pattern value=""0x([0-9A-Fa-f][1-9A-Fa-f]|[1-9A-Fa-f][0-9A-Fa-f]|00[0-9A-Fa-f]{32})*"" /> <xs:minLength value=""2""/> <xs:maxLength value=""1026""/> </xs:restriction> </xs:simpleType>"); } // If the attribute Url exists, and its schema has been verified as conforming to the schema in WSDL, then this requirement MS-WSSCAML_R7 can be captured. if (view.Url != null) { Site.CaptureRequirementIfIsTrue( this.PassSchemaValidation, "MS-WSSCAML", 7, @"[In RelativeUrl] [The schema definition of RelativeUrl is as follows:] <xs:simpleType name=""RelativeUrl""> <xs:restriction base=""xs:string"" > <xs:maxLength value=""255"" /> <xs:minLength value=""0"" /> </xs:restriction> </xs:simpleType>"); } // If the attribute Name exists, and its schema has been verified as conforming to the schema in WSDL, then this requirement MS-WSSCAML_R17 can be captured. if (view.Name != null) { Site.CaptureRequirementIfIsTrue( this.PassSchemaValidation, "MS-WSSCAML", 17, @"[In UniqueIdentifierWithBraces] [The schema definition of UniqueIdentifierWithBraces is as follows:] <xs:simpleType name=""UniqueIdentifierWithBraces""> <xs:restriction base=""xs:string""> <xs:pattern value=""\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}""/> </xs:restriction> </xs:simpleType>"); } if (view.Toolbar != null) { // If Toolbar exists, and its schema is verified as conforming to the schema in WSDL, then this requirement MS-WSSCAML_R788 can be captured. Site.CaptureRequirementIfIsTrue( this.PassSchemaValidation, "MS-WSSCAML", 788, @"[In Schema] [The schema definition of ToolbarDefinition is as follows:] <xs:complexType name=""ToolbarDefinition""> <xs:sequence> <xs:any minOccurs=""0"" maxOccurs=""unbounded"" namespace=""##any"" processContents=""skip"" /> </xs:sequence> <xs:attribute name=""Position"" type=""ToolbarPosition"" /> <xs:attribute name=""Type"" type=""ToolbarType"" /> <xs:anyAttribute processContents=""skip"" /> </xs:complexType>"); // If the attribute Type exists, and its schema is verified to conform to the schema in WSDL, then this requirement MS-WSSCAML_R177 can be captured. if (view.Toolbar.TypeSpecified) { Site.CaptureRequirementIfIsTrue( this.PassSchemaValidation, "MS-WSSCAML", 177, @"[In ToolbarType] [The schema definition of ToolbarType is as follows:] <xs:simpleType name=""ToolbarType""> <xs:restriction base=""xs:string""> <xs:enumeration value=""Standard"" /> <xs:enumeration value=""FreeForm"" /> <xs:enumeration value=""RelatedTasks"" /> <xs:enumeration value=""None"" /> </xs:restriction> </xs:simpleType>"); } } this.ValidateFormats(view.Formats); } }
internal static MarketDataSnapshotProcessor Create(RemoteEngineContext context, ViewDefinition definition, CancellationToken ct) { using (var liveDataStream = new LiveDataStream(definition.Name, context)) { ManageableMarketDataSnapshot snapshot = liveDataStream.GetNewSnapshotForUpdate(ct); //NOTE: we could consider reusing the LiveDataStream, but server side will share the processer return(new MarketDataSnapshotProcessor(context, snapshot)); } }