It's all about the answers!

Ask a question

Can I obtain and download a file from source control if I have the URL using a state transition or save on a work item?


Angela Borchard (70820) | asked Jun 12 '15, 1:36 a.m.

Hi,

I have a work item type called A and this contains a field which is a URL to a file in source control within RTC.

Is it possible (via a plugin or other mechanism) to extract (copy) this file and publish to a location such as C:\

This would be triggered on SAVE or STATE CHANGE of a work item.

Thanks!

2 answers



permanent link
Ralph Schoon (55.8k23642) | answered Jun 12 '15, 2:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This should theoretically be possible.

However, where is the location? Do you write a server follow up action? Do you write a client follow up action? Can you access the location from within the context of the application server or client?

permanent link
Angela Borchard (70820) | answered Jul 20 '15, 9:34 p.m.
edited Jul 21 '15, 2:59 a.m.


I am writing a server participant where the output location is C:\output (for example).

Do you know of any examples of downloading a file from a URL via a server side (participant)?

eg URL =

https://localhost:7443/jazz/web/projects/JP2047#action=com.ibm.team.scm.viewChangeSetItem&contextItemId=&contextItemType=com.ibm.team.scm.Workspace&componentItemId=_TxNZICI0EeW-mdsed6wq4A&itemType=com.ibm.team.filesystem.FileItem&itemId=_QegBcC9JEeW6da1zRid3Tw&stateId=_Qen9RC9JEeW6da1zRid3Tw


When clicking on the Download link, the URL becomes:

https://localhost:7443/jazz/service/com.ibm.team.filesystem.service.internal.rest.IFilesystemContentService/-/_TxNZICI0EeW-mdsed6wq4A/README.doc?itemId=_QegBcC9JEeW6da1zRid3Tw&stateId=_Qen9RC9JEeW6da1zRid3Tw&platformLineDelimiter=CRLF

Using the values obtained from the URL.....

String componentItemID_String = "_TxNZICI0EeW-mdsed6wq4A"; 

String itemID_String = "_XK9kUC9HEeW6da1zRid3Tw";

String stateID_String = "_Qen9RC9JEeW6da1zRid3Tw";

// createItemHandle(Item ID, State ID)
IItemHandle itemHandle = IComponent.ITEM_TYPE.createItemHandle(UUID.valueOf(itemID_String), UUID.valueOf(stateID_String));

???

How to get the file content?


Thanks!

Comments
Ralph Schoon commented Jul 21 '15, 2:50 a.m. | edited Jul 21 '15, 2:50 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

All examples are in my blog. There is no server side extension that downloads a file. Download is typically also something that is in the client API. You will have to find out if that is possible on your own.

Please note that for security reasons, the application container also typically limits where a WEB application can write on disk.

Your answer


Register or to post your answer.