Skip to content

Commit dd8bfad

Browse files
committed
new RelationshipType's and FactType's for Associations
1 parent 44124ca commit dd8bfad

File tree

4 files changed

+89
-8
lines changed

4 files changed

+89
-8
lines changed

extensions/familysearch/familysearch-api-model/src/main/java/org/familysearch/platform/ct/FamilySearchFactType.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,52 @@ public enum FamilySearchFactType implements ControlledVocabulary {
8080
*/
8181
TribeName,
8282

83+
// //////////////////////////////////////////////////////////////////////////////////////////////////////////
84+
// FamilySearch facts generally applicable within the scope of an association.
85+
// association fact types
86+
// Apprenticeship, // exists as a core Gedcomx FactType
87+
/**
88+
* A fact of a person's association.
89+
*/
90+
Association,
91+
/**
92+
* A fact of a person's emancipation.
93+
*/
94+
Emancipation,
95+
/**
96+
* A fact of a person's employment relationship.
97+
*/
98+
Employment,
99+
/**
100+
* A fact of a person's enslavement.
101+
*/
102+
Enslavement,
103+
/**
104+
* A fact of a person's friendship.
105+
*/
106+
Friendship, // may be Friend when sevice does actual work
107+
/**
108+
* A fact about the generational relationship between persons.
109+
*/
110+
Generation,
111+
/**
112+
* A fact about the godparenthood relationship between persons.
113+
*/
114+
Godparenthood,
115+
/**
116+
* A fact about a household relationship between persons.
117+
*/
118+
Household,
119+
/**
120+
* A fact about a neighborhood relationship between persons.
121+
*/
122+
Neighborhood,
123+
/**
124+
* A fact about a relative relationship between persons.
125+
*/
126+
Relative,
127+
128+
83129
@XmlUnknownQNameEnumValue
84130
OTHER;
85131

extensions/familysearch/familysearch-api-model/src/test/java/org/familysearch/platform/ct/FamilySearchFactTypeTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ public void testIt() {
3131
testType("http://familysearch.org/v1/TitleOfNobility", FamilySearchFactType.TitleOfNobility);
3232
testType("http://familysearch.org/v1/TribeName", FamilySearchFactType.TribeName);
3333

34+
// association fact types
35+
//testType("http://familysearch.org/v1/Apprenticeship", FamilySearchFactType.Apprenticeship); // exists as a core Gedcomx FactType
36+
testType("http://familysearch.org/v1/Association", FamilySearchFactType.Association);
37+
testType("http://familysearch.org/v1/Emancipation", FamilySearchFactType.Emancipation);
38+
testType("http://familysearch.org/v1/Employment", FamilySearchFactType.Employment);
39+
testType("http://familysearch.org/v1/Enslavement", FamilySearchFactType.Enslavement);
40+
testType("http://familysearch.org/v1/Friendship", FamilySearchFactType.Friendship);
41+
testType("http://familysearch.org/v1/Generation", FamilySearchFactType.Generation);
42+
testType("http://familysearch.org/v1/Godparenthood", FamilySearchFactType.Godparenthood);
43+
testType("http://familysearch.org/v1/Household", FamilySearchFactType.Household);
44+
testType("http://familysearch.org/v1/Neighborhood", FamilySearchFactType.Neighborhood);
45+
testType("http://familysearch.org/v1/Relative", FamilySearchFactType.Relative);
46+
3447
// make sure all are tested
3548
for (FamilySearchFactType type : FamilySearchFactType.values()) {
3649
if ((!typesTested.contains(type)) && (!FamilySearchFactType.OTHER.equals(type))) {

gedcomx-model/src/main/java/org/gedcomx/types/FactType.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
)
3737
public enum FactType implements ControlledVocabulary {
3838

39+
// //////////////////////////////////////////////////////////////////////////////////////////////////////////
3940
// facts generally applicable within the scope of a person.
4041

4142
/**
@@ -59,7 +60,6 @@ public enum FactType implements ControlledVocabulary {
5960
/**
6061
* A fact of a person's apprenticeship.
6162
*/
62-
@Facet ( GedcomxConstants.FACET_FS_FT_UNSUPPORTED )
6363
Apprenticeship,
6464

6565
/**
@@ -355,7 +355,7 @@ public enum FactType implements ControlledVocabulary {
355355
Obituary,
356356

357357
/**
358-
* A fact of a person's occupation or employment.
358+
* A fact of a person's occupation.
359359
*/
360360
Occupation,
361361

@@ -443,6 +443,7 @@ public enum FactType implements ControlledVocabulary {
443443
*/
444444
Yahrzeit,
445445

446+
// //////////////////////////////////////////////////////////////////////////////////////////////////////////
446447
// facts generally applicable within the scope of a couple.
447448

448449
/**
@@ -525,6 +526,7 @@ public enum FactType implements ControlledVocabulary {
525526
@Facet ( GedcomxConstants.FACET_FS_FT_UNSUPPORTED )
526527
Separation,
527528

529+
// //////////////////////////////////////////////////////////////////////////////////////////////////////////
528530
// facts generally applicable within the scope of a parent-child relationship.
529531

530532
/**
@@ -626,7 +628,7 @@ private static FactType include(FactType type) {
626628
PERSON_FACT_TYPES.add(type);
627629
return type;
628630
}
629-
631+
630632
public static final FactType Adoption = include(FactType.Adoption);
631633
public static final FactType AdultChristening = include(FactType.AdultChristening);
632634
public static final FactType Amnesty = include(FactType.Amnesty);
@@ -701,7 +703,7 @@ private static FactType include(FactType type) {
701703

702704
/**
703705
* Whether the given fact type is applicable to a person.
704-
*
706+
*
705707
* @param type The fact type.
706708
* @return Whether the given fact type is applicable to a person.
707709
*/
@@ -719,7 +721,7 @@ private static FactType include(FactType type) {
719721
COUPLE_FACT_TYPES.add(type);
720722
return type;
721723
}
722-
724+
723725
public static final FactType Annulment = include(FactType.Annulment);
724726
public static final FactType CommonLawMarriage = include(FactType.CommonLawMarriage);
725727
public static final FactType CivilUnion = include(FactType.CivilUnion);
@@ -737,7 +739,7 @@ private static FactType include(FactType type) {
737739

738740
/**
739741
* Whether the given fact type is applicable to a couple.
740-
*
742+
*
741743
* @param type The fact type.
742744
* @return Whether the given fact type is applicable to a couple.
743745
*/
@@ -766,7 +768,7 @@ private static FactType include(FactType type) {
766768

767769
/**
768770
* Whether the given fact type is applicable to a parent-child relationship.
769-
*
771+
*
770772
* @param type The fact type.
771773
* @return Whether the given fact type is applicable to a parent-child relationship.
772774
*/

gedcomx-model/src/main/java/org/gedcomx/types/RelationshipType.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
package org.gedcomx.types;
1717

18+
import java.util.Collections;
19+
import java.util.EnumSet;
20+
import java.util.Set;
21+
1822
import com.webcohesion.enunciate.metadata.qname.XmlQNameEnum;
1923
import com.webcohesion.enunciate.metadata.qname.XmlUnknownQNameEnumValue;
2024
import org.gedcomx.common.URI;
@@ -31,13 +35,29 @@
3135
public enum RelationshipType implements ControlledVocabulary {
3236

3337
AncestorDescendant,
38+
Apprentice,
39+
Associate,
3440
Couple,
41+
Employer,
3542
EnslavedBy,
43+
Friend,
3644
Godparent,
45+
HeadOfHousehold,
46+
HonoredAncestor,
47+
Neighbor,
3748
ParentChild,
49+
Relative,
3850
@XmlUnknownQNameEnumValue
3951
OTHER;
4052

53+
public final static Set<RelationshipType> ASSOCIATION_RELATIONSHIP_TYPES = Collections.unmodifiableSet(EnumSet.of(AncestorDescendant, Apprentice, Associate,
54+
Employer, EnslavedBy, Friend, Godparent,
55+
HeadOfHousehold, HonoredAncestor, Neighbor,
56+
Relative));
57+
public boolean isAssociationRelationshipType() {
58+
return ASSOCIATION_RELATIONSHIP_TYPES.contains(this);
59+
}
60+
4161
private static final EnumURIMap<RelationshipType> URI_MAP = new EnumURIMap<RelationshipType>(RelationshipType.class, GedcomxConstants.GEDCOMX_TYPES_NAMESPACE);
4262

4363
/**
@@ -59,4 +79,4 @@ public static RelationshipType fromQNameURI(URI qname) {
5979
return URI_MAP.fromURIValue(qname);
6080
}
6181

62-
}
82+
}

0 commit comments

Comments
 (0)