user = personMapper.fetchUniqueResult(inOpenSocialId);
}
catch (Exception e)
{
logger.error("Unable to populate principal for OpenSocialId: " + inOpenSocialId);
throw new PrincipalPopulationException("Unable to populate principal for OpenSocialId: " + inOpenSocialId,
e);
}
// must handle successful null result from personMapper.fetchUniqueResult
if (user == null)
{
logger.error("Unable to find principal for OpenSocialId: " + inOpenSocialId + " attempting ntid");
try
{
user = getPersonModelViewByAccountIdMapper.execute(inOpenSocialId);
}
catch (Exception e)
{
throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId);
}
// If the user is still null, neither a valid opensocial id nor a valid ntid was provided.
if (user == null)
{
throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId);
}
}
return new DefaultPrincipal(user.getAccountId(), user.getOpenSocialId(), user.getEntityId());
}