use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.
the class OrcidBatchLoad method assignPersistenceFields.
private void assignPersistenceFields(OrcidProfile profile) {
// set the transient fields that the encrypters need
profile.setPassword("password");
// profile.setOrcidIdentifier();
profile.setSecurityQuestionAnswer("securityQuestionAnswer");
profile.setVerificationCode("1111");
// randomise any fields that are uniquely constrained so that we can
// re-use the test data
profile.getOrcidBio().getContactDetails().addOrReplacePrimaryEmail(new Email(RandomStringUtils.randomAlphabetic(150)));
Keywords keywords = new Keywords();
keywords.getKeyword().add(new Keyword(RandomStringUtils.randomAlphabetic(255), Visibility.PUBLIC));
profile.getOrcidBio().setKeywords(keywords);
profile.retrieveOrcidWorks().getOrcidWork();
}
use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.
the class Text method toKeyword.
public Keyword toKeyword() {
Keyword k = new Keyword();
k.setContent(this.value);
return k;
}
use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.
the class OrcidProfileManagerImpl method addDefaultVisibilityToBioItems.
private void addDefaultVisibilityToBioItems(OrcidProfile orcidProfile, Visibility defaultActivityVis, Boolean isClaimed) {
if (defaultActivityVis == null) {
defaultActivityVis = Visibility.PRIVATE;
}
if (isClaimed == null) {
isClaimed = false;
}
if (orcidProfile.getOrcidBio() != null) {
if (orcidProfile.getOrcidBio().getBiography() != null) {
if (isClaimed) {
orcidProfile.getOrcidBio().getBiography().setVisibility(defaultActivityVis);
} else {
Visibility visibility = orcidProfile.getOrcidBio().getBiography().getVisibility();
orcidProfile.getOrcidBio().getBiography().setVisibility(visibility != null ? visibility : Visibility.PRIVATE);
}
}
if (orcidProfile.getOrcidBio().getExternalIdentifiers() != null) {
Visibility listVisibility = orcidProfile.getOrcidBio().getExternalIdentifiers().getVisibility();
for (ExternalIdentifier x : orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier()) {
if (isClaimed) {
x.setVisibility(defaultActivityVis);
} else {
x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
}
}
}
if (orcidProfile.getOrcidBio().getKeywords() != null) {
Visibility listVisibility = orcidProfile.getOrcidBio().getKeywords().getVisibility();
for (Keyword x : orcidProfile.getOrcidBio().getKeywords().getKeyword()) {
if (isClaimed) {
x.setVisibility(defaultActivityVis);
} else {
x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
}
}
}
if (orcidProfile.getOrcidBio().getResearcherUrls() != null) {
Visibility listVisibility = orcidProfile.getOrcidBio().getResearcherUrls().getVisibility();
for (ResearcherUrl x : orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl()) {
if (isClaimed) {
x.setVisibility(defaultActivityVis);
} else {
x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
}
}
}
if (orcidProfile.getOrcidBio().getPersonalDetails() != null && orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames() != null) {
Visibility listVisibility = orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility();
for (OtherName x : orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName()) {
if (isClaimed) {
x.setVisibility(defaultActivityVis);
} else {
x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
}
}
}
if (orcidProfile.getOrcidBio().getContactDetails() != null && orcidProfile.getOrcidBio().getContactDetails().getAddress() != null && orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry() != null) {
Country country = orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry();
if (isClaimed) {
country.setVisibility(defaultActivityVis);
} else {
country.setVisibility(country.getVisibility() != null ? country.getVisibility() : Visibility.PRIVATE);
}
}
}
}
use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.
the class OrcidMessageUtil method setSourceName.
public void setSourceName(OrcidProfile orcidProfile) {
if (orcidProfile != null) {
if (orcidProfile.getOrcidActivities() != null) {
OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
if (orcidActivities.getAffiliations() != null) {
Affiliations affs = orcidActivities.getAffiliations();
List<Affiliation> affList = affs.getAffiliation();
if (affList != null) {
for (Affiliation aff : affList) {
setSourceName(aff);
}
}
}
if (orcidActivities.getFundings() != null) {
FundingList fundingList = orcidActivities.getFundings();
List<Funding> fundings = fundingList.getFundings();
if (fundings != null) {
for (Funding funding : fundings) {
setSourceName(funding);
}
}
}
if (orcidActivities.getOrcidWorks() != null) {
OrcidWorks orcidWorks = orcidActivities.getOrcidWorks();
List<OrcidWork> works = orcidWorks.getOrcidWork();
if (works != null) {
for (OrcidWork work : works) {
setSourceName(work);
}
}
}
}
if (orcidProfile.getOrcidBio() != null) {
OrcidBio orcidBio = orcidProfile.getOrcidBio();
if (orcidBio.getContactDetails() != null) {
Address address = orcidBio.getContactDetails().getAddress();
if (address != null) {
setSourceName(address);
}
}
if (orcidBio.getExternalIdentifiers() != null) {
ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers();
List<ExternalIdentifier> extIdsList = extIds.getExternalIdentifier();
if (extIdsList != null) {
for (ExternalIdentifier extId : extIdsList) {
setSourceName(extId);
}
}
}
if (orcidBio.getKeywords() != null) {
Keywords keywords = orcidBio.getKeywords();
List<Keyword> keywordList = keywords.getKeyword();
if (keywordList != null) {
for (Keyword keyword : keywordList) {
setSourceName(keyword);
}
}
}
if (orcidBio.getPersonalDetails() != null) {
OtherNames otherNames = orcidBio.getPersonalDetails().getOtherNames();
if (otherNames != null) {
List<OtherName> otherNameList = otherNames.getOtherName();
if (otherNameList != null) {
for (OtherName otherName : otherNameList) {
setSourceName(otherName);
}
}
}
}
if (orcidBio.getResearcherUrls() != null) {
ResearcherUrls rUrls = orcidBio.getResearcherUrls();
List<ResearcherUrl> rUrlList = rUrls.getResearcherUrl();
if (rUrlList != null) {
for (ResearcherUrl rUrl : rUrlList) {
setSourceName(rUrl);
}
}
}
}
}
}
use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.
the class OrcidJaxbCopyManagerTest method getBio.
private OrcidBio getBio(String sufix, Visibility visibility, int max) {
OrcidBio orcidBio = new OrcidBio();
Biography bio = new Biography(sufix + "My Biography", visibility);
orcidBio.setBiography(bio);
ContactDetails contactDetails = new ContactDetails();
Address address = new Address();
Country country = new Country(visibility.equals(Visibility.PRIVATE) ? Iso3166Country.US : Iso3166Country.CR);
country.setVisibility(visibility);
address.setCountry(country);
contactDetails.setAddress(address);
List<Email> emails = new ArrayList<Email>();
for (int i = 0; i < max; i++) {
Email email = new Email();
email.setValue(sufix + "Email" + i);
if (i == 0) {
email.setPrimary(true);
}
email.setVisibility(visibility);
emails.add(email);
}
contactDetails.setEmail(emails);
orcidBio.setContactDetails(contactDetails);
ExternalIdentifiers extIds = new ExternalIdentifiers();
extIds.setVisibility(visibility);
for (int i = 0; i < max; i++) {
ExternalIdentifier extId = new ExternalIdentifier();
extId.setExternalIdCommonName(new ExternalIdCommonName(sufix + "CommonName" + i));
extId.setExternalIdReference(new ExternalIdReference(sufix + "Reference" + i));
extIds.getExternalIdentifier().add(extId);
}
orcidBio.setExternalIdentifiers(extIds);
Keywords keywords = new Keywords();
keywords.setVisibility(visibility);
for (int i = 0; i < max; i++) {
Keyword k = new Keyword();
k.setContent(sufix + "Keyword" + i);
keywords.getKeyword().add(k);
}
orcidBio.setKeywords(keywords);
PersonalDetails personalDetails = new PersonalDetails();
CreditName creditName = new CreditName(sufix + "Credit name");
creditName.setVisibility(visibility);
personalDetails.setCreditName(creditName);
FamilyName familyName = new FamilyName(sufix + "Family");
personalDetails.setFamilyName(familyName);
GivenNames givenNames = new GivenNames();
givenNames.setContent(sufix + "Given");
personalDetails.setGivenNames(givenNames);
OtherNames other = new OtherNames();
other.setVisibility(visibility);
for (int i = 0; i < max; i++) {
other.addOtherName(sufix + "Other" + i, null);
}
personalDetails.setOtherNames(other);
orcidBio.setPersonalDetails(personalDetails);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.setVisibility(visibility);
for (int i = 0; i < max; i++) {
ResearcherUrl rUrl = new ResearcherUrl();
rUrl.setUrl(new Url("http://www.rurl.com/" + sufix + "/" + i));
rUrl.setUrlName(new UrlName(sufix + "Url" + i));
researcherUrls.getResearcherUrl().add(rUrl);
}
orcidBio.setResearcherUrls(researcherUrls);
return orcidBio;
}
Aggregations