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. |
One answer
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()); |
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.
Comments
I think you can use com.ibm.team.filesystem.common.IFileItem.setFileTimestamp() to set file time stamp and