private static void decorateContentNode ( final Node dsNode , final Node descNode , final Collection < URI > checksums ) throws RepositoryException { if ( dsNode == null ) { LOGGER . warn ( "{} node appears to be null!" , JCR_CONTENT ) ; return ; } if ( dsNode . hasProperty ( JCR_DATA ) ) { final Property dataProperty = dsNode . getProperty ( JCR_DATA ) ; final Binary binary = ( Binary ) dataProperty . getBinary ( ) ; final String dsChecksum = binary . getHexHash ( ) ; checksums . add ( ContentDigest . asURI ( SHA1 . algorithm , dsChecksum ) ) ; final String [ ] checksumArray = new String [ checksums . size ( ) ] ; checksums . stream ( ) . map ( Object :: toString ) . collect ( Collectors . toSet ( ) ) . toArray ( checksumArray ) ; if ( descNode != null ) { descNode . setProperty ( CONTENT_DIGEST , checksumArray ) ; descNode . setProperty ( CONTENT_SIZE , dataProperty . getLength ( ) ) ; } LOGGER . debug ( "Decorated data property at path: {}" , dataProperty . getPath ( ) ) ; } }
Add necessary information to node