public CmsHistoryPrincipal readPrincipal(CmsDbContext dbc, CmsUUID principalId) throws CmsDataAccessException {
CmsHistoryPrincipal historyPrincipal = null;
try {
Query q = m_sqlManager.createQuery(dbc, C_HISTORY_PRINCIPAL_READ);
q.setParameter(1, principalId.toString());
try {
CmsDAOHistoryPrincipals hp = (CmsDAOHistoryPrincipals)q.getSingleResult();
String userName = hp.getPrincipalName();
String ou = CmsOrganizationalUnit.removeLeadingSeparator(hp.getPrincipalOu());
historyPrincipal = new CmsHistoryPrincipal(
principalId,
ou + userName,
hp.getPrincipalDescription(),
hp.getPrincipalEmail(),
hp.getPrincipalType(),
new CmsUUID(hp.getPrincipalUserDeleted()),
hp.getPrincipalDateDeleted());
} catch (NoResultException e) {
throw new CmsDbEntryNotFoundException(
Messages.get().container(Messages.ERR_HISTORY_PRINCIPAL_NOT_FOUND_1, principalId));
}
} catch (PersistenceException e) {
throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e);
}
return historyPrincipal;
}