It's all about the answers!

Ask a question

RTC SDK: Giving names to the files uploaded


Rafael Hayama (15926) | asked Jan 21 '13, 8:03 a.m.
When uploading files into a repository using RTC Eclipse IDE it does not retain the original file name and asks the user to name it.

One customer created a RTC Eclipse plugin that uploads more than one file to a Work Item and noticed this same behaviour. He wants to know if there's any API that could be used in order to upload the file and keep its name.
 

2 answers



permanent link
SEC Servizi (97123559) | answered Jan 21 '13, 8:40 a.m.
edited Jan 21 '13, 8:45 a.m.
If this can helps you, we programmatically add new contributions to Build Results as:
File file = new File(path);
ITeamRepository repo = ...
IContent content = repo.contentManager().storeContent(IContent.CONTENT_TYPE_UNKNOWN, null, LineDelimiter.LINE_DELIMITER_NONE, inputStream, null, null);InputStream inputStream = new FileInputStream(file); IBuildResultContribution contribution = BuildItemFactory.createBuildResultContribution();  contribution.setComponentName(componentName);
contribution.setLabel(label);
contribution.setExtendedContributionTypeId(IBuildResultContribution.ARTIFACT_EXTENDED_CONTRIBUTION_ID);
contribution.setExtendedContributionProperty(IBuildResultContribution.PROPERTY_NAME_FILE_NAME, file.getName());
contribution.setExtendedContributionData(content);
ITeamBuildClient buildClient = (ITeamBuildClient) repo.getClientLibrary(ITeamBuildClient.class); IBuildResult buildResult = ...
buildClient.addBuildResultContribution(buildResult, contribution, null);
As you can see, we use the same filename from the input file:
contribution.setExtendedContributionProperty(IBuildResultContribution.PROPERTY_NAME_FILE_NAME, file.getName());
	


permanent link
Ralph Schoon (63.1k33645) | answered Jan 21 '13, 8:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi, this post describes the upload process. http://rsjazz.wordpress.com/2012/08/01/uploading-attachments-to-work-items/ . As far as I recall the name can be set. If I upload a file to a work item, the file name is typically kept.

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.