private static void addDirective ( Element plfNode , String attributeName , String type , IPerson person ) throws PortalException { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; Element editSet = getEditSet ( plfNode , plf , person , true ) ; // see if attributes has already been marked as being edited Element child = ( Element ) editSet . getFirstChild ( ) ; Element edit = null ; while ( child != null && edit == null ) { if ( child . getNodeName ( ) . equals ( type ) && child . getAttribute ( Constants . ATT_NAME ) . equals ( attributeName ) ) edit = child ; child = ( Element ) child . getNextSibling ( ) ; } if ( edit == null ) // if not found then newly mark as edited { String ID = null ; try { ID = getDLS ( ) . getNextStructDirectiveId ( person ) ; } catch ( Exception e ) { throw new PortalException ( "Exception encountered while " + "generating new edit node " + "Id for userId=" + person . getID ( ) , e ) ; } edit = plf . createElement ( type ) ; edit . setAttribute ( Constants . ATT_TYPE , type ) ; edit . setAttribute ( Constants . ATT_ID , ID ) ; edit . setAttribute ( Constants . ATT_NAME , attributeName ) ; editSet . appendChild ( edit ) ; } }
Create and append an edit directive to the edit set if not there .