use of org.orcid.jaxb.model.v3.dev1.record.CreditName in project ORCID-Source by ORCID.
the class WorkFormTest method getWork.
private Work getWork() {
Work work = new Work();
work.setCountry(new Country(Iso3166Country.US));
work.setJournalTitle(new Title("Journal title"));
work.setLanguageCode("en");
work.setPutCode(Long.valueOf("1"));
work.setShortDescription("Short description");
work.setSource(new org.orcid.jaxb.model.v3.dev1.common.Source("0000-0000-0000-0000"));
work.setUrl(new Url("http://myurl.com"));
work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.PUBLIC);
org.orcid.jaxb.model.v3.dev1.record.Citation citation = new org.orcid.jaxb.model.v3.dev1.record.Citation();
citation.setCitation("Citation");
citation.setWorkCitationType(CitationType.FORMATTED_UNSPECIFIED);
work.setWorkCitation(citation);
WorkTitle title = new WorkTitle();
title.setTitle(new Title("Title"));
title.setTranslatedTitle(new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle("Translated Title", "es"));
title.setSubtitle(new Subtitle("Subtitle"));
work.setWorkTitle(title);
work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
Date date = new Date();
date.setDay("1");
date.setMonth("1");
date.setYear("2015");
GregorianCalendar calendar = date.toCalendar();
work.setCreatedDate(new CreatedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
date = new Date();
date.setDay("2");
date.setMonth("2");
date.setYear("2015");
calendar = date.toCalendar();
work.setLastModifiedDate(new LastModifiedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
work.setPublicationDate(new PublicationDate(new Year(2015), new Month(3), new Day(3)));
org.orcid.jaxb.model.v3.dev1.record.WorkContributors contributors = new org.orcid.jaxb.model.v3.dev1.record.WorkContributors();
org.orcid.jaxb.model.v3.dev1.common.Contributor contributor = new org.orcid.jaxb.model.v3.dev1.common.Contributor();
org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes attributes = new org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes();
attributes.setContributorRole(org.orcid.jaxb.model.v3.dev1.common.ContributorRole.CO_INVENTOR);
attributes.setContributorSequence(org.orcid.jaxb.model.v3.dev1.record.SequenceType.FIRST);
contributor.setContributorAttributes(attributes);
contributor.setContributorEmail(null);
ContributorOrcid contributorOrcid = new ContributorOrcid("Contributor orcid");
contributorOrcid.setUri("Contributor uri");
contributor.setContributorOrcid(contributorOrcid);
CreditName creditName = new CreditName("Contributor credit name");
contributor.setCreditName(creditName);
contributors.getContributor().add(contributor);
work.setWorkContributors(contributors);
ExternalIDs externalIdentifiers = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setValue("External Identifier ID");
extId.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ASIN.value());
extId.setRelationship(Relationship.SELF);
externalIdentifiers.getExternalIdentifier().add(extId);
work.setWorkExternalIdentifiers(externalIdentifiers);
return work;
}
use of org.orcid.jaxb.model.v3.dev1.record.CreditName in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testStripHtmlFromNames.
@Test
public void testStripHtmlFromNames() throws NoSuchRequestHandlingMethodException {
RecordNameManager mockRecordNameManager = Mockito.mock(RecordNameManager.class);
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
TargetProxyHelper.injectIntoProxy(controller, "recordNameManager", mockRecordNameManager);
when(mockRecordNameManager.exists(Mockito.anyString())).thenReturn(true);
NamesForm nf = new NamesForm();
nf.setCreditName(Text.valueOf("<button onclick=\"alert('hello')\">Credit Name</button>"));
nf.setGivenNames(Text.valueOf("<button onclick=\"alert('hello')\">Given Names</button>"));
nf.setFamilyName(Text.valueOf("<button onclick=\"alert('hello')\">Family Name</button>"));
nf.setVisibility(org.orcid.pojo.ajaxForm.Visibility.valueOf(Visibility.PUBLIC));
nf = controller.setNameFormJson(nf);
assertEquals("Credit Name", nf.getCreditName().getValue());
assertEquals("Given Names", nf.getGivenNames().getValue());
assertEquals("Family Name", nf.getFamilyName().getValue());
Name name = new Name();
name.setCreditName(new CreditName("Credit Name"));
name.setFamilyName(new FamilyName("Family Name"));
name.setGivenNames(new GivenNames("Given Names"));
name.setVisibility(Visibility.PUBLIC);
verify(mockRecordNameManager, times(1)).updateRecordName(Mockito.eq(USER_ORCID), Mockito.eq(name));
}
use of org.orcid.jaxb.model.v3.dev1.record.CreditName in project ORCID-Source by ORCID.
the class WorkFormTest method getWork.
public static Work getWork() {
Work work = new Work();
work.setCountry(new Country(Iso3166Country.US));
Date date = new Date();
work.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(date)));
work.setJournalTitle(new Title("Journal Title"));
work.setLanguageCode("EN");
work.setPublicationDate(new PublicationDate(new Year(2015), new Month(1), new Day(1)));
work.setPutCode(Long.valueOf("12345"));
work.setShortDescription("Short description");
work.setUrl(new Url("http://test.com"));
work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.LIMITED);
work.setWorkCitation(new org.orcid.jaxb.model.v3.dev1.record.Citation("Citation", CitationType.BIBTEX));
WorkContributors contributors = new WorkContributors();
org.orcid.jaxb.model.v3.dev1.common.Contributor contributor = new org.orcid.jaxb.model.v3.dev1.common.Contributor();
contributor.setCreditName(new CreditName("Credit name"));
contributor.setContributorOrcid(new ContributorOrcid("0000-0000-0000-0000"));
ContributorAttributes att = new ContributorAttributes();
att.setContributorRole(ContributorRole.ASSIGNEE);
att.setContributorSequence(SequenceType.FIRST);
contributor.setContributorAttributes(att);
contributors.getContributor().add(contributor);
work.setWorkContributors(contributors);
ExternalIDs weis = new ExternalIDs();
ExternalID wei = new ExternalID();
wei.setRelationship(Relationship.SELF);
wei.setUrl(new Url("http://test.com"));
wei.setValue("ID");
wei.setType(WorkExternalIdentifierType.AGR.value());
weis.getExternalIdentifier().add(wei);
work.setWorkExternalIdentifiers(weis);
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title("Work Title"));
workTitle.setSubtitle(new Subtitle("Subtitle"));
TranslatedTitle translated = new TranslatedTitle("Translated", "US");
workTitle.setTranslatedTitle(translated);
work.setWorkTitle(workTitle);
work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
return work;
}
use of org.orcid.jaxb.model.v3.dev1.record.CreditName in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getNameMapperFacade.
public MapperFacade getNameMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Name, RecordNameEntity> nameClassMap = mapperFactory.classMap(Name.class, RecordNameEntity.class);
addV3DateFields(nameClassMap);
nameClassMap.field("creditName.content", "creditName");
nameClassMap.field("givenNames.content", "givenNames");
nameClassMap.field("familyName.content", "familyName");
nameClassMap.field("path", "profile.id");
nameClassMap.byDefault();
nameClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.jaxb.model.v3.dev1.record.CreditName in project ORCID-Source by ORCID.
the class RecordNameManagerV3Test method testCreateRecordName.
@Test
public void testCreateRecordName() {
Name name = new Name();
long time = System.currentTimeMillis();
name.setCreditName(new CreditName("Credit Name " + time));
name.setFamilyName(new FamilyName("Family Name " + time));
name.setGivenNames(new GivenNames("Given Names " + time));
name.setVisibility(Visibility.PRIVATE);
String orcid = "0000-0000-0000-0005";
recordNameManager.createRecordName(orcid, name);
Name newName = recordNameManager.getRecordName(orcid);
assertNotNull(newName);
assertEquals("Credit Name " + time, newName.getCreditName().getContent());
assertEquals("Family Name " + time, newName.getFamilyName().getContent());
assertEquals("Given Names " + time, newName.getGivenNames().getContent());
assertEquals(Visibility.PRIVATE, newName.getVisibility());
}
Aggregations