protected static ContentCreateOptions newContentCreateOptions ( DocumentMetadata meta , ContentCreateOptions options , boolean isCopyColls , boolean isCopyQuality , boolean isCopyMeta , boolean isCopyPerms , long effectiveVersion ) { ContentCreateOptions opt = ( ContentCreateOptions ) options . clone ( ) ; if ( meta != null ) { if ( isCopyQuality && opt . getQuality ( ) == 0 ) { opt . setQuality ( meta . quality ) ; } if ( isCopyColls ) { if ( opt . getCollections ( ) != null ) { HashSet < String > colSet = new HashSet < String > ( meta . collectionsList ) ; // union copy_collection and output_collection for ( String s : opt . getCollections ( ) ) { colSet . add ( s ) ; } opt . setCollections ( colSet . toArray ( new String [ colSet . size ( ) ] ) ) ; } else { opt . setCollections ( meta . getCollections ( ) ) ; } } if ( isCopyPerms ) { if ( effectiveVersion < MarkLogicConstants . MIN_NODEUPDATE_VERSION && meta . isNakedProps ( ) ) { boolean reset = false ; Vector < ContentPermission > perms = new Vector <> ( ) ; for ( ContentPermission perm : meta . permissionsList ) { if ( ! perm . getCapability ( ) . toString ( ) . equals ( ContentPermission . NODE_UPDATE . toString ( ) ) ) { perms . add ( perm ) ; } else { reset = true ; } } if ( reset ) { meta . clearPermissions ( ) ; meta . addPermissions ( perms ) ; meta . setPermString ( null ) ; } } if ( opt . getPermissions ( ) != null ) { HashSet < ContentPermission > pSet = new HashSet < ContentPermission > ( meta . permissionsList ) ; // union of output_permission & copy_permission for ( ContentPermission p : opt . getPermissions ( ) ) { pSet . add ( p ) ; } opt . setPermissions ( pSet . toArray ( new ContentPermission [ pSet . size ( ) ] ) ) ; } else { opt . setPermissions ( meta . getPermissions ( ) ) ; } } if ( isCopyMeta ) { opt . setMetadata ( meta . meta ) ; } } return opt ; }
fetch the options information from conf and metadata set to the field options