use of org.orcid.jaxb.model.message.SourceName in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorImpl method setSponsorFromAuthentication.
public void setSponsorFromAuthentication(OrcidProfile profile) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (profile.getOrcidHistory() == null) {
OrcidHistory orcidHistory = new OrcidHistory();
orcidHistory.setCreationMethod(CreationMethod.API);
profile.setOrcidHistory(orcidHistory);
}
profile.getOrcidHistory().setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
if (OAuth2Authentication.class.isAssignableFrom(authentication.getClass())) {
OAuth2Request authorizationRequest = ((OAuth2Authentication) authentication).getOAuth2Request();
Source sponsor = new Source();
String sponsorId = authorizationRequest.getClientId();
ClientDetailsEntity clientDetails = clientDetailsManager.findByClientId(sponsorId);
if (clientDetails != null) {
sponsor.setSourceName(new SourceName(clientDetails.getClientName()));
if (OrcidStringUtils.isClientId(sponsorId)) {
sponsor.setSourceClientId(new SourceClientId(sponsorId));
} else {
sponsor.setSourceOrcid(new SourceOrcid(sponsorId));
}
}
profile.getOrcidHistory().setSource(sponsor);
}
}
use of org.orcid.jaxb.model.message.SourceName in project ORCID-Source by ORCID.
the class OrcidMessageUtil method setSourceName.
public void setSourceName(ResearcherUrl element) {
if (element.getSource() != null && element.getSource().retrieveSourcePath() != null) {
SourceName sourceName = getSourceName(element.getSource().retrieveSourcePath());
element.getSource().setSourceName(sourceName);
}
}
use of org.orcid.jaxb.model.message.SourceName in project ORCID-Source by ORCID.
the class OrcidMessageUtil method setSourceName.
public void setSourceName(OrcidWork element) {
if (element.getSource() != null && element.getSource().retrieveSourcePath() != null) {
SourceName sourceName = getSourceName(element.getSource().retrieveSourcePath());
element.getSource().setSourceName(sourceName);
}
}
use of org.orcid.jaxb.model.message.SourceName in project ORCID-Source by ORCID.
the class OrcidMessageUtil method setSourceName.
public void setSourceName(Keyword element) {
if (element.getSource() != null && element.getSource().retrieveSourcePath() != null) {
SourceName sourceName = getSourceName(element.getSource().retrieveSourcePath());
element.getSource().setSourceName(sourceName);
}
}
use of org.orcid.jaxb.model.message.SourceName in project ORCID-Source by ORCID.
the class OrcidMessageUtil method setSourceName.
public void setSourceName(ExternalIdentifier element) {
if (element.getSource() != null && element.getSource().retrieveSourcePath() != null) {
SourceName sourceName = getSourceName(element.getSource().retrieveSourcePath());
element.getSource().setSourceName(sourceName);
}
}
Aggregations