It's all about the answers!

Ask a question

How to use "ChangeSets" for the last modification in the Source Control (Java API)


Bastian W (217) | asked Oct 08 '15, 9:53 a.m.
edited Oct 20 '15, 10:34 a.m. by Chris McGee (50511117)
Hi all,
 
i want to check in one project area under Source Control programmatically via Java API, if someone did a modification for example in the last 14 days.
At the Web GUI there is the feature "Advanced Search --> Change Sets --> Created After and Change Kind - modify". I want to use this principle in Java api, but only in ONE ProjectArea and not for all.

Has someone an example in java for using changesets? i can't find much about it.

Best regards!

2 answers



permanent link
Arun K Sriramaiah (3.2k13477) | answered Oct 08 '15, 10:56 a.m.
Hi Bastin,

You can use the below widget in your dashboard to see the project events.

Project and Team Events Displays a feed of project or team-related events, such as project, team, or artifact modification and other change events. Change and Configuration Management, Quality Management, Requirements Management

https://jazz.net/help-dev/clm/index.jsp?re=1&topic=/com.ibm.jazz.dashboard.doc/topics/c_widget_types.html&scope=null

Please let me know does it answered your question

Regards,
Arun.

Comments
Bastian W commented Oct 08 '15, 11:07 a.m.

Hi Arun,

many thx for your fast reply. So sorry, because i didn't mention that i mean to solve this problem programmatically via java api.

I fixed my topic and my question now.


permanent link
Chris McGee (50511117) | answered Oct 20 '15, 11:55 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Bastian,

It seems that you are interested in using the plain java client API's to interact with the server. There is an article here with some background material and a couple of downloadable examples:
https://jazz.net/library/article/1229

Now, to solve your particular problem it sounds like you want to be able to scan a project area to check all streams to see if there are any change sets delivered to the stream in the last 14 days.

First, you will need to find the streams that belong to the project area. You will first need an IWorkspaceManager. See the article above to see how to get one from a repository connection. The workspace manager has a "findWorkspaces()" method with a search criteria. You can set the criteria's kind to be "STREAM" so that it only finds streams and set ownerExactName to match the project area that you are interested in. Note: internally, repository workspaces and streams are both referred to as workspaces. that is why streams are returned as IWorkspaceHandles, just like repository workspaces.

Now, for each of the streams you will need to get a workspace connection for it. Again, use the workspace manager to getWorkspaceConnections() for the streams you retrieved earlier. With each connection you can call getComponents() to get the list of components and then use the connection to get changeHistory() for each of the components. You probably only need to look at the most recent in history because you're just looking for recent activity. Call recent() to get the list of recent IChangeHistoryEntrys. Each of the entries will have a date that you could check to see if it is newer than 14 days. An entry indicates a point in time that some user of the system performed some operation on the stream such as delivering change sets.

Keep in mind that these API's do put load on the server. You may want to avoid calling this script too frequently on large project areas. Also, it may be good to coordinate testing your script with your server administrator to avoid excessive load during peak usage times.

I hope that this helps,
Chris

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.