Beispiel #1
0
        public bool CheckKMTaxonomyService(int oid, ref int count, ref string errorMsg)
        {
            count = -1;
            WSPMNode[] nodes = null;
            try
            {
                TaxonomyService taxonomyService = new TaxonomyService();
                taxonomyService.SetConnectionInfo(base.taxonomyUrl, base.userId, base.userPassword, base.timeOut);

                HP.Csn.Business.KM.Services.TaxonomyService.WSUserInfo wsUserInfo = new HP.Csn.Business.KM.Services.TaxonomyService.WSUserInfo();
                wsUserInfo.userId   = base.userId;
                wsUserInfo.portalId = base.portalId;
                //wsUserInfo.protalId = base.portalId;

                WSPMRequest pmRequest = new WSPMRequest();
                pmRequest.oid    = oid;
                pmRequest.locale = DEFAULT_LANGUAGECODE;

                nodes = taxonomyService.retrievePMSubtree(wsUserInfo, pmRequest);
            }
            catch (SoapException ex)
            {
                errorMsg = "Error While Retrieving Taxonomy : (" + ex.Message + ")";
                return(false);
            }
            catch (System.Net.WebException ex)
            {
                errorMsg = "Error Connecting To Webservices : (" + ex.Message + ")";
                return(false);
            }
            catch (Exception ex)
            {
                errorMsg = "Unexpected Error While Accessing Webservices. ERROR : (" + ex.Message + ")";
                return(false);
            }

            count = 0;
            if (nodes != null && nodes.Length != 0)
            {
                count = nodes.Length;
            }
            else
            {
                errorMsg = "Taxonomy Not Available For Given OID :" + oid;
            }

            return(true);
        }
Beispiel #2
0
        private DataTable BuildCVTaxonomy(string partnerRole)
        {
            TaxonomyService taxonomyService = new TaxonomyService();

            taxonomyService.SetConnectionInfo(base.taxonomyUrl, base.userId, base.userPassword, base.timeOut);

            WSUserInfo wsUserInfo = new WSUserInfo();

            wsUserInfo.userId   = base.userId;
            wsUserInfo.portalId = base.portalId;

            OracleUtil objOraUtil = new OracleUtil();

            wsUserInfo.disclosureLevels = objOraUtil.GetDisclosurelevel(partnerRole);

            WSCVRequest cvRequest = new WSCVRequest();

            cvRequest.taxoId = base.component_root_oid;           //COMPONENT_ROOT_OID;
            cvRequest.locale = DEFAULT_LANGUAGECODE;              // Release 8.7 Enhancement
            WSCVNode[] nodes = null;
            try
            {
                nodes = taxonomyService.retrieveCV(wsUserInfo, cvRequest);
            }
            catch (SoapException ex)
            {
                throw new TaxonomyException(3, TaxonomyException.ERROR_TYPE.INFORMATION, "Error While Retrieving Taxonomy", ex.Message, ex);
            }
            catch (System.Net.WebException ex)
            {
                throw new TaxonomyException(2, TaxonomyException.ERROR_TYPE.WARNING, "Error Connecting To Webservices", ex.Message, ex);
            }
            catch (Exception ex)
            {
                throw new TaxonomyException(1, TaxonomyException.ERROR_TYPE.WARNING, "Unexpected Error While Retrieving Taxonomy", ex.Message, ex);
            }

            if (nodes == null || nodes.Length == 0)
            {
                throw new TaxonomyException(4, TaxonomyException.ERROR_TYPE.INFORMATION, "Taxonomy Not Available For Given OID", "OID Node Is Empty");
            }

            DataTable retTaxonomy = CreateTaxonomyTable();

            for (int iCnt = 0; iCnt < nodes.Length; iCnt++)
            {
                DataRow row = retTaxonomy.NewRow();
                row["OID"]         = nodes[iCnt].oid;
                row["ParentID"]    = nodes[iCnt].parents[0];
                row["Description"] = nodes[iCnt].displayName;
                retTaxonomy.Rows.Add(row);
            }
            //sorting & storing...
            DataView dvSortedTaxonomy = new DataView(retTaxonomy);

            dvSortedTaxonomy.Sort = "Description";
            DataTable dtSortedTaxonomy = CreateTaxonomyTable();

            for (int iCnt = 0; iCnt < dvSortedTaxonomy.Count; iCnt++)
            {
                DataRow row = dtSortedTaxonomy.NewRow();
                row["OID"]         = dvSortedTaxonomy[iCnt]["OID"];
                row["ParentID"]    = dvSortedTaxonomy[iCnt]["ParentID"];
                row["Description"] = dvSortedTaxonomy[iCnt]["Description"];
                dtSortedTaxonomy.Rows.Add(row);
            }


            DateTime d          = DateTime.Now;
            DateTime d1         = new DateTime(d.Year, d.Month, d.Day, base.expiration_hrs, base.expiration_min, base.expiration_sec);
            long     expiration = (d1.Ticks - d.Ticks);

            if (expiration < 0)
            {
                expiration = TimeSpan.TicksPerDay + expiration;
            }
            expiration = expiration / TimeSpan.TicksPerSecond;
            int absoluteExpiration = Convert.ToInt32(expiration);
            int noSliding          = Cache.NoSlidingExpiration.Seconds;

            chTaxonomy.Insert("CSN_KM_TAXONOMY", "Taxonomy_CV", dtSortedTaxonomy, null, absoluteExpiration, noSliding);

            return(dtSortedTaxonomy);
        }
Beispiel #3
0
        /// <summary>
        /// methods, which implement the computations and actions that can be
        /// performed by the class
        /// </summary>
        #region "### Private Methods  ###"

        private DataTable BuildTaxonomy(int oid, int level, string partnerRole)
        {
            TaxonomyService taxonomyService = new TaxonomyService();

            taxonomyService.SetConnectionInfo(base.taxonomyUrl, base.userId, base.userPassword, base.timeOut);

            WSUserInfo wsUserInfo = new WSUserInfo();

            wsUserInfo.userId   = base.userId;
            wsUserInfo.portalId = base.portalId;

            OracleUtil objOraUtil = new OracleUtil();

            // Release 8.7 Enhancement
            wsUserInfo.disclosureLevels = objOraUtil.GetDisclosurelevel(partnerRole);

            WSPMRequest pmRequest = new WSPMRequest();

            pmRequest.oid    = oid;
            pmRequest.locale = DEFAULT_LANGUAGECODE;

            WSPMNode[] nodes = null;
            try
            {
                nodes = taxonomyService.retrievePMSubtree(wsUserInfo, pmRequest);
            }
            catch (SoapException ex)
            {
                throw new TaxonomyException(3, TaxonomyException.ERROR_TYPE.INFORMATION, "Error While Retrieving Taxonomy", ex.Message, ex);
            }
            catch (System.Net.WebException ex)
            {
                throw new TaxonomyException(2, TaxonomyException.ERROR_TYPE.WARNING, "Error Connecting To Webservices", ex.Message, ex);
            }
            catch (Exception ex)
            {
                throw new TaxonomyException(1, TaxonomyException.ERROR_TYPE.WARNING, "Unexpected Error While Retrieving Taxonomy", ex.Message, ex);
            }

            if (nodes == null || nodes.Length == 0)
            {
                throw new TaxonomyException(4, TaxonomyException.ERROR_TYPE.INFORMATION, "Taxonomy Not Available For Given OID", "OID Node Is Empty");
            }

            DataTable retTaxonomy = CreateTaxonomyTable();

            for (int iCnt = 0; iCnt < nodes.Length; iCnt++)
            {
                if (nodes[iCnt].level == level)
                {
                    DataRow row = retTaxonomy.NewRow();
                    row["OID"]         = nodes[iCnt].oid;
                    row["ParentID"]    = oid;
                    row["Description"] = nodes[iCnt].displayName;
                    retTaxonomy.Rows.Add(row);
                }
            }
            // Sort taxonomy on description column
            DataView  dvSortedTaxonomy = new DataView(retTaxonomy, null, "Description", DataViewRowState.CurrentRows);
            DataTable dtSortedTaxonomy = CreateTaxonomyTable();

            for (int iCnt = 0; iCnt < dvSortedTaxonomy.Count; iCnt++)
            {
                DataRow row = dtSortedTaxonomy.NewRow();
                row["OID"]         = dvSortedTaxonomy[iCnt]["OID"];
                row["ParentID"]    = dvSortedTaxonomy[iCnt]["ParentID"];
                row["Description"] = dvSortedTaxonomy[iCnt]["Description"];
                dtSortedTaxonomy.Rows.Add(row);
            }

            if (oid == 0)
            {
                DateTime d          = DateTime.Now;
                DateTime d1         = new DateTime(d.Year, d.Month, d.Day, base.expiration_hrs, base.expiration_min, base.expiration_sec);
                long     expiration = (d1.Ticks - d.Ticks);
                if (expiration < 0)
                {
                    expiration = TimeSpan.TicksPerDay + expiration;
                }
                expiration = expiration / TimeSpan.TicksPerSecond;
                int absoluteExpiration = Convert.ToInt32(expiration);
                int noSliding          = Cache.NoSlidingExpiration.Seconds;

                chTaxonomy.Insert("CSN_KM_TAXONOMY", "Taxonomy_" + oid, dtSortedTaxonomy, null, absoluteExpiration, noSliding);
            }
            else
            {
                CacheDependency cDep = new CacheDependency(null, new string[] { "CSN_KM_TAXONOMY" + ":" + "Taxonomy_0" });
                chTaxonomy.Insert("CSN_KM_TAXONOMY", "Taxonomy_" + oid, dtSortedTaxonomy, cDep);
            }

            return(dtSortedTaxonomy);
        }