private static Element getPositionSet ( Element plfParent , IPerson person , boolean create ) throws PortalException { Node child = plfParent . getFirstChild ( ) ; while ( child != null ) { if ( child . getNodeName ( ) . equals ( Constants . ELM_POSITION_SET ) ) return ( Element ) child ; child = child . getNextSibling ( ) ; } if ( create == false ) return null ; String ID = null ; try { ID = getDLS ( ) . getNextStructDirectiveId ( person ) ; } catch ( Exception e ) { throw new PortalException ( "Exception encountered while " + "generating new position set node " + "Id for userId=" + person . getID ( ) , e ) ; } Document plf = plfParent . getOwnerDocument ( ) ; Element positions = plf . createElement ( Constants . ELM_POSITION_SET ) ; positions . setAttribute ( Constants . ATT_TYPE , Constants . ELM_POSITION_SET ) ; positions . setAttribute ( Constants . ATT_ID , ID ) ; plfParent . appendChild ( positions ) ; return positions ; }
This method locates the position set element in the child list of the passed in plfParent or if not found it will create one automatically and return it if the passed in create flag is true .