/** * Attempt to find an EPerson based on string ID * * @param context DSpace context * @param strID string identifier * @return EPerson object (if found) * @throws SQLException if database error */ protected EPerson getEPersonFromString(Context context, String strID) throws SQLException { EPerson eperson; try { UUID ePersonId = UUID.fromString(strID); eperson = ePersonService.find(context, ePersonId); } catch (Exception e) { eperson = ePersonService.findByLegacyId(context, Integer.parseInt(strID)); } return eperson; }
/** * Set EPerson doing import * * @param context DSpace Context * @param eperson EPerson obj * @throws Exception if error */ protected void setEPerson(Context context, String eperson) throws Exception { if (eperson == null) { pr("Error - an eperson to do the importing must be specified"); pr(" (run with -h flag for details)"); throw new Exception("EPerson not specified."); } EPerson myEPerson = null; if (eperson.indexOf('@') != -1) { // @ sign, must be an email myEPerson = epersonService.findByEmail(context, eperson); } else { myEPerson = epersonService.find(context, UUID.fromString(eperson)); } if (myEPerson == null) { pr("Error, eperson cannot be found: " + eperson); throw new Exception("Invalid EPerson"); } context.setCurrentUser(myEPerson); }
eperson = ePersonService.find(context, oldEPerson.getID()); context.setCurrentUser(eperson); context.turnOffAuthorisationSystem();
myEPerson = ePersonService.find(context, UUID.fromString(eperson));
EPerson reviewer = ePersonService.find(c, reviewerId);
myEPerson = epersonService.find(c, UUID.fromString(eperson));
EPerson eperson = ePersonService.find(context, id); Email adminEmail = Email .getEmail(I18nUtil.getEmailFilename(context.getCurrentLocale(), "registration_notify"));
eperson = EPersonServiceFactory.getInstance().getEPersonService().findByEmail(c, e); } else { eperson = EPersonServiceFactory.getInstance().getEPersonService().find(c, UUID.fromString(e));