//-- Object service tools private static Atom10FeedFormatter BuildEntry(SNC.Content content, string repositoryId) { var baseUri = GetBaseUri(); var title = content.Name; var description = GenerateAtomContent(content); var lastUpdateTime = new DateTimeOffset(content.ContentHandler.ModificationDate); var linkHref = GetEntryActionUri(baseUri, repositoryId, content.Id, "getEntry"); var feedAlternateLink = new Uri(linkHref); var feedId = linkHref; CmisObject cmisObject = new CmisObject { Properties = BuildCmisProperties(content), AllowableActions = GetAllowableActions(content) }; SyndicationFeed feed = new SyndicationFeed(title, description, feedAlternateLink, feedId, lastUpdateTime); feed.ElementExtensions.Add(cmisObject, new XmlSerializer(typeof(CmisObject))); foreach (var link in BuildLinks(content, baseUri, repositoryId)) { feed.Links.Add(link); } var formatter = new Atom10FeedFormatter(feed); return(formatter); }
//=============== Object service internal static Atom10FeedFormatter BuildChildren(string repositoryId, string folderId) { if (repositoryId.ToLower() != "mainrep") { throw new ArgumentException("Unknown repository identifier: " + repositoryId); } int id; if (!Int32.TryParse(folderId, out id)) { throw new ArgumentException("Unknown object identifier: " + folderId); } SNC.Content folder; var contentList = Store.GetChildren(id, repositoryId, out folder); //---- var baseUri = GetBaseUri(); var title = folder.Name; var description = "{Children of " + folder.Name + "}"; var lastUpdateTime = new DateTimeOffset(folder.ContentHandler.ModificationDate); var linkHref = GetEntryActionUri(baseUri, repositoryId, folder.Id, "getEntry"); var feedAlternateLink = new Uri(linkHref); var feedId = linkHref; List <SyndicationItem> items = new List <SyndicationItem>(); foreach (var content in contentList) { CmisObject cmisObject = new CmisObject { Properties = BuildCmisProperties(content), AllowableActions = GetAllowableActions(content) }; var itemTitle = content.Name; var itemContent = "{Content of " + content.Name + "}"; var action = content.ContentHandler is IFolder ? "getChildren" : "getEntry"; var itemAlternateLink = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, action)); var itemId = GetEntryActionUri(baseUri, repositoryId, content.Id, "getEntry"); var itemLastUpdates = new DateTimeOffset(content.ContentHandler.ModificationDate); var item = new SyndicationItem(itemTitle, itemContent, itemAlternateLink, itemId, itemLastUpdates); item.ElementExtensions.Add(cmisObject, new XmlSerializer(typeof(CmisObject))); foreach (var link in BuildLinks(content, baseUri, repositoryId)) { item.Links.Add(link); } items.Add(item); } SyndicationFeed feed = new SyndicationFeed(title, description, feedAlternateLink, feedId, lastUpdateTime, items); foreach (var link in BuildLinks(folder, baseUri, repositoryId)) { feed.Links.Add(link); } var formatter = new Atom10FeedFormatter(feed); return(formatter); }