@Test public void testResolve_DOI() throws SQLException, AuthorizeException, IOException, IllegalArgumentException, IdentifierException, WorkflowException, IllegalAccessException { Item item = newItem(); String doi = this.createDOI(item, DOIIdentifierProvider.IS_REGISTERED, false); DSpaceObject dso = provider.resolve(context, doi); assertNotNull("Failed to resolve DOI.", dso); if (item.getType() != dso.getType() || ObjectUtils.notEqual(item.getID(), dso.getID())) { fail("Object return by DOI lookup was another object then expected!"); } }
@Override public DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException { String doi = null; try { doi = doiService.formatIdentifier(identifier); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } try { DSpaceObject dso = getObjectByDOI(context, doi); if (null == dso) { throw new IdentifierNotFoundException(); } return dso; } catch (SQLException sqle) { log.error("SQLException while searching a DOI in our db.", sqle); throw new RuntimeException("Unable to retrieve information about " + "a DOI out of database.", sqle); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } }
DOIIdentifierProvider extends IdentifierProvider { @Override public DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException { String doi = null; try { doi = doiService.formatIdentifier(identifier); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } try { DSpaceObject dso = getObjectByDOI(context, doi); if (null == dso) { throw new IdentifierNotFoundException(); } return dso; } catch (SQLException sqle) { log.error("SQLException while searching a DOI in our db.", sqle); throw new RuntimeException("Unable to retrieve information about " + "a DOI out of database.", sqle); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } } }
DOIIdentifierProvider extends IdentifierProvider { @Override public DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException { String doi = null; try { doi = doiService.formatIdentifier(identifier); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } try { DSpaceObject dso = getObjectByDOI(context, doi); if (null == dso) { throw new IdentifierNotFoundException(); } return dso; } catch (SQLException sqle) { log.error("SQLException while searching a DOI in our db.", sqle); throw new RuntimeException("Unable to retrieve information about " + "a DOI out of database.", sqle); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } } protected  DOIIdentifierProvider(); }
DOIIdentifierProvider extends IdentifierProvider { @Override public DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException { String doi = null; try { doi = doiService.formatIdentifier(identifier); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } try { DSpaceObject dso = getObjectByDOI(context, doi); if (null == dso) { throw new IdentifierNotFoundException(); } return dso; } catch (SQLException sqle) { log.error("SQLException while searching a DOI in our db.", sqle); throw new RuntimeException("Unable to retrieve information about " + "a DOI out of database.", sqle); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } } protected  DOIIdentifierProvider(); @Required void setDOIConnector(DOIConnector connector); @Override boolean supports(Class<? extends Identifier> identifier); @Override boolean supports(String identifier); @Override String register(Context context, DSpaceObject dso); @Override void register(Context context, DSpaceObject dso, String identifier); @Override void reserve(Context context, DSpaceObject dso, String identifier); void reserveOnline(Context context, DSpaceObject dso, String identifier); void registerOnline(Context context, DSpaceObject dso, String identifier); void updateMetadata(Context context, DSpaceObject dso, String identifier); void updateMetadataOnline(Context context, DSpaceObject dso, String identifier); @Override String mint(Context context, DSpaceObject dso); @Override DSpaceObject resolve(Context context, String identifier, String... attributes); @Override String lookup(Context context, DSpaceObject dso); @Override void delete(Context context, DSpaceObject dso); @Override void delete(Context context, DSpaceObject dso, String identifier); void deleteOnline(Context context, String identifier); DSpaceObject getObjectByDOI(Context context, String identifier); String getDOIByObject(Context context, DSpaceObject dso); String getDOIOutOfObject(DSpaceObject dso); }
DOIIdentifierProvider extends IdentifierProvider { @Override public DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException { String doi = null; try { doi = doiService.formatIdentifier(identifier); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } try { DSpaceObject dso = getObjectByDOI(context, doi); if (null == dso) { throw new IdentifierNotFoundException(); } return dso; } catch (SQLException sqle) { log.error("SQLException while searching a DOI in our db.", sqle); throw new RuntimeException("Unable to retrieve information about " + "a DOI out of database.", sqle); } catch (IdentifierException e) { throw new IdentifierNotResolvableException(e); } } protected  DOIIdentifierProvider(); @Required void setDOIConnector(DOIConnector connector); @Override boolean supports(Class<? extends Identifier> identifier); @Override boolean supports(String identifier); @Override String register(Context context, DSpaceObject dso); @Override void register(Context context, DSpaceObject dso, String identifier); @Override void reserve(Context context, DSpaceObject dso, String identifier); void reserveOnline(Context context, DSpaceObject dso, String identifier); void registerOnline(Context context, DSpaceObject dso, String identifier); void updateMetadata(Context context, DSpaceObject dso, String identifier); void updateMetadataOnline(Context context, DSpaceObject dso, String identifier); @Override String mint(Context context, DSpaceObject dso); @Override DSpaceObject resolve(Context context, String identifier, String... attributes); @Override String lookup(Context context, DSpaceObject dso); @Override void delete(Context context, DSpaceObject dso); @Override void delete(Context context, DSpaceObject dso, String identifier); void deleteOnline(Context context, String identifier); DSpaceObject getObjectByDOI(Context context, String identifier); String getDOIByObject(Context context, DSpaceObject dso); String getDOIOutOfObject(DSpaceObject dso); static final String MD_SCHEMA; static final String DOI_ELEMENT; static final String DOI_QUALIFIER; static final Integer TO_BE_REGISTERED; static final Integer TO_BE_RESERVED; static final Integer IS_REGISTERED; static final Integer IS_RESERVED; static final Integer UPDATE_RESERVED; static final Integer UPDATE_REGISTERED; static final Integer UPDATE_BEFORE_REGISTRATION; static final Integer TO_BE_DELETED; static final Integer DELETED; }