Create hash map in ContentMap.java to hold file assets and binary maps temporally
When the content map is needs to load an image or binary we should have a hash map that stores (field name as a key and FileAsset or BinaryMap as a value) this way we just need to load the values once and not create additional calls to load an object multiple time when a user creates a vtol like:
#set($file = $dotcontent.find("4d7daefa-6adb-4b76-896d-c2d9f95b2280"))
uri: $file.fileAsset.uri
inode: $file.fileAsset.inode
identifier: $file.fileAsset.identifier
path: $file.fileAsset.path
mimeType: $file.fileAsset.mimeType
extension: $file.fileAsset.extension
fileSize: $file.fileAsset.fileSize
width: $file.fileAsset.width
height: $file.fileAsset.height
In the previous code each time a fileAsset object is load in memory, with this approach that we are propose, we will load the file asset object once and store it in the hash map, so the next time "fileAsset" field is called we get it from the hash map without creating a new instance of fileAsset.
The idea is to take this lines and not create a new instance each time when a "field" type "FileAsset" or "BinaryMap" is called using velocity, by doing this the system won't go twice to the file system when it requires height and width of an image or binary. Also, it can help with other fields of the image or binary.
If we do this enhancement we don't need to modify our documentation, like I propose in #7813
PR #8055
Fix is working well. Tested on dotcms 3.3 build // Win7 Pro SP1 // SQLServer 2012 // Firefox