Пример #1
0
        public override AtomItem ToAtomItem(NameValueCollection parameters)
        {
            var       atomFormatter = new Atom10FeedFormatter();
            XmlReader xmlreader     = XmlReader.Create(new StringReader(TextFeed = this.TextFeed));

            atomFormatter.ReadFrom(xmlreader);
            var feed   = new OwsContextAtomFeed(atomFormatter.Feed, true);
            var item   = feed.Items.First();
            var result = new AtomItem(item);

            if (parameters["admin"] != null && parameters["admin"] == "true")
            {
                try{
                    var wpsOverviews = ThematicAppFactory.GetWpsServiceOverviews(context, item);
                    if (wpsOverviews.Count > 0)
                    {
                        result.ElementExtensions.Add("wps", "https://standards.terradue.com", wpsOverviews);
                    }
                }catch (Exception) {}

                try{
                    var collOverviews = ThematicAppFactory.GetDataCollectionOverview(context, item);
                    if (collOverviews.Count > 0)
                    {
                        result.ElementExtensions.Add("collection", "https://standards.terradue.com", collOverviews);
                    }
                }catch (Exception) {}

                try{
                    if (this.Domain != null)
                    {
                        var community   = ThematicCommunity.FromId(context, this.DomainId);
                        var comOverview = new CommunityOverview {
                            Identifier = community.Identifier,
                            Title      = community.Name,
                            Icon       = community.IconUrl
                        };
                        result.ElementExtensions.Add("community", "https://standards.terradue.com", comOverview);
                    }
                }catch (Exception) {}
                try{
                    var editorUrl = string.Format("{0}/{1}/{2}", context.GetConfigValue("ellip.editor-url"), this.Index, this.UId);
                    result.Links.Add(new SyndicationLink(new Uri(editorUrl), "related", "geobrowser editor", "application/html", 0));
                }catch (Exception) {}
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Post the specified request.
        /// </summary>
        /// <param name="request">Request.</param>
        public object Post(CreateDomainOwnerRequest request)
        {
            var       context = TepWebContext.GetWebContext(PagePrivileges.AdminOnly);
            WebDomain result;

            try {
                context.Open();
                context.LogInfo(this, string.Format("/domain/{{id}}/owner POST Id='{0}', UserId='{1}'", request.Id, request.UserId));
                ThematicCommunity domain = ThematicCommunity.FromId(context, request.Id);
                UserTep           owner  = UserTep.FromId(context, request.UserId);
                domain.SetOwner(owner);

                result = new WebDomain(domain);

                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(result);
        }