diff --git a/extensions/familysearch/familysearch-api-model/src/main/java/org/familysearch/platform/ct/FamilySearchFactType.java b/extensions/familysearch/familysearch-api-model/src/main/java/org/familysearch/platform/ct/FamilySearchFactType.java index 93b05deff..b7c19060a 100644 --- a/extensions/familysearch/familysearch-api-model/src/main/java/org/familysearch/platform/ct/FamilySearchFactType.java +++ b/extensions/familysearch/familysearch-api-model/src/main/java/org/familysearch/platform/ct/FamilySearchFactType.java @@ -30,21 +30,14 @@ ) public enum FamilySearchFactType implements ControlledVocabulary { + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // FamilySearch facts generally applicable within the scope of a person. + /** * Person fact type: Affiliation to something. */ Affiliation, - /** - * Parent Child fact type: A child's birth order to parents. - */ - BirthOrder, - - /** - * Couple fact type: Couple never had children. - */ - CoupleNeverHadChildren, - /** * Person fact type: Person died before age eight. */ @@ -55,11 +48,6 @@ public enum FamilySearchFactType implements ControlledVocabulary { */ LifeSketch, - /** - * Couple fact type: Couple lived together. - */ - LivedTogether, - /** * Person fact type: Person had no children. */ @@ -80,6 +68,74 @@ public enum FamilySearchFactType implements ControlledVocabulary { */ TribeName, + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // FamilySearch facts generally applicable within the scope of a couple. + + /** + * Couple fact type: Couple never had children. + */ + CoupleNeverHadChildren, + + /** + * Couple fact type: Couple lived together. + */ + LivedTogether, + + + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // FamilySearch facts generally applicable within the scope of a parent-child relationship. + + /** + * Parent Child fact type: A child's birth order to parents. + */ + BirthOrder, + + + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // FamilySearch facts generally applicable within the scope of an association. + // Apprenticeship, // exists as a core Gedcomx FactType http://gedcomx.org/Apprenticeship + /** + * A fact of a person's association. + */ + Association, + /** + * A fact of a person's emancipation. + */ + Emancipation, + /** + * A fact of a person's employment relationship. + */ + Employment, + /** + * A fact of a person's enslavement. + */ + Enslavement, + /** + * A fact of a person's friendship. + */ + Friendship, // may be Friend when sevice does actual work + /** + * A fact about the generational relationship between persons. + */ + Generation, + /** + * A fact about the godparenthood relationship between persons. + */ + Godparenthood, + /** + * A fact about a household relationship between persons. + */ + Household, + /** + * A fact about a neighborhood relationship between persons. + */ + Neighborhood, + /** + * A fact about a relative relationship between persons. + */ + Relative, + + @XmlUnknownQNameEnumValue OTHER; diff --git a/extensions/familysearch/familysearch-api-model/src/test/java/org/familysearch/platform/ct/FamilySearchFactTypeTest.java b/extensions/familysearch/familysearch-api-model/src/test/java/org/familysearch/platform/ct/FamilySearchFactTypeTest.java index 5f9f02056..b289d1667 100644 --- a/extensions/familysearch/familysearch-api-model/src/test/java/org/familysearch/platform/ct/FamilySearchFactTypeTest.java +++ b/extensions/familysearch/familysearch-api-model/src/test/java/org/familysearch/platform/ct/FamilySearchFactTypeTest.java @@ -31,6 +31,19 @@ public void testIt() { testType("http://familysearch.org/v1/TitleOfNobility", FamilySearchFactType.TitleOfNobility); testType("http://familysearch.org/v1/TribeName", FamilySearchFactType.TribeName); + // association fact types + //testType("http://familysearch.org/v1/Apprenticeship", FamilySearchFactType.Apprenticeship); // exists as a core Gedcomx FactType + testType("http://familysearch.org/v1/Association", FamilySearchFactType.Association); + testType("http://familysearch.org/v1/Emancipation", FamilySearchFactType.Emancipation); + testType("http://familysearch.org/v1/Employment", FamilySearchFactType.Employment); + testType("http://familysearch.org/v1/Enslavement", FamilySearchFactType.Enslavement); + testType("http://familysearch.org/v1/Friendship", FamilySearchFactType.Friendship); + testType("http://familysearch.org/v1/Generation", FamilySearchFactType.Generation); + testType("http://familysearch.org/v1/Godparenthood", FamilySearchFactType.Godparenthood); + testType("http://familysearch.org/v1/Household", FamilySearchFactType.Household); + testType("http://familysearch.org/v1/Neighborhood", FamilySearchFactType.Neighborhood); + testType("http://familysearch.org/v1/Relative", FamilySearchFactType.Relative); + // make sure all are tested for (FamilySearchFactType type : FamilySearchFactType.values()) { if ((!typesTested.contains(type)) && (!FamilySearchFactType.OTHER.equals(type))) { diff --git a/gedcomx-model/src/main/java/org/gedcomx/types/FactType.java b/gedcomx-model/src/main/java/org/gedcomx/types/FactType.java index 9c311b09a..3e5379524 100644 --- a/gedcomx-model/src/main/java/org/gedcomx/types/FactType.java +++ b/gedcomx-model/src/main/java/org/gedcomx/types/FactType.java @@ -36,6 +36,7 @@ ) public enum FactType implements ControlledVocabulary { + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// // facts generally applicable within the scope of a person. /** @@ -59,7 +60,6 @@ public enum FactType implements ControlledVocabulary { /** * A fact of a person's apprenticeship. */ - @Facet ( GedcomxConstants.FACET_FS_FT_UNSUPPORTED ) Apprenticeship, /** @@ -355,7 +355,7 @@ public enum FactType implements ControlledVocabulary { Obituary, /** - * A fact of a person's occupation or employment. + * A fact of a person's occupation. */ Occupation, @@ -443,6 +443,7 @@ public enum FactType implements ControlledVocabulary { */ Yahrzeit, + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// // facts generally applicable within the scope of a couple. /** @@ -525,6 +526,7 @@ public enum FactType implements ControlledVocabulary { @Facet ( GedcomxConstants.FACET_FS_FT_UNSUPPORTED ) Separation, + // ////////////////////////////////////////////////////////////////////////////////////////////////////////// // facts generally applicable within the scope of a parent-child relationship. /** @@ -626,7 +628,7 @@ private static FactType include(FactType type) { PERSON_FACT_TYPES.add(type); return type; } - + public static final FactType Adoption = include(FactType.Adoption); public static final FactType AdultChristening = include(FactType.AdultChristening); public static final FactType Amnesty = include(FactType.Amnesty); @@ -701,7 +703,7 @@ private static FactType include(FactType type) { /** * Whether the given fact type is applicable to a person. - * + * * @param type The fact type. * @return Whether the given fact type is applicable to a person. */ @@ -719,7 +721,7 @@ private static FactType include(FactType type) { COUPLE_FACT_TYPES.add(type); return type; } - + public static final FactType Annulment = include(FactType.Annulment); public static final FactType CommonLawMarriage = include(FactType.CommonLawMarriage); public static final FactType CivilUnion = include(FactType.CivilUnion); @@ -737,7 +739,7 @@ private static FactType include(FactType type) { /** * Whether the given fact type is applicable to a couple. - * + * * @param type The fact type. * @return Whether the given fact type is applicable to a couple. */ @@ -766,7 +768,7 @@ private static FactType include(FactType type) { /** * Whether the given fact type is applicable to a parent-child relationship. - * + * * @param type The fact type. * @return Whether the given fact type is applicable to a parent-child relationship. */ diff --git a/gedcomx-model/src/main/java/org/gedcomx/types/RelationshipType.java b/gedcomx-model/src/main/java/org/gedcomx/types/RelationshipType.java index c2c408f26..89fe61125 100644 --- a/gedcomx-model/src/main/java/org/gedcomx/types/RelationshipType.java +++ b/gedcomx-model/src/main/java/org/gedcomx/types/RelationshipType.java @@ -15,6 +15,10 @@ */ package org.gedcomx.types; +import java.util.Collections; +import java.util.EnumSet; +import java.util.Set; + import com.webcohesion.enunciate.metadata.qname.XmlQNameEnum; import com.webcohesion.enunciate.metadata.qname.XmlUnknownQNameEnumValue; import org.gedcomx.common.URI; @@ -31,13 +35,29 @@ public enum RelationshipType implements ControlledVocabulary { AncestorDescendant, + Apprentice, + Associate, Couple, + Employer, EnslavedBy, + Friend, Godparent, + HeadOfHousehold, + HonoredAncestor, + Neighbor, ParentChild, + Relative, @XmlUnknownQNameEnumValue OTHER; + public final static Set ASSOCIATION_RELATIONSHIP_TYPES = Collections.unmodifiableSet(EnumSet.of(AncestorDescendant, Apprentice, Associate, + Employer, EnslavedBy, Friend, Godparent, + HeadOfHousehold, HonoredAncestor, Neighbor, + Relative)); + public boolean isAssociationRelationshipType() { + return ASSOCIATION_RELATIONSHIP_TYPES.contains(this); + } + private static final EnumURIMap URI_MAP = new EnumURIMap(RelationshipType.class, GedcomxConstants.GEDCOMX_TYPES_NAMESPACE); /** @@ -59,4 +79,4 @@ public static RelationshipType fromQNameURI(URI qname) { return URI_MAP.fromURIValue(qname); } -} \ No newline at end of file +}