public static Map < String , String > createContentProperties ( String absolutePath , String creator ) { Map < String , String > props = new HashMap < String , String > ( ) ; if ( creator != null && creator . trim ( ) . length ( ) > 0 ) { props . put ( StorageProvider . PROPERTIES_CONTENT_CREATOR , creator ) ; } props . put ( StorageProvider . PROPERTIES_CONTENT_FILE_PATH , absolutePath ) ; try { Path path = FileSystems . getDefault ( ) . getPath ( absolutePath ) ; BasicFileAttributes bfa = Files . readAttributes ( path , BasicFileAttributes . class ) ; String creationDate = DateUtil . convertToStringLong ( bfa . creationTime ( ) . toMillis ( ) ) ; props . put ( StorageProvider . PROPERTIES_CONTENT_FILE_CREATED , creationDate ) ; String lastAccessed = DateUtil . convertToStringLong ( bfa . lastAccessTime ( ) . toMillis ( ) ) ; props . put ( StorageProvider . PROPERTIES_CONTENT_FILE_LAST_ACCESSED , lastAccessed ) ; String modified = DateUtil . convertToStringLong ( bfa . lastModifiedTime ( ) . toMillis ( ) ) ; props . put ( StorageProvider . PROPERTIES_CONTENT_FILE_MODIFIED , modified ) ; } catch ( IOException ex ) { log . error ( "Failed to read basic file attributes from " + absolutePath + ": " + ex . getMessage ( ) , ex ) ; } return props ; }
Generates a map of all client - side default content properties to be added with new content .