It's all about the answers!

Ask a question

File Metadata - Java API

VK L (8177152159) | asked Apr 24 '15, 5:41 a.m.
edited May 04 '15, 8:03 a.m.
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.

Surya Tripathi commented May 08 '15, 8:25 p.m.

 I think you can use to set file time stamp and to set change set time stamp.

One answer

permanent link
K M (38324950) | answered May 20 '15, 2:37 p.m.
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.setFileTimestamp(new Date());

Your answer

Register or to post your answer.