Exemplo n.º 1
0
        public int AddTaxonomyGuidToWss(object site, TermInstance term, bool isKeywordField)
        {
            if (site == null || site == Undefined.Value || site == Null.Value)
            {
                throw new JavaScriptException(this.Engine, "Error", "A Site instance or url must be supplied as the first argument.");
            }

            if (term == null)
            {
                throw new JavaScriptException(this.Engine, "Error", "A term instance must be supplied as the second argument.");
            }

            SPSite spSite;
            var    dispose = false;

            if (site is SPSiteInstance)
            {
                spSite = (site as SPSiteInstance).Site;
            }
            else
            {
                spSite  = new SPSite(TypeConverter.ToString(site), SPBaristaContext.Current.Site.UserToken);
                dispose = true;
            }

            try
            {
                var result                 = -1;
                var taxonomyFieldType      = typeof(TaxonomyField);
                var miAddTaxonomyGuidToWss = taxonomyFieldType.GetMethod("AddTaxonomyGuidToWss",
                                                                         BindingFlags.NonPublic | BindingFlags.Static, null,
                                                                         new[] { typeof(SPSite), typeof(Term), typeof(bool) },
                                                                         null
                                                                         );

                if (miAddTaxonomyGuidToWss != null)
                {
                    result = (int)miAddTaxonomyGuidToWss.Invoke(null, new object[] { spSite, term.Term, isKeywordField });
                }

                return(result);
            }
            finally
            {
                if (dispose)
                {
                    spSite.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        public TermInstance ReuseTerm(TermInstance term, bool reuseBranch)
        {
            var reusedTerm = m_termSet.ReuseTerm(term.Term, reuseBranch);

            return(new TermInstance(Engine.Object.InstancePrototype, reusedTerm));
        }
Exemplo n.º 3
0
 public void ReassignSourceTerm(TermInstance reusedTerm)
 {
     m_term.ReassignSourceTerm(reusedTerm.m_term);
 }
Exemplo n.º 4
0
 public void Move(TermInstance newParentTerm)
 {
     m_term.Move(newParentTerm.m_term);
 }
Exemplo n.º 5
0
        public TermInstance Merge(TermInstance term)
        {
            var mergedTerm = m_term.Merge(term.m_term);

            return(new TermInstance(Engine.Object.InstancePrototype, mergedTerm));
        }
Exemplo n.º 6
0
 public bool GetIsDescendantOf(TermInstance term)
 {
     return(m_term.GetIsDescendantOf(term.m_term));
 }