It's all about the answers!

Ask a question

Listing archived categories using java client api?


Ajay Mallikarjunaiah (148410) | asked May 22 '14, 4:26 a.m.
edited May 22 '14, 4:27 a.m.
Hi,
There are apis to list down all the categories for a given project area. But those apis wont list the archived categories. Is there any way to list all the categories for a given project area including the archived ones.
Any input(s) is/are  appreciated.
Thank you in advance.
Ajay

One answer



permanent link
Ajay Mallikarjunaiah (148410) | answered May 22 '14, 5:51 a.m.
Hi Again,

Following method did it for me.

public void listAllCategories(String projectAreaName)
            throws TeamRepositoryException {
        //Project Area
       
        IProjectArea projectArea = getProjectArea(projectAreaName);
       
        //Auditable client
       
        IAuditableClient auditableClient = (IAuditableClient) repo
                .getClientLibrary(IAuditableClient.class);
       
        //List of all existing categories. This will include all the visible, access restricted and archived categories.
        //In other words, every other category which was created.
       
        List<ICategoryHandle> allCategoryHandles = CategoriesHelper
                .findExistingCategories(auditableClient, projectArea, monitor);
        for (ICategoryHandle iCategoryHandle : allCategoryHandles) {
            System.out.println(iCategoryHandle.getItemId());
        }
   
    }

I'm printing only the itemId of ICategoryHandle. If you want to get the corresponding item. Please go through following link.
https://jazz.net/forum/questions/124752/how-to-get-object-from-handle-using-rtc-java-api


Your answer


Register or to post your answer.