private UUID mapType(int type, int val) throws SQLException { if (type == Constants.COMMUNITY) { Community comm = communityService.findByLegacyId(context, val); return comm == null ? null : comm.getID(); } if (type == Constants.COLLECTION) { org.dspace.content.Collection coll = collectionService.findByLegacyId(context, val); return coll == null ? null : coll.getID(); } if (type == Constants.ITEM) { Item item = itemService.findByLegacyId(context, val); checkLastItem(item); return item == null ? null : item.getID(); } if (type == Constants.BITSTREAM) { Bitstream bit = bitstreamService.findByLegacyId(context, val); UUID uuid = bit == null ? null : bit.getID(); // A bitstream is unlikely to be processed more than once, to clear immediately checkLastBitstream(bit); return uuid; } return null; }