Package org.gedcomx.conclusion

Examples of org.gedcomx.conclusion.Relationship


    Family dqFamily = gedcom.getFamilies().get(0);

    mapper.toRelationship(dqFamily, gedcom, result);
    assertEquals(result.getRelationships().size(), 5);

    Relationship relCouple = testRelationship(0, RelationshipType.Couple, "I1", "I11", 1);
    assertSize(relCouple.getSources(), 1);
    assertSize(relCouple.getNotes(), 0);

    testRelationship(1, RelationshipType.ParentChild, "I1", "I2", 0);
    testRelationship(2, RelationshipType.ParentChild, "I11", "I2", 0);
    testRelationship(3, RelationshipType.ParentChild, "I1", "I8", 0);
    testRelationship(4, RelationshipType.ParentChild, "I11", "I8", 0);
View Full Code Here


    Family dqFamily = gedcom.getFamilies().get(1);

    mapper.toRelationship(dqFamily, gedcom, result);
    assertEquals(result.getRelationships().size(), 3);

    Relationship relCouple = testRelationship(0, RelationshipType.Couple, "I15", "I14", 1);
    assertSize(relCouple.getSources(), 0);
    assertSize(relCouple.getNotes(), 0);

    testRelationship(1, RelationshipType.ParentChild, "I15", "I1", 0);
    testRelationship(2, RelationshipType.ParentChild, "I14", "I1", 0);
  }
View Full Code Here

    Family dqFamily = gedcom.getFamilies().get(2);

    mapper.toRelationship(dqFamily, gedcom, result);
    assertEquals(result.getRelationships().size(), 1);

    Relationship relCouple = testRelationship(0, RelationshipType.Couple, "I117", "I14", 2);
    assertSize(relCouple.getSources(), 1);
    assertSize(relCouple.getNotes(), 0);
  }
View Full Code Here

  }

  @Test
  public void testFamilyF20() throws Exception {
    // Test child to family facts
    Relationship rel;
    FamilyMapper mapper = new FamilyMapper();
    Family dqFamily = gedcom.getFamilies().get(3);

    mapper.toRelationship(dqFamily, gedcom, result);
    assertEquals(result.getRelationships().size(), 9);
View Full Code Here

  }

  @Test
  public void testFamilyF25() throws Exception {
    // Test couple facts
    Relationship rel;
    FamilyMapper mapper = new FamilyMapper();
    Family dqFamily = gedcom.getFamilies().get(8);

    mapper.toRelationship(dqFamily, gedcom, result);
    assertEquals(result.getRelationships().size(), 1);

    rel = testRelationship(0, RelationshipType.Couple, "I1006", "I1007", 17);
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.NumberOfChildren, "5", null, null);
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Annulment, null, "31 MAR 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Engagement, null, "1 JAN 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.DivorceFiling, null, "1 APR 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Divorce, null, "2 APR 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.MarriageBanns, null, "1 DEC 1931", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.MarriageLicense, null, "3 MAY 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.MarriageContract, null, "4 JUL 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Residence, null, "5 NOV 1932", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.CommonLawMarriage, null, null, null);
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Divorce, null, "2 APR 1900", "San Francisco, California, United States");
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Separation, null, "DEC 1896", null);
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Separation, null, "DEC 1897", null);
    PersonsFactsTest.checkFact(rel.getFacts(), FactType.Separation, null, "DEC 1898", null);
  }
View Full Code Here

      assertEquals(list.size(), count);
    }
  }

  private Relationship testRelationship(int relNumber, RelationshipType relationshipType, String person1Id, String person2Id, int factCount) {
    Relationship relationship = result.getRelationships().get(relNumber);
    testRelationship(relationship, relationshipType, person1Id, person2Id, factCount);
    return relationship;
  }
View Full Code Here

   * @param personId2  the GEDCOM 5.5 identifier associated with the person 1
   * @param relationshipType  the relationship type
   * @return relationship that was added
   */
  public static Relationship toRelationship(String familyId, String personId1, String personId2, RelationshipType relationshipType) {
    Relationship relationship = new Relationship();

    relationship.setKnownType(relationshipType);
    relationship.setId(familyId + '-' + personId1 + '-' + personId2);
    relationship.setPerson1(toReference(personId1));
    relationship.setPerson2(toReference(personId2));

    return relationship;
  }
View Full Code Here

    List<SpouseRef> husbands = dqFamily.getHusbandRefs();
    String husbandId = husbands.size() > 0 ? husbands.get(0).getRef() : null;
    List<SpouseRef> wives = dqFamily.getWifeRefs();
    String wifeId = wives.size() > 0 ? wives.get(0).getRef() : null;
    Relationship coupleRelationship = null;

    Date lastModified = CommonMapper.toDate(dqFamily.getChange()); //todo: set the timestamp on the attribution?

    if ( husbandId != null && wifeId != null) {
      coupleRelationship = CommonMapper.toRelationship(familyId, husbandId, wifeId, RelationshipType.Couple);
      result.addRelationship(coupleRelationship);
    }

    for (ChildRef child : dqFamily.getChildRefs()) {
      String childId = child.getRef();

      Person dqChild = (dqGedcom == null) ? null : dqGedcom.getPerson(childId);
      List<ParentFamilyRef> childToFamilyLinks;
      if (dqChild != null) {
        childToFamilyLinks = dqChild.getParentFamilyRefs();
      } else {
        logger.warn(ConversionContext.getContext(), "Could not find referenced child (@{}@ INDI).", childId);
        childToFamilyLinks = Collections.<ParentFamilyRef>emptyList();
      }

      if (husbandId != null) {
        Relationship gedxRelationship = CommonMapper.toRelationship(familyId, husbandId, childId, RelationshipType.ParentChild);
        addFacts(gedxRelationship, familyId, childToFamilyLinks);
        result.addRelationship(gedxRelationship);
      }
      if (wifeId != null) {
        Relationship gedxRelationship = CommonMapper.toRelationship(familyId, wifeId, childId, RelationshipType.ParentChild);
        addFacts(gedxRelationship, familyId, childToFamilyLinks);
        result.addRelationship(gedxRelationship);
      }
    }
View Full Code Here

TOP

Related Classes of org.gedcomx.conclusion.Relationship

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.