Search in sources :

Example 81 with OtherName

use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.

the class Utils method getOtherName.

public static OtherName getOtherName() {
    OtherName otherName = new OtherName();
    otherName.setContent("New Other Name");
    otherName.setVisibility(Visibility.LIMITED);
    return otherName;
}
Also used : OtherName(org.orcid.jaxb.model.record_v2.OtherName)

Example 82 with OtherName

use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.

the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(OtherNames otherNames) {
    if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
        LastModifiedDate latest = null;
        for (OtherName otherName : otherNames.getOtherNames()) {
            if (otherName.getLastModifiedDate() != null && otherName.getLastModifiedDate().after(latest)) {
                latest = otherName.getLastModifiedDate();
            }
        }
        otherNames.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) OtherName(org.orcid.jaxb.model.record_rc3.OtherName)

Example 83 with OtherName

use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static XMLGregorianCalendar calculateLatest(OtherNames otherNames) {
    XMLGregorianCalendar latest = null;
    if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
        latest = otherNames.getOtherNames().get(0).getLastModifiedDate().getValue();
        for (OtherName otherName : otherNames.getOtherNames()) {
            if (latest.compare(otherName.getLastModifiedDate().getValue()) == -1) {
                latest = otherName.getLastModifiedDate().getValue();
            }
        }
        otherNames.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latest;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) OtherName(org.orcid.jaxb.model.record_rc2.OtherName)

Example 84 with OtherName

use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.

the class JpaJaxbOtherNameAdapterTest method fromOtherNameEntityToOtherNameTest.

@Test
public void fromOtherNameEntityToOtherNameTest() {
    OtherNameEntity entity = getOtherNameEntity();
    OtherName otherName = adapter.toOtherName(entity);
    assertNotNull(otherName);
    assertEquals("display-name", otherName.getContent());
    assertNotNull(otherName.getCreatedDate());
    assertNotNull(otherName.getLastModifiedDate());
    assertEquals(Long.valueOf(1), otherName.getPutCode());
    assertNotNull(otherName.getSource());
    assertEquals("APP-000000001", otherName.getSource().retrieveSourcePath());
    assertEquals(Visibility.PUBLIC, otherName.getVisibility());
}
Also used : OtherName(org.orcid.jaxb.model.record_v2.OtherName) OtherNameEntity(org.orcid.persistence.jpa.entities.OtherNameEntity) Test(org.junit.Test)

Example 85 with OtherName

use of org.orcid.jaxb.model.record_rc2.OtherName in project robovm by robovm.

the class X509CertSelectorTest method test_setSubjectAlternativeNamesLjava_util_Collection.

/**
     * java.security.cert.X509CertSelector#setSubjectAlternativeNames(Collection<List<?>>)
     */
public void test_setSubjectAlternativeNamesLjava_util_Collection() throws Exception {
    GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5", new byte[] { 1, 2, 0, 1 }));
    GeneralName san1 = new GeneralName(1, "rfc@822.Name");
    GeneralName san2 = new GeneralName(2, "dNSName");
    GeneralName san3 = new GeneralName(new ORAddress());
    GeneralName san4 = new GeneralName(new Name("O=Organization"));
    GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
    GeneralName san7 = new GeneralName(7, "1.1.1.1");
    GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
    GeneralNames sans1 = new GeneralNames();
    sans1.addName(san0);
    sans1.addName(san1);
    sans1.addName(san2);
    sans1.addName(san3);
    sans1.addName(san4);
    sans1.addName(san6);
    sans1.addName(san7);
    sans1.addName(san8);
    GeneralNames sans2 = new GeneralNames();
    sans2.addName(san0);
    TestCert cert1 = new TestCert(sans1);
    TestCert cert2 = new TestCert(sans2);
    X509CertSelector selector = new X509CertSelector();
    selector.setMatchAllSubjectAltNames(true);
    selector.setSubjectAlternativeNames(null);
    assertTrue("Any certificate should match in the case of null " + "subjectAlternativeNames criteria.", selector.match(cert1) && selector.match(cert2));
    Collection<List<?>> sans = sans1.getPairsList();
    selector.setSubjectAlternativeNames(sans);
    selector.getSubjectAlternativeNames();
}
Also used : GeneralNames(org.apache.harmony.security.x509.GeneralNames) OtherName(org.apache.harmony.security.x509.OtherName) X509CertSelector(java.security.cert.X509CertSelector) List(java.util.List) ArrayList(java.util.ArrayList) GeneralName(org.apache.harmony.security.x509.GeneralName) ORAddress(org.apache.harmony.security.x509.ORAddress) GeneralName(org.apache.harmony.security.x509.GeneralName) OtherName(org.apache.harmony.security.x509.OtherName) Name(org.apache.harmony.security.x501.Name)

Aggregations

OtherName (org.orcid.jaxb.model.record_v2.OtherName)110 Test (org.junit.Test)98 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)55 Biography (org.orcid.jaxb.model.record_v2.Biography)44 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)44 Name (org.orcid.jaxb.model.record_v2.Name)43 Address (org.orcid.jaxb.model.record_v2.Address)42 Keyword (org.orcid.jaxb.model.record_v2.Keyword)40 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)40 Email (org.orcid.jaxb.model.record_v2.Email)38 Addresses (org.orcid.jaxb.model.record_v2.Addresses)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)33 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 Person (org.orcid.jaxb.model.record_v2.Person)31 ArrayList (java.util.ArrayList)21 Response (javax.ws.rs.core.Response)20 DBUnitTest (org.orcid.test.DBUnitTest)20 Record (org.orcid.jaxb.model.record_v2.Record)19