Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

File Metadata - Java API

Hi All,
Is it possible to set metadata info like creation date, check-in/deliver date using Java API - while importing files via Java API. This is to keep the metadata info intact while migrating files from another tool, for example.
Please advise.

0 votes

Comments

 I think you can use com.ibm.team.filesystem.common.IFileItem.setFileTimestamp() to set file time stamp and 

com.ibm.team.scm.common.internal.ChangeSet.setLastUpdatedDate() to set change set time stamp.



One answer

Permanent link
IFileContentManager contentManager = FileSystemCore.getContentManager(repo); 

storecontent lets you set encoding and line feed

IFileContent newcontent = contentManager.storeContent(content.getCharacterEncoding(),content.getLineDelimiter(),
                    new VersionedContentManagerByteArrayInputStreamPovider(FileUtils.readFileToByteArray(tmpfile)),null, MONITOR); 

IFileItem should let you set the date

// Get Working copy
                file = (IFileItem) file.getWorkingCopy();
                file.setContent(storedContent);
                file.setFileTimestamp(new Date());
     

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,948

Question asked: Apr 24 '15, 5:41 a.m.

Question was seen: 3,180 times

Last updated: May 20 '15, 2:37 p.m.

Confirmation Cancel Confirm