void migrateProfile ( Node oldUserNode ) throws Exception { UserProfile userProfile = new UserProfileImpl ( oldUserNode . getName ( ) ) ; Node attrNode = null ; try { attrNode = oldUserNode . getNode ( JCROrganizationServiceImpl . JOS_PROFILE + "/" + MigrationTool . JOS_ATTRIBUTES ) ; } catch ( PathNotFoundException e ) { return ; } PropertyIterator props = attrNode . getProperties ( ) ; while ( props . hasNext ( ) ) { Property prop = props . nextProperty ( ) ; // ignore system properties if ( ! ( prop . getName ( ) ) . startsWith ( "jcr:" ) && ! ( prop . getName ( ) ) . startsWith ( "exo:" ) && ! ( prop . getName ( ) ) . startsWith ( "jos:" ) ) { userProfile . setAttribute ( prop . getName ( ) , prop . getString ( ) ) ; } } if ( findUserProfileByName ( userProfile . getUserName ( ) ) != null ) { removeUserProfile ( userProfile . getUserName ( ) , false ) ; } saveUserProfile ( userProfile , false ) ; }
Migrates user profile from old storage into new .