1

I'm trying to access the filename, location and author of changed files for a given stream. Below code is what I have so far. Looking at the api documentation this does not seem possible? Can this be achieved using the java api or some other method ?

        IChangeSetSearchCriteria c = IChangeSetSearchCriteria.FACTORY.newInstance();
        WorkspaceManager mgr = (WorkspaceManager) SCMPlatform.getWorkspaceManager(repo);
        IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
        criteria.setKind(IWorkspaceSearchCriteria.STREAMS);
        criteria.setExactName("mystream"); 
4

1 回答 1

2

Note: try to not use the Stream name directly, as a Stream can be renamed or another Stream can have the same name.
See this thread for more.

If they're running on the command line, then you can take the UUID of the stream, create a handle from it and set the value in the search criteria (although you may want to fetch the stream first, since the user may have made a typo).

For going from a UUID to an ItemHandle

workspaceHandle = (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle(workspaceID, null);

Regarding listing the content of a changeset, this thread provides some clues:

If the versionable represents a file, it will be an instance of an IFileItem which has a content object associated with it.
You can get a stream to the contents from the content object.

Again, fetching the changeset (as in this thread) can be key to be sure to get all the data.


Note: taking the REST API route might be easier:
Your query is a POST

Request URL:https://jazzServer/jazz/oslc-scm/changeSet?jazz_scm:workspaceId=_OQt98EyrEeGAvYGjhK23_g&jazz_scm:maxResults=25&jazz_scm:changeKind=31
Request Method:POST
Cookie:SaveStateCookie=undefined%2Ccom.ibm.team.workitem.category%2Ccom.ibm.teamz.dsdef.category%2Ccom.ibm.team.dashboard.category%2Ccom.ibm.team.dashboard.category~%23_~%23com.ibm.team.dashboard.server.saveTeamDashboard; JSESSIONID=BF3DA3D5E0FCA16193876307E91A5471; JazzFormAuth=Form; net-jazz-ajax-cookie-rememberUserId=VonC; JSESSIONIDSSO=05626E20EC4F6DB231759EFC4DB69785
Host:jazzServer
Origin:https://jazzServer
Referer:https://jazzServer/jazz/web/projects/My%2°RTC%20Project

Form Dataview URL encoded
{"propertyRequest":{"jazz_scm:lastModified":null,"jazz_scm:creator":{"dcterms:name,rdf:resource":null},"jazz_scm:reasons":{"dcterms:title,rdf:resource":null},"jazz_scm:relatedArtifacts":{"dcterms:title,dcterms:description,rdf:resource,jazz_scm:linkTypeId,oslc_scm:mimeType":null}}}:

That will return:

{jazz_scm:firstTimestamp:1350975540822, jazz_scm:lastTimestamp:1350285276229,…}
jazz_scm:firstTimestamp: 1350975540822
jazz_scm:lastTimestamp: 1350285276229
jazz_scm:results: [{rdf:resource:https://jazzServer/jazz/oslc-scm/changeSetId/__KSygRzVEeK_Q6KSNVybvA,…},…]
    0: {rdf:resource:https://jazzServer/jazz/oslc-scm/changeSetId/__KSygRzVDeK_Q6KSNVybvA,…}
    dcterms:description: "Check-in of xslts into RTC taken from UAT server."
    dcterms:identifier: "itemOid/com.ibm.team.scm.ChangeSet/__KSygRzVDeK_Q6KSNVybvA"
    dcterms:modified: 1350975540822
    dcterms:name: null
    dcterms:type: "com.ibm.team.scm.changeSet"
    jazz_scm:creator: {,…}
        dcterms:description: null
        dcterms:identifier: "itemOid/com.ibm.team.repository.Contributor/_YakgYGUUEeCXgMjSYYyTpw"
        dcterms:modified: 1321511726283
        dcterms:name: "a User"
        dcterms:type: "com.ibm.team.scm.contributor"
    jazz_scm:itemId: "_YakgYGUUEeCXgMjSYYyTpw"
    jazz_scm:itemType: "com.ibm.team.repository.Contributor"
    prefixes: {dcterms:http://purl.org/dc/elements/1.1/, rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#,…}
    qname: "jazz_scm:Contributor"
    rdf:resource: "https://jazzServer/jazz/oslc-scm/itemOid/com.ibm.team.repository.Contributor/_YakgYGUUEeCXgMgSYYyTpw"
    jazz_scm:itemId: "__KSygRzVDeK_Q6KSNVybvA"
    jazz_scm:itemType: "com.ibm.team.scm.ChangeSet"
    jazz_scm:lastModified: null
    jazz_scm:reasons: [{rdf:resource:itemName/com.ibm.team.workitem.WorkItem/258061,…}]
    jazz_scm:relatedArtifacts: []
    prefixes: {dcterms:http://purl.org/dc/elements/1.1/, rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#,…}
    qname: "oslc_scm:ChangeSet"
    rdf:resource: "https://jazzServer/jazz/oslc-scm/changeSetId/__KSygRzVEeK_Q6KSNVybvA"
1: {rdf:resource:https://jazzServer/jazz/oslc-scm/changeSetId/_Pg_RMRwzEeK_Q6KSNVybvA,…}
2: {rdf:resource:https://jazzServer/jazz/oslc-scm/changeSetId/_3L3gcRwyEeK_Q6KSNVybvA,…}
....

With _OQt98EyrEeGAvYGjhK23_g the workspaceItemId of the Stream (a Stream is a Workspace with the element "stream" set to true!)

You can get the WorkspaceItemId of a Stream with the following query:

Request URL:https://jazzServer/jazz/service/com.ibm.team.scm.common.internal.rest.IScmRestService2/searchWorkspaces?workspaceName=A%20STREAM%20NAME&workspaceNameKind=partial%20ignorecase&maxResultSize=50&workspaceKind=both
Request Method:GET
Cookie:SaveStateCookie=undefined%2Ccom.ibm.team.workitem.category%2Ccom.ibm.teamz.dsdef.category%2Ccom.ibm.team.dashboard.category%2Ccom.ibm.team.dashboard.category~%23_~%23com.ibm.team.dashboard.server.saveTeamDashboard; JSESSIONID=BF3DA3D5E0FCA16193876307E91A5471; JazzFormAuth=Form; net-jazz-ajax-cookie-rememberUserId=VonC; JSESSIONIDSSO=05626E20EC4F6DB231759EFC4DB69785
Host:jazzServer
Referer:https://jazzServer/jazz/web/projects/A%20STREAM%20NAME
X-Requested-With:XMLHttpRequest
Query String Parametersview URL encoded
workspaceName:A STREAM NAME
workspaceNameKind:partial ignorecase
maxResultSize:50
workspaceKind:both

That will return results including:

<workspaces>
    <workspace itemId="_OQt98EyrEeGAvYGjhK23_g" properties="">
        <stateId>_-flUwBwpEeK_Q6KSNVybvA</stateId>
        <immutable>true</immutable>
        <contextId>_Dp6kMdwTEd2jUupDpEV1Rw</contextId>
        <modified>2012-10-32T10:22:18.766Z</modified>
        <name>A Stream Name</name>
        <stream>true</stream>
        <description>a stream</description>
        <time>109</time>
        <customContext xsi:nil="true"/>
        <normalizedName>a stream name</normalizedName>
        <readPermissionMode>0</readPermissionMode>
        <modifiedBy itemId="_Y70gkCYmEeGAvYGjhJ23_g"/>
        <owner itemId="_ICt_wDL6EeGeLde_4UGHCg" xsi:type="process:ProjectAreaHandle"/>
        <flows>
           ...
于 2012-10-22T17:54:13.770 回答