It's all about the answers!

Ask a question

Querying RTC SCM data with wildcard characters and regular expressions

Sagar U (814) | asked May 31 '16, 4:57 a.m.
Trying to fetch only components,baselines matching the searched name pattern in a repository via RTC Plain Java API.
Didn't find any direct API to find components using wildcard character and regular expressions
     eg:-  [ *_comp ] ,  *_comp*   etc.

Always a code should fetch “n” number of components using methods inside WorkspaceManager and then apply additional logic to filter the searched result.

Is there any other mechanism or data source available using which we can query RTC SCM data to fetch the desired result directly ?.

Accepted answer

permanent link
Shashikant Padur (4.2k27) | answered Jun 10 '16, 2:56 a.m.
edited Jun 10 '16, 2:59 a.m.
I suggested the % and _ to be tried on pre 601 client. Since you are on 601 you can ignore that comment.

From what you have listed... isn't * and ? working as expected unless I am missing something obvious.

Sagar U selected this answer as the correct answer

Sagar U commented Jun 10 '16, 7:43 a.m.

Ok , thank you for the clarification.
Are any other wild card or regular expression patterns also supported along with  * and  ?.

One other answer

permanent link
Shashikant Padur (4.2k27) | answered Jun 07 '16, 4:44 a.m.
Which version of the client SDK are you using?
I believe pre 601 it matched all components starting with the provided name and did not consider wild card characters such as '*' or '?'. Can you try using '%' instead of '*' and '_' instead of '?'.

Sagar U commented Jun 10 '16, 2:45 a.m.

We are using Verison 6.0.1.ifix003
Yes "Starting with"  works for all versions of rtc sdk
Details of API used:

WorkspaceManager.findComponents(criteria, Integer.MAX_VALUE, null);

Results obtained is always random and not as expected, only starts with name pattern works as expected.

From a list of following components in a repo
TestPA Default Component

if criteria.setPartialNameIgnoreCase
")       - All components were fetched
("%")     - Empty result
("A")     - All components were fetched
("%A")   - Empty result
("A?C")  - ABC
C")   - ABC , A.B.C
("A%C")  - Empty result
("A_C") -  Empty result
("A*")    -  ABC , A.B.C , A.B , A

any suggestions ?

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.