protected LinkedList < Property > autoCreatePropertiesFor ( Name nodeName , Name primaryType , PropertyFactory propertyFactory , NodeTypes capabilities ) { Collection < JcrPropertyDefinition > autoPropDefns = capabilities . getAutoCreatedPropertyDefinitions ( primaryType ) ; if ( autoPropDefns . isEmpty ( ) ) { return null ; } // There is at least one auto-created property on this node ... LinkedList < Property > props = new LinkedList < Property > ( ) ; for ( JcrPropertyDefinition defn : autoPropDefns ) { Name propName = defn . getInternalName ( ) ; if ( defn . hasDefaultValues ( ) ) { // This may or may not be auto-created; we don't care ... Object [ ] defaultValues = defn . getRawDefaultValues ( ) ; Property prop = null ; if ( defn . isMultiple ( ) ) { prop = propertyFactory . create ( propName , defaultValues ) ; } else { prop = propertyFactory . create ( propName , defaultValues [ 0 ] ) ; } props . add ( prop ) ; } } return props ; }
If there are any auto - created properties create them and return them in a list .