我试图访问文件名称,位置和被修改的文件的作者对于给定的流。 下面的代码是我到目前为止所。 综观API文档这似乎并不可能吗? 可以这样使用Java API或一些其他方法来实现?
IChangeSetSearchCriteria c = IChangeSetSearchCriteria.FACTORY.newInstance();
WorkspaceManager mgr = (WorkspaceManager) SCMPlatform.getWorkspaceManager(repo);
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
criteria.setKind(IWorkspaceSearchCriteria.STREAMS);
criteria.setExactName("mystream");
注意:尽量不要直接使用流名称,作为流可以重命名或其他流可以具有相同的名称。
见这个线程更多。
如果他们在命令行中运行,那么你可以把流的UUID,从它创建一个手柄,并设置搜索条件的值(虽然你可能希望先取流,因为用户可能已经做出一个错字)。
对于从UUID去的ItemHandle
workspaceHandle = (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle(workspaceID, null);
关于上市一个变更的内容, 这个线程提供了一些线索:
如果版本化表示一个文件,这将是一个实例IFileItem
具有与其相关联的内容的对象。
你可以得到一个流从内容对象的内容。
同样,获取的变更(在这个线程 ),可关键是一定要得到的所有数据。
注:服用REST API的路线可能会更容易:
您的查询是一个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}}}:
这将返回:
{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,…}
....
随着_OQt98EyrEeGAvYGjhK23_g
的workspaceItemId
了数据流的 (一个数据流与元素“工作区stream
”设置为true!)
你可以用下面的查询流的WorkspaceItemId:
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
这将返回结果包括:
<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>
...
文章来源: Getting filename, location and author of changed files using RTC source control