Search in sources :

Example 71 with OtherName

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

the class X509CertSelectorTest method test_setPathToNamesLjava_util_Collection.

/**
     * java.security.cert.X509CertSelector#setPathToNames(Collection<List<?>>)
     */
public void test_setPathToNamesLjava_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.setPathToNames(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.setPathToNames(sans);
    selector.getPathToNames();
}
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)

Example 72 with OtherName

use of org.orcid.jaxb.model.record_rc3.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 73 with OtherName

use of org.orcid.jaxb.model.record_rc3.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 74 with OtherName

use of org.orcid.jaxb.model.record_rc3.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 75 with OtherName

use of org.orcid.jaxb.model.record_rc3.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)

Aggregations

OtherName (org.orcid.jaxb.model.record_v2.OtherName)114 Test (org.junit.Test)99 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)55 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)45 Biography (org.orcid.jaxb.model.record_v2.Biography)44 Address (org.orcid.jaxb.model.record_v2.Address)43 Keyword (org.orcid.jaxb.model.record_v2.Keyword)42 Name (org.orcid.jaxb.model.record_v2.Name)42 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)42 Email (org.orcid.jaxb.model.record_v2.Email)39 Addresses (org.orcid.jaxb.model.record_v2.Addresses)32 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)32 Person (org.orcid.jaxb.model.record_v2.Person)30 ArrayList (java.util.ArrayList)23 DBUnitTest (org.orcid.test.DBUnitTest)22 Response (javax.ws.rs.core.Response)20 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)18