Package org.gedcomx.source

Examples of org.gedcomx.source.SourceReference


        assertEquals(gedxRelationship.getFacts().size(), 1);
        Fact gedxFact = gedxRelationship.getFacts().get(0);
        assertNotNull(gedxFact);
        assertNotNull(gedxFact.getSources());
        assertEquals(gedxFact.getSources().size(), 1);
        SourceReference gedxSourceReference = gedxFact.getSources().get(0);
        assertNotNull(gedxSourceReference);
        assertNotNull(gedxSourceReference.getDescriptionRef());
        assertTrue(gedxSourceReference.getDescriptionRef().toString().startsWith("#"));
        generatedId = gedxSourceReference.getDescriptionRef().toString().substring(1);
        assertNotNull(generatedId, "1");
        assertNull(gedxSourceReference.getAttribution());
        assertNull(gedxSourceReference.getExtensionElements());
      }
    }
    assertNotNull(result.getSourceDescriptions());
    assertEquals(result.getSourceDescriptions().size(), 1);
    SourceDescription gedxSourceDescription = result.getSourceDescriptions().get(0);
View Full Code Here


        assertEquals(gedxRelationship.getFacts().size(), 1);
        Fact gedxFact = gedxRelationship.getFacts().get(0);
        assertNotNull(gedxFact);
        assertNotNull(gedxFact.getSources());
        assertEquals(gedxFact.getSources().size(), 1);
        SourceReference gedxSourceReference = gedxFact.getSources().get(0);
        assertNotNull(gedxSourceReference);
        assertNotNull(gedxSourceReference.getDescriptionRef());
        assertTrue(gedxSourceReference.getDescriptionRef().toString().startsWith("#"));
        generatedId = gedxSourceReference.getDescriptionRef().toString().substring(1);
        assertEquals(generatedId, "SOUR-2");
        assertNull(gedxSourceReference.getAttribution());
      }
    }
    assertNotNull(result.getSourceDescriptions());
    assertEquals(result.getSourceDescriptions().size(), 1);
    SourceDescription gedxSourceDescription = result.getSourceDescriptions().get(0);
View Full Code Here

    assertEquals(gedxPerson.getFacts().size(), 1);
    Fact gedxFact = gedxPerson.getFacts().get(0);
    assertNotNull(gedxFact);
    assertNotNull(gedxFact.getSources());
    assertEquals(gedxFact.getSources().size(), 1);
    SourceReference gedxSourceReference = gedxFact.getSources().get(0);
    assertNotNull(gedxSourceReference);
    assertNotNull(gedxSourceReference.getDescriptionRef());
    assertTrue(gedxSourceReference.getDescriptionRef().toString().startsWith("#"));
    generatedId = gedxSourceReference.getDescriptionRef().toString().substring(1);
    assertNotNull(generatedId, "3");
    assertNull(gedxSourceReference.getAttribution());
    assertNull(gedxSourceReference.getExtensionElements());

    assertNotNull(result.getSourceDescriptions());
    assertEquals(result.getSourceDescriptions().size(), 1);
    SourceDescription gedxSourceDescription = result.getSourceDescriptions().get(0);
    assertNotNull(gedxSourceDescription);
View Full Code Here

    assertEquals(gedxPerson.getFacts().size(), 1);
    Fact gedxFact = gedxPerson.getFacts().get(0);
    assertNotNull(gedxFact);
    assertNotNull(gedxFact.getSources());
    assertEquals(gedxFact.getSources().size(), 1);
    SourceReference gedxSourceReference = gedxFact.getSources().get(0);
    assertNotNull(gedxSourceReference);
    assertNotNull(gedxSourceReference.getDescriptionRef());
    assertTrue(gedxSourceReference.getDescriptionRef().toString().startsWith("#"));
    generatedId = gedxSourceReference.getDescriptionRef().toString().substring(1);
    assertNotNull(generatedId, "4");
    assertNull(gedxSourceReference.getAttribution());
    assertNull(gedxSourceReference.getExtensionElements());

    assertNotNull(result.getSourceDescriptions());
    assertEquals(result.getSourceDescriptions().size(), 0);
  }
View Full Code Here

        citation.setValue("");

        if (dqSource.getRef() != null) {
          gedxSourceDescription.setId(dqSource.getRef() + "-" + Long.toHexString(SequentialIdentifierGenerator.getNextId()));

          SourceReference componentOf = new SourceReference();
          componentOf.setDescriptionRef(URI.create(CommonMapper.getSourceDescriptionReference(dqSource.getRef())));
          gedxSourceDescription.setComponentOf(componentOf);
          sourceDescriptionHasData = true;

          if (dqSource.getDate() != null) {
            CitationField field = new CitationField();
            field.setName(URI.create("gedcom5:citation-template/date"));
            field.setValue(dqSource.getDate());
            citation.getFields().add(field);
            citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getDate() : dqSource.getDate()));
          }

          if (dqSource.getPage() != null) {
            CitationField field = new CitationField();
            field.setName(URI.create("gedcom5:citation-template/page"));
            field.setValue(dqSource.getPage());
            citation.getFields().add(field);
            citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getPage() : dqSource.getPage()));
          }
        } else if (dqSource.getValue() != null) {
          gedxSourceDescription.setId("SOUR-" + Long.toHexString(SequentialIdentifierGenerator.getNextId()));

          citation.setValue(dqSource.getValue());
          citation.setCitationTemplate(null);
          sourceDescriptionHasData = true;
        }

        String entryName = CommonMapper.getSourceDescriptionReference(gedxSourceDescription.getId());
        SourceReference gedxSourceReference = new SourceReference();
        gedxSourceReference.setDescriptionRef(URI.create(entryName));

        if (dqSource.getText() != null) {
          logger.warn(ConversionContext.getContext(), "GEDCOM X does not currently support text extracted from a source.");
          // dqSource.getText(); // see GEDCOM X issue 121 // TODO: address when the associated issue is resolved; log for now
          // sourceDescriptionHasData = true;
View Full Code Here

TOP

Related Classes of org.gedcomx.source.SourceReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.