use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class OrcidSearchManagerImpl method findPublicProfileById.
@Override
public OrcidMessage findPublicProfileById(String orcid) {
OrcidMessage om = null;
try {
if (cachingSource.equals(DB)) {
OrcidProfile orcidProfile = orcidProfileCacheManager.retrievePublic(orcid);
orcidProfile.setOrcidInternal(null);
om = new OrcidMessage(orcidProfile);
} else {
try (Reader reader = solrDao.findByOrcidAsReader(orcid)) {
if (reader != null) {
BufferedReader br = new BufferedReader(reader);
om = OrcidMessage.unmarshall(br);
}
}
}
} catch (NonTransientDataAccessResourceException e) {
throw new OrcidSearchException("Error searching by id: " + orcid, e);
} catch (IOException e) {
throw new OrcidSearchException("Error closing stream for id: " + orcid, e);
}
if (om == null)
throw new OrcidSearchException("Result is null");
return om;
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class NotificationManagerTest method testSendWelcomeEmail.
@Test
public void testSendWelcomeEmail() throws JAXBException, IOException, URISyntaxException {
OrcidMessage orcidMessage = (OrcidMessage) unmarshaller.unmarshal(getClass().getResourceAsStream(ORCID_INTERNAL_FULL_XML));
OrcidProfile orcidProfile = orcidMessage.getOrcidProfile();
notificationManager.sendWelcomeEmail(orcidProfile.getOrcidIdentifier().getPath(), orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue());
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class ValidationManagerTest method testEmptyMessage.
@Test(expected = OrcidValidationException.class)
public void testEmptyMessage() {
OrcidMessage message = new OrcidMessage();
incomingValidationManager.validateMessage(message);
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class BaseControllerTest method getOrcidProfile.
protected static OrcidProfile getOrcidProfile() {
try {
JAXBContext context = JAXBContext.newInstance(OrcidMessage.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
OrcidMessage orcidMessage = (OrcidMessage) unmarshaller.unmarshal(BaseControllerTest.class.getResourceAsStream("/orcid-internal-full-message-latest.xml"));
return orcidMessage.getOrcidProfile();
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class T2OrcidApiServiceVersionedDelegatorImpl method addWorks.
@Override
public Response addWorks(UriInfo uriInfo, String orcid, OrcidMessage orcidMessage) {
Response response = null;
validateIncomingMessage(orcidMessage, orcid);
OrcidMessage upgradedMessage = upgradeMessage(orcidMessage);
response = t2OrcidApiServiceDelegator.addWorks(uriInfo, orcid, upgradedMessage);
return response;
}
Aggregations