private void upgradePrivileges(PrivilegeManager pm,String appName,String resourceTypeUUID) throws UpgradeException {
  final SearchFilter searchFilter=new SearchFilter(Privilege.APPLICATION_SEARCH_ATTRIBUTE,appName);
  try {
    final List<Privilege> privileges=pm.search(Collections.singleton(searchFilter));
    for (    Privilege privilege : privileges) {
      if (StringUtils.isEmpty(privilege.getResourceTypeUuid())) {
        upgradePrivilege(pm,privilege,resourceTypeUUID);
      }
    }
  }
 catch (  EntitlementException ee) {
    throw new UpgradeException("Failed to gather policies for application " + appName,ee);
  }
}

private void upgradePrivileges ( PrivilegeManager pm , String appName , String resourceTypeUUID ) throws UpgradeException { final SearchFilter searchFilter = new SearchFilter ( Privilege . APPLICATION_SEARCH_ATTRIBUTE , appName ) ; try { final List < Privilege > privileges = pm . search ( Collections . singleton ( searchFilter ) ) ; for ( Privilege privilege : privileges ) { if ( StringUtils . isEmpty ( privilege . getResourceTypeUuid ( ) ) ) { upgradePrivilege ( pm , privilege , resourceTypeUUID ) ; } } } catch ( EntitlementException ee ) { throw new UpgradeException ( "Failed to gather policies for application " + appName , ee ) ; } }
add the resource type uuid to the privileges in this application and persist them .
