code: public static I_CmsPrincipal readPrincipal(CmsObject cms, String type, String name) throws CmsException {
  
          if (CmsStringUtil.isNotEmpty(type)) {
              String upperCaseType = type.toUpperCase();
              if (PRINCIPAL_GROUP.equals(upperCaseType)) {
                  // this principal is a group
                  return cms.readGroup(name);
              } else if (PRINCIPAL_USER.equals(upperCaseType)) {
                  // this principal is a user
                  return cms.readUser(name);
              }
          }
          // invalid principal type was given
          throw new CmsDbEntryNotFoundException(
              Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_TYPE_2, type, name));
      }
docs: Utility function to read a principal of the given type from the OpenCms database using the
  provided OpenCms user context.<p>
  
  The type must either be <code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}</code> or
  <code>{@link I_CmsPrincipal#PRINCIPAL_USER}</code>.<p>
  
  @param cms the OpenCms user context to use when reading the principal
  @param type the principal type
  @param name the principal name
  
  @return the principal read from the OpenCms database
  
  @throws CmsException in case the principal could not be read