It's all about the answers!

Ask a question

Can I add Programatically created query in RTC Work Item Query ?


shweta ranaware (371641) | asked Jan 13 '16, 4:39 a.m.
 Hi All,
    I write code for create query using client API and I want to add that Programatically created query in RTC's  Work Items Option. can I add Programatically created query in RTC Work Item Query?

One answer



permanent link
Ralph Schoon (60.5k33643) | answered Jan 13 '16, 5:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Have you looked at com.ibm.team.workitem.common.IQueryCommon.save(IQueryDescriptor, IProgressMonitor) ?

Comments
shweta ranaware commented Jan 13 '16, 6:27 a.m.

I refer a Link https://jazz.net/wiki/bin/view/Main/QueryDevGuide.  In that example 2 :Find Potential Duplicates from the Command Line. which is standalone application. I suppose I want add that same query example in RTC client rather than execute on command Line. Is this Possible to add that  Program query in RTC  client. same Like  the Predefined query in RTC ?


Ralph Schoon commented Jan 13 '16, 6:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

That is not even a query, that is an Expression. From that expression, you could probably create a query and save it like this:

        IQueryCommon queryCommon = (IQueryCommon) teamRepository
                .getClientLibrary(IQueryCommon.class);
        IQueryDescriptor descriptor = queryCommon.createQuery(projectArea,
                "MyQuery Type " + workitemTypeID, "MyQuery Description",
                myExpression);
        queryCommon.save(descriptor, monitor);
      
        // OR
       IQueryClient queryClient = workItemClient.getQueryClient();
        queryClient.save(descriptor, monitor);

Your answer


Register or to post your answer.