public static void setFileProperties ( final File file , final String contentType ) throws IOException , FrameworkException { final java . io . File fileOnDisk = file . getFileOnDisk ( false ) ; final PropertyMap map = new PropertyMap ( ) ; map . put ( StructrApp . key ( File . class , "contentType" ) , contentType != null ? contentType : FileHelper . getContentMimeType ( fileOnDisk , file . getProperty ( File . name ) ) ) ; map . put ( StructrApp . key ( File . class , "size" ) , FileHelper . getSize ( fileOnDisk ) ) ; map . put ( StructrApp . key ( File . class , "version" ) , 1 ) ; map . putAll ( getChecksums ( file , fileOnDisk ) ) ; file . setProperties ( file . getSecurityContext ( ) , map ) ; }
Set the contentType checksum size and version properties of the given fileNode