Exemplo n.º 1
0
 /// <remarks/>
 public System.IAsyncResult Beginsearch(WSUserInfo wSUserInfo, WSSearchRequest wSSearchRequest, WSMetaDataQuery[] wSMetaDataQuerys, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("search", new object[] {
         wSUserInfo,
         wSSearchRequest,
         wSMetaDataQuerys
     }, callback, asyncState));
 }
Exemplo n.º 2
0
        public WSSearchResults sort(WSUserInfo wSUserInfo, WSSortRequest wSSortRequest)
        {
            object[] results = this.Invoke("sort", new object[] {
                wSUserInfo,
                wSSortRequest
            });

            return((WSSearchResults)(results[0]));
        }
Exemplo n.º 3
0
        public WSSearchResults page(WSUserInfo wSUserInfo, WSPageRequest wSPageRequest)
        {
            object[] results = this.Invoke("page", new object[] {
                wSUserInfo,
                wSPageRequest
            });

            return((WSSearchResults)(results[0]));
        }
Exemplo n.º 4
0
        public WSSearchResults search(WSUserInfo wSUserInfo, WSSearchRequest wSSearchRequest, WSMetaDataQuery[] wSMetaDataQuerys)
        {
            object[] results = this.Invoke("search", new object[] {
                wSUserInfo,
                wSSearchRequest,
                wSMetaDataQuerys
            });

            return((WSSearchResults)(results[0]));
        }
Exemplo n.º 5
0
        /// <summary>
        /// methods, which implement the computations and actions that can be
        /// performed by the class
        /// </summary>
        #region "### Public Methods  ###"

        public DataTable SearchDocuments(string partnerRole, string openTextValue, int productOid, int osOid, int componentOid, int[] docTypes, DateTime releaseDate, ref string searchID, string searchLanguage)
        {
            if ((openTextValue == null || openTextValue.Trim() == "") && (productOid == -1 || productOid == 0))
            {
                throw new SearchException(16, SearchException.ERROR_TYPE.INFORMATION, "Please Specify Alteast One Search Criteria : Key Value (or) Taxonomy Id");
            }

            if (docTypes == null || docTypes.Length == 0)
            {
                throw new SearchException(15, SearchException.ERROR_TYPE.INFORMATION, "Please Specify Atleast One Document Type To Search");
            }

            try
            {
                OracleUtil objOraUtil = new OracleUtil();
                // Release 8.7 Enhancement
                int[]  disclosureLevels = objOraUtil.GetDisclosurelevel(partnerRole);
                int [] odsDocTypeIDs    = null;

                HP.Csn.Business.KM.Services.SearchService.WSUserInfo wsUserInfo = new HP.Csn.Business.KM.Services.SearchService.WSUserInfo();
                wsUserInfo.userId           = base.userId;
                wsUserInfo.portalId         = base.portalId;
                wsUserInfo.disclosureLevels = disclosureLevels;

                // Temp fix : Send disclosure levels to entitlements as expected by CSR
                if (disclosureLevels != null)
                {
                    string [] tempDisclosureLevels = new string[disclosureLevels.Length];
                    for (int i = 0; i < disclosureLevels.Length; i++)
                    {
                        tempDisclosureLevels[i] = disclosureLevels[i].ToString();
                    }

                    // Temp fix
                    wsUserInfo.entitlements = tempDisclosureLevels;
                }

                WSSearchRequest wsSearchRequest = new WSSearchRequest();
                wsSearchRequest.query          = openTextValue.Trim();
                wsSearchRequest.searchCriteria = 0;
                wsSearchRequest.maxResults     = base.max_results;
                wsSearchRequest.resultsPerPage = base.results_per_page;

                if (searchLanguage == null && searchLanguage == "")
                {
                    searchLanguage = DEFAULT_LANGUAGE;
                }

                if (searchLanguage != null && searchLanguage != "")
                {
                    wsSearchRequest.searchLanguages = new string[] { searchLanguage }
                }
                ;

                if (docTypes.Length > 0)
                {
                    odsDocTypeIDs = new int[docTypes.Length];


                    OracleUtil obj1 = new OracleUtil();
                    odsDocTypeIDs = obj1.GetOdsDocumentTypes(docTypes);
                }
                wsSearchRequest.docTypes = odsDocTypeIDs;



                if (searchID != null && searchID != "")
                {
                    wsSearchRequest.searchId = searchID;
                }

                WSMetaDataQuery[] tempMdqs = new WSMetaDataQuery[3];                 // Maximun Metadata Query supported is 3
                int countMdq = 0;
                //start
                //By Ajit: to filter Original systems from the query while pulling the data from different systems.
                //e.g. -> string[] s = { "389", "391", "392", "2429", "2288", "2291", "2454" };
                string[] OriginalSystems = base.GetKmOriginalSystem();
                if (OriginalSystems != null)
                {
                    if (OriginalSystems.Length > 0)
                    {
                        WSMetaDataQuery SystemMdq = new WSMetaDataQuery();
                        SystemMdq.name       = "original_system"; //Parameter to filter system
                        SystemMdq.type       = 1;                 // 0 = text, 1 = taxo, 2 = date
                        SystemMdq.values     = OriginalSystems;   //array of systems to filter
                        tempMdqs[countMdq++] = SystemMdq;         //Making array of Parameter to webservice
                    }
                }
                //end

                // 1. Component metadata search
                if (componentOid != -1 && componentOid != 0)
                {
                    WSMetaDataQuery componentMdq = new WSMetaDataQuery();
                    componentMdq.name    = "main_component";
                    componentMdq.values  = new string[] { "" + componentOid };
                    tempMdqs[countMdq++] = componentMdq;
                }

                // 2. Content Update Date metadata search
                if (releaseDate.CompareTo(new DateTime(0)) != 0)
                {
                    WSMetaDataQuery dateMdq = new WSMetaDataQuery();
                    dateMdq.name         = "content_update_date";
                    dateMdq.values       = new string[] { releaseDate.ToString(), DateTime.Now.ToString() };
                    tempMdqs[countMdq++] = dateMdq;
                }

                // 3. OID metadata search for Product & OS search
                string[] pathOids = new string[2];
                int      countOid = 0;

                if (productOid != -1 && productOid != 0)
                {
                    pathOids[countOid++] = "" + productOid;
                }

                if (osOid != -1 && osOid != 0)
                {
                    pathOids[countOid++] = "" + osOid;
                }

                if (countOid != 0)
                {
                    WSMetaDataQuery oidMdq = new WSMetaDataQuery();
                    oidMdq.name = "path_oids";
                    if (countOid == 2)
                    {
                        oidMdq.values = pathOids;
                    }
                    else
                    {
                        oidMdq.values = new string[] { pathOids[0] }
                    };
                    tempMdqs[countMdq++] = oidMdq;
                }

                // copying tempMdqs to metaDataQuerys upto countMdq
                //Adding For Filter By Document_sataus-13.11-Start
                string[] WorkFlowStatuses = objOraUtil.workflowstate();
                if (WorkFlowStatuses != null)
                {
                    WSMetaDataQuery metaDataQuerysPublished = new WSMetaDataQuery();
                    metaDataQuerysPublished.name   = "workflow_state";
                    metaDataQuerysPublished.values = WorkFlowStatuses;
                    tempMdqs[countMdq++]           = metaDataQuerysPublished;
                }
                //Adding For Filter By Document_sataus-13.11-End

                WSMetaDataQuery[] metaDataQuerys = null;
                if (countMdq != 0)
                {
                    metaDataQuerys = new WSMetaDataQuery[countMdq];
                    for (int iCnt = 0; iCnt < countMdq; iCnt++)
                    {
                        metaDataQuerys[iCnt] = tempMdqs[iCnt];
                    }
                }

                WSSearchResults wsSearchResults = null;

                SearchService searchService = new SearchService();
                searchService.SetConnectionInfo(base.searchUrl, base.userId, base.userPassword, base.timeOut);

                wsSearchResults = searchService.search(wsUserInfo, wsSearchRequest, metaDataQuerys);

                if (wsSearchResults == null)
                {
                    throw new SearchException(13, SearchException.ERROR_TYPE.INFORMATION, "No Documents Found For Given Search Criteria");
                }

                WSSearchResult[] wsResult = wsSearchResults.results;
                if (wsResult == null || wsResult.Length == 0)
                {
                    throw new SearchException(14, SearchException.ERROR_TYPE.INFORMATION, "No Documents Found For Given Search Criteria");
                }

                searchID = wsSearchRequest.searchId;

                DataTable dtSearchResults = new DataTable();
                dtSearchResults.Columns.Add("DocID");
                dtSearchResults.Columns.Add("Title");
                dtSearchResults.Columns.Add("DocType");
                dtSearchResults.Columns.Add("Size");
                dtSearchResults.Columns.Add("Disclosurelvl");
                dtSearchResults.Columns.Add("LastUpdate", typeof(DateTime));

                for (int iCnt = 0; iCnt < wsResult.Length; iCnt++)
                {
                    DataRow row = dtSearchResults.NewRow();
                    row["DocID"] = wsResult[iCnt].docId;
                    string size    = wsResult[iCnt].docSize.ToString();
                    Int32  DocSize = Convert.ToInt32(size) / 1000;
                    size = "  (" + DocSize + "K)";
                    string title = System.Text.Encoding.UTF8.GetString(wsResult[iCnt].title);
                    row["Title"]         = title + size;
                    row["DocType"]       = wsResult[iCnt].docType.ToString();
                    row["Size"]          = wsResult[iCnt].docSize;
                    row["Disclosurelvl"] = wsResult[iCnt].disclosureLevel.ToString();
                    row["LastUpdate"]    = wsResult[iCnt].contentUpdateDate;

                    dtSearchResults.Rows.Add(row);
                }
                return(dtSearchResults);
            }


            catch (SoapException ex)
            {
                throw new SearchException(12, SearchException.ERROR_TYPE.INFORMATION, "Error While Searching for Documents. ERROR :" + ex.Message, ex);
            }
            catch (WebException ex)
            {
                throw new SearchException(11, SearchException.ERROR_TYPE.WARNING, "Error Connecting to Webservices. ERROR :" + ex.Message, ex);
            }
            catch (SearchException ex)
            {
                //Catching and throwing zero results found exception
                throw ex;
            }
            catch (Exception ex)
            {
                throw new SearchException(10, SearchException.ERROR_TYPE.WARNING, "Unexpected Error While Accessing Webservices. ERROR :" + ex.Message, ex);
            }
        }
Exemplo n.º 6
0
        public bool CheckKMSearchService(int oid, int[] docTypes, ref string searchId, ref int count, ref string errorMsg)
        {
            count    = -1;
            searchId = "";
            WSSearchResults wsSearchResults = null;

            int [] disclosureLevels = new int[4] {
                1, 3, 5, 7
            };

            try
            {
                HP.Csn.Business.KM.Services.SearchService.WSUserInfo wsUserInfo = new HP.Csn.Business.KM.Services.SearchService.WSUserInfo();
                wsUserInfo.userId           = base.userId;
                wsUserInfo.portalId         = base.portalId;
                wsUserInfo.disclosureLevels = disclosureLevels;

                WSSearchRequest wsSearchRequest = new WSSearchRequest();
                wsSearchRequest.query           = "Servers";
                wsSearchRequest.searchCriteria  = 0;
                wsSearchRequest.maxResults      = 100;
                wsSearchRequest.resultsPerPage  = 100;
                wsSearchRequest.docTypes        = docTypes;
                wsSearchRequest.searchLanguages = new string[] { DEFAULT_LANGUAGECODE };

                //WSMetaDataQuery[] metaDataQuerys = new WSMetaDataQuery[1]; // Maximum Metadata Query supported is 3
                WSMetaDataQuery[] metaDataQuerys = new WSMetaDataQuery[2]; // By Ajit: Increased the Array to support Original System filter.
                WSMetaDataQuery   oidMdq         = new WSMetaDataQuery();
                oidMdq.name       = "path_oids";
                oidMdq.values     = new string[] { "0" };
                metaDataQuerys[0] = oidMdq;
                //start
                //By Ajit: to filter Original systems from the query while pulling the data from different systems.
                //string[] systems = { "389", "391", "392", "2429", "2288", "2291", "2454" };
                string[] OriginalSystems = base.GetKmOriginalSystem();
                if (OriginalSystems != null)
                {
                    if (OriginalSystems.Length > 0)
                    {
                        WSMetaDataQuery SystemMdq = new WSMetaDataQuery();
                        SystemMdq.name    = "original_system";
                        SystemMdq.type    = 1;  // 0 = text, 1 = taxo, 2 = date
                        SystemMdq.values  = OriginalSystems;
                        metaDataQuerys[1] = SystemMdq;
                    }
                }
                //end

                SearchService searchService = new SearchService();
                searchService.SetConnectionInfo(base.searchUrl, base.userId, base.userPassword, base.timeOut);

                wsSearchResults = searchService.search(wsUserInfo, wsSearchRequest, metaDataQuerys);
            }
            catch (SoapException ex)
            {
                errorMsg = "Error While Searching for Documents. ERROR : (" + ex.Message + ")";
                return(false);
            }
            catch (WebException ex)
            {
                errorMsg = "Error Connecting to Webservices. ERROR : (" + ex.Message + ")";
                return(false);
            }
            catch (Exception ex)
            {
                errorMsg = "Unexpected Error While Accessing Webservices. ERROR : (" + ex.Message + ")";
                return(false);
            }

            count = 0;
            if (wsSearchResults == null)
            {
                errorMsg = "No Documents Found For Given Search Criteria";
            }
            else
            {
                searchId = wsSearchResults.searchId;
            }

            WSSearchResult[] wsResult = wsSearchResults.results;
            if (wsResult == null || wsResult.Length == 0)
            {
                errorMsg = "No Documents Found For Given Search Criteria";
            }
            else
            {
                count = wsResult.Length;
            }

            return(true);
        }