/** * 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; }
private UUID mapOwner(String owntype, int val) throws SQLException { if (owntype.equals("e")) { EPerson per = epersonService.findByLegacyId(context, val); return per == null ? null : per.getID(); } else if (owntype.equals("g")) { Group perg = groupService.findByLegacyId(context, val); return perg == null ? null : perg.getID(); } return null; }
private UUID mapId(FIELD col, int val) throws SQLException { if (col == FIELD.owningComm) { Community comm = communityService.findByLegacyId(context, val); return comm == null ? null : comm.getID(); } if (col == FIELD.owningColl) { org.dspace.content.Collection coll = collectionService.findByLegacyId(context, val); return coll == null ? null : coll.getID(); } if (col == FIELD.owningItem) { Item item = itemService.findByLegacyId(context, val); checkLastItem(item); return item == null ? null : item.getID(); } if (col == FIELD.epersonid || col == FIELD.actor || col == FIELD.submitter) { EPerson per = epersonService.findByLegacyId(context, val); return per == null ? null : per.getID(); } return null; }