question: void addPolicyToResourceTree ( Policy policy ) throws PolicyException , SSOException { Set ruleNames = policy . getRuleNames ( ) ; Iterator i = ruleNames . iterator ( ) ; String ruleName = null ; Rule rule = null ; while ( i . hasNext ( ) ) { ruleName = ( String ) i . next ( ) ; rule = policy . getRule ( ruleName ) ; addRuleToResourceTree ( policy . getName ( ) , rule ) ; } Referrals referrals = policy . getReferrals ( ) ; if ( referrals != null ) { Set referralNames = referrals . getReferralNames ( ) ; if ( ( referralNames != null ) && ( ! referralNames . isEmpty ( ) ) ) { Iterator referralIter = referralNames . iterator ( ) ; while ( referralIter . hasNext ( ) ) { String referralName = ( String ) referralIter . next ( ) ; Referral referral = referrals . getReferral ( referralName ) ; if ( referral instanceof OrgReferral ) { Set values = referral . getValues ( ) ; if ( ( values != null ) && ( ! values . isEmpty ( ) ) ) { Iterator valueIter = values . iterator ( ) ; while ( valueIter . hasNext ( ) ) { String value = ( String ) valueIter . next ( ) ; PolicyManager pm = new PolicyManager ( token , value ) ; ResourceManager rm = pm . getResourceManager ( ) ; Set ruleNames1 = policy . getRuleNames ( ) ; Iterator ruleIter = ruleNames1 . iterator ( ) ; while ( ruleIter . hasNext ( ) ) { String ruleName1 = ( String ) ruleIter . next ( ) ; Rule rule1 = policy . getRule ( ruleName1 ) ; String resourceName = rule1 . getResourceName ( ) ; if ( resourceName != null ) { String serviceTypeName = rule1 . getServiceTypeName ( ) ; Set resourceNames = new HashSet ( ) ; resourceNames . add ( resourceName ) ; rm . addResourcePrefixes ( serviceTypeName , resourceNames ) ; } } } } } } } } }
target:  Adds the resource names of the policy to the resource tree.