/// <summary> /// Gets the service page link collection. /// </summary> /// <param name="scoped">The scoped.</param> /// <param name="context">The context.</param> /// <param name="format">The format.</param> /// <returns></returns> public static reportLinkCollection GetDocumentSetsLinkCollection(this metaDocumentSet scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true) { reportLinkCollection menu = new reportLinkCollection(); menu.title = scoped.documentSetTitle.or(scoped.name); menu.description = scoped.documentSetDescription; // String parent = context.GetDirectoryPath(scoped, levels); foreach (metaDocumentSet pg in scoped.documentSets) { string path = pg.GetIndexPath(context, format, levels, makeAppApsolut); menu.AddLink(pg.documentSetTitle.or(pg.name), pg.documentSetDescription, path.getWebPathBackslashFormat().Trim('/')); } return(menu); }
/// <summary> /// Creates collection of links with correct url paths /// </summary> /// <param name="menu">The menu.</param> /// <param name="context">The context.</param> /// <param name="format">The format.</param> /// <param name="levels">The levels.</param> /// <returns></returns> /// <exception cref="imbSCI.Reporting.exceptions.aceReportException">CompileLinkCollection - found link with undefined state</exception> public static reportLinkCollection CompileLinkCollection(this reportLinkCollection menu, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels) { if (menu == null) { return(null); //throw new aceReportException(context,"reportLinkCollection sent to metaTools.CompileLinkCollection() was null", aceReportExceptionType.compileScriptError); } reportLinkCollection output = new reportLinkCollection(menu.GetMainGroup().name, menu.GetMainGroup().description); reportInPackageGroup group = menu.GetMainGroup(); output.title = menu.title; output.description = menu.description; foreach (reportLink link in menu) { if (link.group != group) { var g = output.AddGroup(link.group.name, link.group.description); g.priority = link.group.priority; group = g; } reportLink compiledLink = new reportLink(link); bool accept = true; switch (link.state) { case reportLinkState.pathIsMetaModelPath: compiledLink.element = context.scope.resolve(metaModelTargetEnum.scopeRelativePath, link.linkPath, null).First(); compiledLink.state = reportLinkState.pathIsUrl; break; case reportLinkState.registryQuery: compiledLink.element = ((IHasReportRegistry)context.scope.root).reportRegistry.GetReport(link.registryQuery); if (compiledLink.element == null) { compiledLink.state = reportLinkState.undefined; } else { compiledLink.state = reportLinkState.pathIsUrl; } break; case reportLinkState.elementInstance: compiledLink.state = reportLinkState.pathIsUrl; break; case reportLinkState.pathIsUrl: // cool break; case reportLinkState.undefined: accept = false; throw new aceReportException(context, "CompileLinkCollection - found link with undefined state", aceReportExceptionType.compileScriptError).add(link.linkTitle).add(link.linkDescription); break; } if (compiledLink.linkPath.isNullOrEmpty() && compiledLink.state == reportLinkState.pathIsUrl) { compiledLink.linkPath = link.element.CompileLinkForElemenet(context, format, levels); //path; } if (compiledLink.state != reportLinkState.pathIsUrl) { accept = false; } if (accept) { output.AddLink(compiledLink); } } output.sortup(); return(output); }