Search in sources :

Example 1 with CreditName

use of org.orcid.jaxb.model.v3.dev1.common.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;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Contributor(org.orcid.pojo.ajaxForm.Contributor) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Month(org.orcid.jaxb.model.v3.dev1.common.Month) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Citation(org.orcid.pojo.ajaxForm.Citation) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) GregorianCalendar(java.util.GregorianCalendar) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) Date(org.orcid.pojo.ajaxForm.Date) Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) Year(org.orcid.jaxb.model.v3.dev1.common.Year) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Country(org.orcid.jaxb.model.v3.dev1.common.Country) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) Day(org.orcid.jaxb.model.v3.dev1.common.Day)

Example 2 with CreditName

use of org.orcid.jaxb.model.v3.dev1.common.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));
}
Also used : RecordNameManager(org.orcid.core.manager.v3.RecordNameManager) FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) GivenNames(org.orcid.jaxb.model.v3.dev1.record.GivenNames) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) NamesForm(org.orcid.pojo.ajaxForm.NamesForm) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) Name(org.orcid.jaxb.model.v3.dev1.record.Name) Test(org.junit.Test)

Example 3 with CreditName

use of org.orcid.jaxb.model.v3.dev1.common.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;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Month(org.orcid.jaxb.model.v3.dev1.common.Month) Work(org.orcid.jaxb.model.v3.dev1.record.Work) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Date(java.util.Date) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) Year(org.orcid.jaxb.model.v3.dev1.common.Year) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Country(org.orcid.jaxb.model.v3.dev1.common.Country) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) Day(org.orcid.jaxb.model.v3.dev1.common.Day)

Example 4 with CreditName

use of org.orcid.jaxb.model.v3.dev1.common.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();
}
Also used : DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) SourceName(org.orcid.jaxb.model.v3.dev1.common.SourceName) Name(org.orcid.jaxb.model.v3.dev1.record.Name) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName)

Example 5 with CreditName

use of org.orcid.jaxb.model.v3.dev1.common.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());
}
Also used : FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) GivenNames(org.orcid.jaxb.model.v3.dev1.record.GivenNames) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) Name(org.orcid.jaxb.model.v3.dev1.record.Name) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)18 FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)10 Test (org.junit.Test)8 Name (org.orcid.jaxb.model.v3.dev1.record.Name)8 Contributor (org.orcid.jaxb.model.v3.dev1.common.Contributor)7 FamilyName (org.orcid.jaxb.model.v3.dev1.record.FamilyName)7 GivenNames (org.orcid.jaxb.model.v3.dev1.record.GivenNames)7 Work (org.orcid.jaxb.model.v3.dev1.record.Work)7 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)6 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)6 Title (org.orcid.jaxb.model.v3.dev1.common.Title)4 CreditName (org.orcid.jaxb.model.v3.dev1.record.CreditName)4 WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)4 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)4 ArrayList (java.util.ArrayList)3 Country (org.orcid.jaxb.model.v3.dev1.common.Country)3 Day (org.orcid.jaxb.model.v3.dev1.common.Day)3 Iso3166Country (org.orcid.jaxb.model.v3.dev1.common.Iso3166Country)3 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)3 Subtitle (org.orcid.jaxb.model.v3.dev1.common.Subtitle)3