use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class PersonDetailsManagerReadOnlyImpl method getPersonDetails.
@Override
public Person getPersonDetails(String orcid) {
long lastModifiedTime = getLastModified(orcid);
Person person = new Person();
person.setName(recordNameManager.getRecordName(orcid));
person.setBiography(biographyManager.getBiography(orcid));
Addresses addresses = addressManager.getAddresses(orcid);
if (addresses.getAddress() != null) {
Addresses filteredAddresses = new Addresses();
filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
person.setAddresses(filteredAddresses);
}
PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid);
if (extIds.getExternalIdentifiers() != null) {
PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
person.setExternalIdentifiers(filteredExtIds);
}
Keywords keywords = profileKeywordManager.getKeywords(orcid);
if (keywords.getKeywords() != null) {
Keywords filteredKeywords = new Keywords();
filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
person.setKeywords(filteredKeywords);
}
OtherNames otherNames = otherNameManager.getOtherNames(orcid);
if (otherNames.getOtherNames() != null) {
OtherNames filteredOtherNames = new OtherNames();
filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
person.setOtherNames(filteredOtherNames);
}
ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid);
if (rUrls.getResearcherUrls() != null) {
ResearcherUrls filteredRUrls = new ResearcherUrls();
filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
person.setResearcherUrls(filteredRUrls);
}
Emails emails = emailManager.getEmails(orcid);
if (emails.getEmails() != null) {
Emails filteredEmails = new Emails();
filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
person.setEmails(filteredEmails);
}
return person;
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class GetMyDataControllerTest method setOrg.
private void setOrg(OrganizationHolder oh) {
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
Organization org = new Organization();
org.setName("Organization");
org.setAddress(address);
oh.setOrganization(org);
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class ManageProfileController method getProfileCountryJson.
@RequestMapping(value = "/countryForm.json", method = RequestMethod.GET)
@ResponseBody
public AddressesForm getProfileCountryJson(HttpServletRequest request) throws NoSuchRequestHandlingMethodException {
Addresses addresses = addressManager.getAddresses(getCurrentUserOrcid());
AddressesForm form = AddressesForm.valueOf(addresses);
// Set country name
if (form != null && form.getAddresses() != null) {
Map<String, String> countries = retrieveIsoCountries();
for (AddressForm addressForm : form.getAddresses()) {
addressForm.setCountryName(countries.get(addressForm.getIso2Country().getValue().name()));
}
}
ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
// Set the default visibility
if (profile.getActivitiesVisibilityDefault() != null) {
form.setVisibility(org.orcid.pojo.ajaxForm.Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
}
// Return an empty country in case we dont have any
if (form.getAddresses() == null) {
form.setAddresses(new ArrayList<AddressForm>());
}
if (form.getAddresses().isEmpty()) {
AddressForm address = new AddressForm();
address.setDisplayIndex(1L);
address.setVisibility(org.orcid.pojo.ajaxForm.Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
form.getAddresses().add(address);
}
return form;
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getAddressMapperFacade.
public MapperFacade getAddressMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Address, AddressEntity> addressClassMap = mapperFactory.classMap(Address.class, AddressEntity.class);
addV3DateFields(addressClassMap);
registerSourceConverters(mapperFactory, addressClassMap);
addressClassMap.field("putCode", "id");
addressClassMap.field("country.value", "iso2Country");
addressClassMap.field("visibility", "visibility");
addressClassMap.fieldBToA("displayIndex", "displayIndex");
addressClassMap.byDefault();
addressClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createAddress.
protected Address createAddress(Visibility v, String sourceId) {
Address a = new Address();
a.setVisibility(v);
Iso3166Country[] all = Iso3166Country.values();
Random r = new Random();
int index = r.nextInt(all.length);
if (index < 0 || index >= all.length) {
index = 0;
}
a.setCountry(new Country(all[index]));
setSource(a, sourceId);
return a;
}
Aggregations