private PolicySetType getTargetPolicySet(PapContainer papContainer) {
// get the target policy set, it must be the very first policy set (if it exists)
PolicySetType targetPolicySet = null;
TargetWizard policySetTargetWizard = new TargetWizard(resourceAttributeWizard);
PolicySetType papRootPolicySet = papContainer.getRootPolicySet();
List<String> policySetIdList = PolicySetHelper.getPolicySetIdReferencesValues(papRootPolicySet);
TypeStringUtils.releaseUnneededMemory(papRootPolicySet);
if (policySetIdList.size() == 0) {
return null;
}
PolicySetType candidatePolicySet = papContainer.getPolicySet(policySetIdList.get(0));
if (policySetTargetWizard.isEquivalent(candidatePolicySet.getTarget())) {
targetPolicySet = candidatePolicySet;
}
return targetPolicySet;
}