Topic
  • 2 replies
  • Latest Post - ‏2013-06-07T14:44:28Z by FrankKrout
FrankKrout
FrankKrout
8 Posts

Pinned topic How to retrieve categories associated to content from its DocumentID?

‏2013-06-06T21:53:16Z |

Please advise .... what am I missing?

WCM api delivers DocumentIdIterator when querying for content using Query Class API or workspace.FindByType (etc..)

How does one turn a DocumentId into a content object (or ContentComponentContainer) in order to use Content.getCategoryIds() ????

 

Thanks in advance!

 

 

 

  • cambri
    cambri
    1 Post
    ACCEPTED ANSWER

    Re: How to retrieve categories associated to content from its DocumentID?

    ‏2013-06-07T06:43:30Z  

    Frank,

     

    Content con = (Content) myworkspace.getById(cid);  -> cid is thd Document ID object

    DocumentId cid1[]=con.getCategoryIds();

    for(int i=0;i<cid1.length;i++)

    {

    Category cat=(Category)myworkspace.getById(cid1[i]);

    cat.getName();

    }

     

    Hope the above pseudo code helps !!

     

    Updated on 2013-06-07T06:47:59Z at 2013-06-07T06:47:59Z by cambri
  • FrankKrout
    FrankKrout
    8 Posts
    ACCEPTED ANSWER

    Re: How to retrieve categories associated to content from its DocumentID?

    ‏2013-06-07T14:44:28Z  
    • cambri
    • ‏2013-06-07T06:43:30Z

    Frank,

     

    Content con = (Content) myworkspace.getById(cid);  -> cid is thd Document ID object

    DocumentId cid1[]=con.getCategoryIds();

    for(int i=0;i<cid1.length;i++)

    {

    Category cat=(Category)myworkspace.getById(cid1[i]);

    cat.getName();

    }

     

    Hope the above pseudo code helps !!

     

    awesome, I thought a method call was needed to go from Document to Content instead of just casting the class.

     

    thanks

  • cambri
    cambri
    1 Post

    Re: How to retrieve categories associated to content from its DocumentID?

    ‏2013-06-07T06:43:30Z  

    Frank,

     

    Content con = (Content) myworkspace.getById(cid);  -> cid is thd Document ID object

    DocumentId cid1[]=con.getCategoryIds();

    for(int i=0;i<cid1.length;i++)

    {

    Category cat=(Category)myworkspace.getById(cid1[i]);

    cat.getName();

    }

     

    Hope the above pseudo code helps !!

     

    Updated on 2013-06-07T06:47:59Z at 2013-06-07T06:47:59Z by cambri
  • FrankKrout
    FrankKrout
    8 Posts

    Re: How to retrieve categories associated to content from its DocumentID?

    ‏2013-06-07T14:44:28Z  
    • cambri
    • ‏2013-06-07T06:43:30Z

    Frank,

     

    Content con = (Content) myworkspace.getById(cid);  -> cid is thd Document ID object

    DocumentId cid1[]=con.getCategoryIds();

    for(int i=0;i<cid1.length;i++)

    {

    Category cat=(Category)myworkspace.getById(cid1[i]);

    cat.getName();

    }

     

    Hope the above pseudo code helps !!

     

    awesome, I thought a method call was needed to go from Document to Content instead of just casting the class.

     

    thanks