public Map<String, Object> migrateMetaData(Module jcrModule, AssetItem jcrAssetItem) {
/* System.out.format(" Metadata: Asset [%s] with format [%s] is being migrated... \n",
jcrAssetItem.getName(), jcrAssetItem.getFormat()); */
//avoid using RepositoryAssetService as it calls assets' content handler
Metadata metadata = new Metadata();
List<DiscussionRecord> discussions = new Discussion().fromString(jcrAssetItem.getStringProperty(Discussion.DISCUSSION_PROPERTY_KEY));
if (discussions.size() != 0) {
//final org.kie.commons.java.nio.file.Path nioPath = paths.convert( path );
for (DiscussionRecord discussion : discussions) {
metadata.addDiscussion(new org.guvnor.common.services.shared.metadata.model.DiscussionRecord(discussion.timestamp, discussion.author, discussion.note));
}
}
//System.out.format(" Metadata: setDescription... \n" + jcrAssetItem.getDescription());
metadata.setDescription(jcrAssetItem.getDescription());
metadata.setSubject(jcrAssetItem.getSubject());
metadata.setExternalRelation(jcrAssetItem.getExternalRelation());
metadata.setExternalSource(jcrAssetItem.getExternalSource());
List<CategoryItem> jcrCategories = jcrAssetItem.getCategories();
for (CategoryItem c : jcrCategories) {
//System.out.format(" Metadata: addCategory... \n" + c.getFullPath());
metadata.addCategory(c.getFullPath());
}
Path path = migrationPathManager.generatePathForAsset(jcrModule, jcrAssetItem);
return metadataService.setUpAttributes(path, metadata);