static bool ResolveNamesConflict(IDashboardDataSource dataSourceCopy, DataSourceCollection toDataSources, IDictionary <string, string> dataSourceNamesMap) { // Provide your data source component names confilict resolution logic here string newName = NamesGenerator.GenerateName(dataSourceCopy.ComponentName, 1, toDataSources.Select(ds => ds.ComponentName)); dataSourceNamesMap.Add(dataSourceCopy.ComponentName, newName); dataSourceCopy.ComponentName = newName; return(true); }
static bool ResolveGroupNamesConflict(DashboardItemGroup groupCopy, string originalGroupName, IEnumerable <DashboardItem> toGroups, IDictionary <string, string> groupNamesMap) { // Provide your group component name confilict resolution logic here string newName = NamesGenerator.GenerateName(originalGroupName, 1, toGroups.Select(g => g.ComponentName)); groupNamesMap.Add(originalGroupName, newName); groupCopy.ComponentName = newName; return(true); }
static bool ResolveDashboardItemNameConflict(DashboardItem dashboardItemCopy, string originalItemName, DashboardItemCollection toItems, IDictionary <string, string> dashboardItemNamesMap) { // Provide your item component name confilict resolution logic here string newName = NamesGenerator.GenerateName(originalItemName, 1, toItems.Select(item => item.ComponentName)); dashboardItemNamesMap.Add(originalItemName, newName); dashboardItemCopy.ComponentName = newName; return(true); }
static bool ResolveParamterNamesConflict(DashboardParameter parameterCopy, string originalName, DashboardMerger dashboardMerger) { // Provide your parameter name confilict resolution logic here parameterCopy.Name = NamesGenerator.GenerateName("RenamedParameter", 1, dashboardMerger.OriginalDashboard.Parameters.Select(p => p.Name)); IEnumerable <DataDashboardItem> dataDashboardItems = dashboardMerger.OriginalDashboard.Items.Where(item => item is DataDashboardItem).Cast <DataDashboardItem>(); string originalNamePattern = String.Format("?{0}", originalName); string copyNamePattern = String.Format("?{0}", parameterCopy.Name); foreach (DataDashboardItem item in dataDashboardItems) { if (!String.IsNullOrEmpty(item.FilterString) && item.FilterString.Contains(originalNamePattern)) { item.FilterString = item.FilterString.Replace(originalNamePattern, copyNamePattern); } } foreach (IDashboardDataSource dataSource in dashboardMerger.OriginalDashboard.DataSources) { UpdateDataSourceParametersNames(dataSource, originalNamePattern, copyNamePattern); } return(true); }