Examples of CitationField


Examples of org.gedcomx.source.CitationField

      citation.setCitationTemplate(new ResourceReference(URI.create("gedcom5:citation-template")));
      citation.setFields(new ArrayList<CitationField>());
      citation.setValue("");

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

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

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

      if (dqSource.getText() != null) {
        logger.warn(ConversionContext.getContext(), "GEDCOM X does not currently support text extracted from a source.");
      }

      if (dqSource.getRepositoryRef() != null) {
        Marker repoContext = ConversionContext.getDetachedMarker("REPO");
        ConversionContext.addReference(repoContext);
        try {
          RepositoryRef dqRepositoryRef = dqSource.getRepositoryRef();
          if (dqRepositoryRef.getRef() != null) {
            gedxSourceDescription.setMediator(new ResourceReference(URI.create(CommonMapper.getOrganizationReference(dqRepositoryRef.getRef()))));
            // TODO: map NOTEs as another note associated with this SourceDescription
          }
          else {
            String inlineRepoId = dqSource.getId() + ".REPO";
            Agent gedxOrganization = new Agent();
            gedxOrganization.setId(inlineRepoId);
            for (Note dqNote : dqRepositoryRef.getNotes()) {
              org.gedcomx.common.Note gedxNote = new org.gedcomx.common.Note();
              gedxNote.setText(dqNote.getValue());
              gedxOrganization.addExtensionElement(gedxNote);
            }
            for (NoteRef dqNoteRef : dqRepositoryRef.getNoteRefs()) {
              logger.warn(ConversionContext.getContext(), "Unable to associate a note ({}) with the inline-defined organization ({})", dqNoteRef.getRef(), inlineRepoId);
            }
            result.addOrganization(gedxOrganization);
            gedxSourceDescription.setMediator(new ResourceReference(URI.create(CommonMapper.getOrganizationReference(inlineRepoId))));
          }

          if (dqRepositoryRef.getCallNumber() != null) {
            CitationField field = new CitationField();
            field.setName(URI.create("gedcom5:citation-template/call-number"));
            field.setValue(dqRepositoryRef.getCallNumber());
            citation.getFields().add(field);
            citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqRepositoryRef.getCallNumber() : dqRepositoryRef.getCallNumber()));
          }
        }
        finally {
          ConversionContext.removeReference(repoContext);
        }
      }

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

      if (citation.getValue().length() > 0) {
View Full Code Here

Examples of org.gedcomx.source.CitationField

          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()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.