Not able to find stream using server side scm java api
Hello everyone,
I am using CLM 606.
I have created a plugin to duplicate a stream.
IWorkspaceSearchCriteria search = IWorkspaceSearchCriteria.FACTORY.newInstance().setKind(IWorkspaceSearchCriteria.STREAMS);
search.setExactName(MajorMinorStream);
ItemQueryResult foundStream = ScmQueryservice.findWorkspaces(search, Integer.MAX_VALUE, null);
try {
if (foundStream != null) {
DestworkspaceHandle = (IWorkspaceHandle)foundStream.getItemHandles().get(0); // Move to catch through this statement error index=0,size=0
}
We have created team area per application and added APP RM role to APP RM_1 user.
And then I have used below code to find the streamusing ITPM role(ITPM_1).
I am able to get stream using above code for few applications but it fails for few applications.
Please let me know if I missed anything wrong in code.
Thanks in Advance
Pallavi Deore
2 answers
Ideas:
-The user that is running the query (logged in user) might not have read access to the stream. To confirm this, login as this user in either the web or Eclipse client, and see if you can open the stream that you cannot find.
-The missing streams might have been renamed since creation, and perhaps you are searching by the wrong name (since your query is using .setExactName()
Also when you said "fails for a few applications", what exactly does this mean? Do you just mean the query runs fine without exceptions, but the return result is empy?
Comments
Hello David,
We have created 4 team areas for 4 application and we have assigned application wise TQC_Major stream per Team area eg: If my application in DCP then we have assigned DCP team as owned by to DCP_TQC_Major_stream and Team Private as visibility and if my application is POP then we have assigned POP team as owned by to POP_TQC_Major_Stream and kept Team Private as visibility.
I have added APP RM to all Team areas so only APP RM will have read access to this Streams means only APP RM can view all application streams. I have condition that I have to change state of work item using ITPM role which don't have read access to streams and plugin will invoke once ITPM will change the state of work item.but still for few application like RDP,POP ( Read access only to APP RM role) can able to find stream using above code and for DCP and DSQ not able to find stream.
The code that I can see in the SDK
- Checks the ItemQueryResult is not null
- Checks that ItemQueryResult.getItemHandles() is not empty.
So your code above does not do all the checks. Fix that.
As David states you can only find where you have access permissions. Repository workspaces are usually owned by a user and very often not visible to other users. Streams could be not visible as well. You have to have a JazzAdmin repository permission to be able to see (and query for) all the repository workspaces and streams.