Examples of Gedcom


Examples of genj.gedcom.Gedcom

    }
   
    // the last part of the gedcomURL should be the individual id
    // if the gedcomURL does not end in an individual id then the
    // data for the first person in the gedcom is retrieved
    Gedcom gedcom = gedcomURL.loadGedcom(networkReload, request);
    Indi indi;
    if(gedcomURL.isValidIndividualId())
    {
      indi = (Indi)gedcom.getEntity(Gedcom.INDI, gedcomURL.getIndividualId());
      if(indi == null)
      {
        throw new ServletException(ErrorCodes.NONEXISTANT_INDI.getErrorMessage(new Object[] {gedcomURL.getIndividualId(), gedcomURL.getGedcomURL()}));
      }
    }
    else
    {
      indi = (Indi)gedcom.getFirstEntity(Gedcom.INDI);
      if(indi == null)
      {
        throw new ServletException(ErrorCodes.NO_INDIVIDUALS.getErrorMessage(new Object[] {gedcomURL.getGedcomURL()}));
      }
      gedcomURL.setIndividualId(indi.getId());
    }
   
    //switch on the view to know how to get the correct view data into X-JSON format
    BaseView baseView = null;
    switch(view)
    {
      case FAMILY_VIEW:
        LOG.finest("The gedapi view is: family: "+indi);
        //create family view java classes like described in vraptor2 (spouse, individual, parent, child, marriage), populate the
        //top level vraptor2 FamilyView class with the correct number of instances of spouse, individual, parent, child, marriage
        //objects and then use vraptor2 to serialize the FamilyView into a JSON string and send that back to the browser
        baseView = Gedcom2View.familyView(indi, networkReload, gedcomURL);
        break;
      case PEDIGREE_VIEW:
        LOG.finest("The gedapi view is: pedigree: "+indi);
        baseView = Gedcom2View.pedigreeView(indi, networkReload, gedcomURL);
        break;
      case INDIVIDUAL_VIEW:
        LOG.finest("The gedapi view is: individual list: "+indi);
        baseView = Gedcom2View.individualListView(gedcom, networkReload, gedcomURL);
        break;
      case GEDCOM_SEARCH_VIEW:
        LOG.finest("The gedapi view is: GEDCOM Search: "+indi);
        baseView = Gedcom2View.gedcomSearchView(gedcom, gedcomURL, searchCriteria, searchScope);
        break;
      case SUBMITTER_VIEW:
        SSOSubject authenticated = (SSOSubject)request.getAttribute(SSOSubject.SSOSUBJECT_KEY);
        if(authenticated == null)
        {
        throw new ServletException("The request does not have an "+SSOSubject.SSOSUBJECT_KEY+" attribute, this is not allowed!!!");
        }
        LOG.finest("The gedapi view is: submitter: "+indi);
        baseView = Gedcom2View.gedcomSubmitterView(gedcom, gedcomURL);
        break;
      case ALL_GLINKS_VIEW:
        LOG.finest("The gedapi view is: ALL_GLINKS: "+indi);
        baseView = Gedcom2View.gedcomAllGLinksView(gedcom, gedcomURL);
        break;
      default:
        throw new ServletException(ErrorCodes.VIEW_NOT_SUPPORTED.getErrorMessage(new Object[] {view, gedcomURL}));
    }
   
    long gedcomLastModified = gedcom.getOrigin().getLastModified();
    if(gedcomLastModified > baseView.lastModified)
    {
      baseView.lastModified = gedcomLastModified;
    }
   
View Full Code Here

Examples of genj.gedcom.Gedcom

    // memcached and the java libraries to access it, the data OUGHT to be
    // set to never expire; the key to the object in memory is the gedcomURL!!!
    File localGedcomFile = downloadGedcomURL(networkReload, request);
    String localGedcomPath = localGedcomFile.getAbsolutePath();
    String filename = "file://"+(localGedcomPath.startsWith("/") ? localGedcomPath : "/"+localGedcomPath);
    Gedcom gedcom = gedcomCache.get(gedcomURL);
   
    if(gedcom != null)
    {
      LOG.finest("gedcom.getOrigin().getLastModified(): "+gedcom.getOrigin().getLastModified());
      LOG.finest("localGedcomFile.lastModified(): "+localGedcomFile.lastModified());
    }
   
    if(gedcom == null || (gedcom.getOrigin().getLastModified() < localGedcomFile.lastModified()))
    {
      synchronized(gedcomCache)
      {
        LOG.finest("Creating the Origin for the GEDCOM file: "+localGedcomPath);
        Origin origin = Origin.create(filename, new Handler());
View Full Code Here

Examples of org.folg.gedcom.model.Gedcom

    out.close();
  }

  private void convert55File(File inFile, OutputStream outputStream) throws SAXParseException, IOException {
    ModelParser modelParser = new ModelParser();
    Gedcom gedcom = modelParser.parseGedcom(inFile);
    gedcom.createIndexes();

    if (outputStream != null) {
      GedcomMapper mapper = new GedcomMapper();
      GedcomxEntrySerializer serializer;
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

    @Test
    public void testIssue61Loose() throws IOException, GedcomParserException {
        GedcomParser gp = new GedcomParser();
        gp.strictCustomTags = false;
        gp.load("sample/Harry_Potter.ged");
        Gedcom g = gp.gedcom;
        assertNotNull(g);
        assertTrue(gp.errors.isEmpty());
        for (Individual i : g.individuals.values()) {
            assertNotNull(i);
            assertNotNull(i.customTags);
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

     * Test for {@link GedcomValidator#validateIndividuals()} with a malformed
     * xref on an individual, which does not match its key in the individuals
     * map
     */
    public void testValidateIndividuals2() {
        Gedcom g = TestHelper.getMinimalGedcom();

        // Deliberately introduce a problem
        Individual i = new Individual();
        i.xref = "FryingPan";
        g.individuals.put("WrongKey", i);
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

    @Test
    public void testIssue61Strict() throws IOException, GedcomParserException {
        GedcomParser gp = new GedcomParser();
        gp.strictCustomTags = true;
        gp.load("sample/Harry_Potter.ged");
        Gedcom g = gp.gedcom;
        assertNotNull(g);
        assertTrue(!gp.errors.isEmpty());
        for (String e : gp.errors) {
            // These are the bad tags that were deliberately introduced
            assertTrue(e.contains("WAND") || e.contains("MUGL"));
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

    @Test
    public void testNonStdTagsNotWritten() throws IOException, GedcomParserException, GedcomWriterException {
        // Read original non-standard file, find non-standard birth event, assert some pre-conditions
        GedcomParser gp = new GedcomParser();
        gp.load("sample/Event Tag Test.ged");
        Gedcom gBefore = gp.gedcom;
        assertNotNull(gBefore);

        assertEquals(1, gBefore.individuals.size());
        Individual iBefore = gBefore.individuals.get("@I1@");
        assertNotNull(iBefore);

        assertNotNull(iBefore.events);
        assertEquals(4, iBefore.events.size());
        IndividualEvent eBefore = iBefore.events.get(0); // The birth event
        assertNotNull(eBefore);
        assertEquals(IndividualEventType.BIRTH, eBefore.type);
        assertNull(eBefore.yNull);
        assertNotNull(eBefore.description);

        // Write the file back out in standard format
        String fn = "tmp/" + this.getClass().getName() + ".ged";
        GedcomWriter gw = new GedcomWriter(gBefore);
        gw.validationSuppressed = true;
        gw.write(fn);

        // Read the file we just wrote back in. The non-standard part should be removed.
        gp = new GedcomParser();
        gp.load(fn);
        Gedcom gAfter = gp.gedcom;
        assertNotNull(gBefore);

        assertEquals(1, gAfter.individuals.size());
        Individual iAfter = gAfter.individuals.get("@I1@");
        assertNotNull(iAfter);
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

    @Test
    public void testValidation() throws IOException, GedcomParserException, GedcomWriterException {
        // Read original non-standard file, find non-standard birth event, assert some pre-conditions
        GedcomParser gp = new GedcomParser();
        gp.load("sample/Event Tag Test.ged");
        Gedcom gBefore = gp.gedcom;
        assertNotNull(gBefore);

        assertEquals(1, gBefore.individuals.size());
        Individual iBefore = gBefore.individuals.get("@I1@");
        assertNotNull(iBefore);
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

     * {@inheritDoc}
     */
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        gedcom = new Gedcom();
        rootValidator = new GedcomValidator(gedcom);
    }
View Full Code Here

Examples of org.gedcom4j.model.Gedcom

    /**
     * Test autorepairing
     */
    public void testAutoRepair() {
        Gedcom g = new Gedcom();

        // Deliberately introduce error
        g.individuals = null;

        // Go validate
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.