Esempio n. 1
0
        /// <summary>
        /// content with given details
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public object DeleteContent(string projUri)
        {
            Logger.Info("Entering DeleteProject");
            //Call ML and Put the project xml
            string   mlUrl    = ConfigurationManager.AppSettings["MarkLogicResourceURL"] + "content?name=content&rs:uri=" + projUri;
            MLReader mlReader = new MLReader();
            string   results  = mlReader.HttpInvoke(mlUrl, SupportedHttpMethods.DELETE, "application/json");

            Logger.Debug("Logging results for DeleteContent with mlUrl");
            Logger.Info("Exiting DeleteProject");
            return(mlReader.ConverttoJson <object>(results));
        }
Esempio n. 2
0
        /// <summary>
        /// CreateContent with given details
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public object UploadMetadata(string metadata)
        {
            Logger.Info("Entering UploadMetadata");

            string   mlUrl    = ConfigurationManager.AppSettings["MarkLogicResourceURL"] + "content?name=content";
            MLReader mlReader = new MLReader();
            string   results  = mlReader.HttpInvoke(mlUrl, SupportedHttpMethods.POST, "application/json", metadata);

            Logger.Debug("Logging results for UploadMetadata with mlUrl");
            Logger.Info("Exiting UploadMetadata");
            return(mlReader.ConverttoJson <object>(results));
        }
Esempio n. 3
0
        /// <summary>
        /// delete the Project with given details
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        public object DeleteProject(string projUri)
        {
            Logger.Info("Entry DeleteProject");

            //Post it to MarkLogic
            string   mlUrl    = ConfigurationManager.AppSettings["MarkLogic_CRUD_URL"] + "project?name=project&rs:format=json&rs:uri=" + projUri;
            MLReader mlReader = new MLReader();
            string   results  = mlReader.HttpInvoke(mlUrl, SupportedHttpMethods.DELETE, "application/json");

            Logger.Debug("Logging Results for DeleteProject with mlUrl");
            Logger.Info("Exiting DeleteProject");
            return(mlReader.ConverttoJson <object>(results));
        }
Esempio n. 4
0
        /// <summary>
        /// Get project details with given details
        /// </summary>
        /// <param name="uri"></param>
        /// <returns></returns>
        public object GetProjectDetails(string uri)
        {
            Logger.Info("Entering GetProjectDetails");

            MLReader mlReader = new MLReader();

            //get Marklogic url for CRUD operations
            string mlUrl   = ConfigurationManager.AppSettings["MarkLogic_CRUD_URL"] + "project?name=project&rs:uri=" + uri + "&rs:format=json";
            string results = mlReader.GetHttpContent(mlUrl, "application/json");

            Logger.Debug("Logging Results for GetProjectDetails with mlUrl");
            Logger.Info("Exiting GetProjectDetails");
            return(mlReader.ConverttoJson <object>(results));
        }
Esempio n. 5
0
        /// <summary>
        /// update the project with given details
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        public object UpdateProject(string projXml, string projUri)
        {
            Logger.Info("Entering UpdateProject");
            //Call ML and Put the project xml

            //Post it to MarkLogic
            string   mlUrl    = ConfigurationManager.AppSettings["MarkLogic_CRUD_URL"] + "project?name=project&rs:format=json&rs:uri=" + projUri;
            MLReader mlReader = new MLReader();
            string   results  = mlReader.HttpInvoke(mlUrl, SupportedHttpMethods.PUT, "application/json", projXml);

            Logger.Debug("Logging Results for UpdateProject with mlUrl");
            Logger.Info("Exitinging UpdateProject");
            return(mlReader.ConverttoJson <object>(results));
        }
Esempio n. 6
0
        /// <summary>
        /// Search Project for the given details
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public object SearchProjects(string searchText, int pageNumber, int pageSize, string orderBy)
        {
            //Call ML and SearchProjects
            Logger.Info("Entering SearchProjects");
            JsonNetSerialization ser      = new JsonNetSerialization();
            MLReader             mlReader = new MLReader();

            searchText = System.Web.HttpContext.Current.Server.UrlEncode(searchText);
            //get Marklogic url for CRUD operations
            string mlUrl   = ConfigurationManager.AppSettings["MarkLogic_CRUD_URL"] + "project?name=project&rs:q=" + searchText + "&rs:format=json";
            string results = mlReader.GetHttpContent(mlUrl, "application/json");

            Logger.Debug("Logging Results for SearchProjects with pageNumber, pageSize in mlUrl");
            Logger.Info("Exiting SearchProjects");
            return(mlReader.ConverttoJson <object>(results));
        }
Esempio n. 7
0
        /// <summary>
        /// GetData for search data with given details
        /// </summary>
        /// <param name="orderBy"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="searchText"></param>
        /// <param name="searchType"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public object GetData(string orderBy, int pageNumber, int pageSize, string searchText, string searchType, string userName, string[] facets)
        {
            //Call ML and SearchProjects
            Logger.Info("Entering SearchData");

            MLReader mlReader = new MLReader();

            //get Marklogic url for CRUD operations
            pageNumber = ((pageNumber - 1) * pageSize) + 1;
            string facetsParam = string.Empty;

            if (searchText != string.Empty && searchText != null)
            {
                searchText = "" + searchText + "";
            }

            if (facets != null)
            {
                if (searchText != string.Empty && searchText != null)
                {
                    searchText = searchText + " AND ";
                }
                searchText = searchText + string.Join(" AND ", facets);
            }

            searchText = System.Web.HttpContext.Current.Server.UrlEncode(searchText);

            if (searchType == "all")
            {
                searchType = "search";
            }

            if (orderBy == null)
            {
                orderBy = "relevance";
            }

            string mlUrl   = ConfigurationManager.AppSettings["MarkLogic_CRUD_URL"] + searchType + "?name=" + searchType + "&rs:q=" + searchText + "&rs:format=json&rs:pageLength=" + pageSize + "&rs:start=" + pageNumber + "&rs:sort=" + orderBy;
            string results = mlReader.GetHttpContent(mlUrl, "application/json");

            Logger.Debug("Logging Results for GetData with mlUrl");
            Logger.Info("Exiting SearchData");
            return(mlReader.ConverttoJson <object>(results));
        }