Beispiel #1
0
        public virtual void VisitChildAndParentsRelationship(ChildAndParentsRelationship pcr)
        {
            this.contextStack.Push(pcr);
            VisitConclusion(pcr);

            List <Fact> facts;

            facts = pcr.FatherFacts;
            if (facts != null)
            {
                foreach (Fact fact in facts)
                {
                    fact.Accept(this);
                }
            }

            facts = pcr.MotherFacts;
            if (facts != null)
            {
                foreach (Fact fact in facts)
                {
                    fact.Accept(this);
                }
            }

            this.contextStack.Pop();
        }
Beispiel #2
0
 /**
  * Add a childAndParentsRelationship to the data set.
  *
  * @param childAndParentsRelationship The childAndParentsRelationship to be added.
  */
 public void AddChildAndParentsRelationship(ChildAndParentsRelationship childAndParentsRelationship)
 {
     if (childAndParentsRelationship != null)
     {
         if (_childAndParentsRelationships == null)
         {
             _childAndParentsRelationships = new List <ChildAndParentsRelationship>();
         }
         _childAndParentsRelationships.Add(childAndParentsRelationship);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Display Mother Relationship facts.
        /// </summary>
        /// <param name="pRelationship">Relationship of Mother</param>
        private void displayMotherRelationship(ChildAndParentsRelationship pRelationship)
        {
            //Show Mother ID.
            listBoxDisplayFacts.Items.Add("Mother rescource ID: " + pRelationship.Mother.ResourceId);

            //Show Relationship.
            foreach (var aFact in pRelationship.MotherFacts ?? new List <Fact>())
            {
                listBoxDisplayFacts.Items.Add(aFact.KnownType.ToString());
            }
        }
Beispiel #4
0
        /// <summary>
        /// Adds a child and parents relationship to the current relationships collection.
        /// </summary>
        /// <param name="chap">The relationship to add to the current relationships collection, with the father, mother, and child set as desired.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="ChildAndParentsRelationshipState"/> instance containing the REST API response.
        /// </returns>
        public ChildAndParentsRelationshipState AddChildAndParentsRelationship(ChildAndParentsRelationship chap, params IStateTransitionOption[] options)
        {
            FamilySearchPlatform entity = new FamilySearchPlatform();

            entity.ChildAndParentsRelationships = new List <ChildAndParentsRelationship>()
            {
                chap
            };
            IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).Build(GetSelfUri(), Method.POST);

            return(((FamilyTreeStateFactory)this.stateFactory).NewChildAndParentsRelationshipState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }
Beispiel #5
0
        /// <summary>
        /// Adds a child and parents relationship to the collection.
        /// </summary>
        /// <param name="child">The child to add in the relationship.</param>
        /// <param name="father">The father to add in the relationship.</param>
        /// <param name="mother">The mother to add in the relationship.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="ChildAndParentsRelationshipState"/> instance containing the REST API response.
        /// </returns>
        public ChildAndParentsRelationshipState AddChildAndParentsRelationship(PersonState child, PersonState father, PersonState mother, params IStateTransitionOption[] options)
        {
            ChildAndParentsRelationship chap = new ChildAndParentsRelationship();

            chap.Child = new ResourceReference(child.GetSelfUri());
            if (father != null)
            {
                chap.Father = new ResourceReference(father.GetSelfUri());
            }
            if (mother != null)
            {
                chap.Mother = new ResourceReference(mother.GetSelfUri());
            }
            return(AddChildAndParentsRelationship(chap, options));
        }
Beispiel #6
0
        /// <summary>
        /// Reads the child and parents relationship of the current person.
        /// </summary>
        /// <param name="relationship">The relationship to be read.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="ChildAndParentsRelationshipState"/> instance containing the REST API response.
        /// </returns>
        public ChildAndParentsRelationshipState ReadChildAndParentsRelationship(ChildAndParentsRelationship relationship, params IStateTransitionOption[] options)
        {
            Link link = relationship.GetLink(Rel.RELATIONSHIP);

            link = link == null?relationship.GetLink(Rel.SELF) : link;

            if (link == null || link.Href == null)
            {
                return(null);
            }

            IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).Build(link.Href, Method.GET);

            return(((FamilyTreeStateFactory)this.stateFactory).NewChildAndParentsRelationshipState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }
Beispiel #7
0
        /// <summary>
        /// Adds a child and parents relationship to the collection.
        /// </summary>
        /// <param name="chap">The child and parent relationship to add.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="ChildAndParentsRelationshipState"/> instance containing the REST API response.
        /// </returns>
        /// <exception cref="Gx.Rs.Api.GedcomxApplicationException">Thrown if a link to the required resource cannot be found.</exception>
        public ChildAndParentsRelationshipState AddChildAndParentsRelationship(ChildAndParentsRelationship chap, params IStateTransitionOption[] options)
        {
            Link link = GetLink(Rel.RELATIONSHIPS);

            if (link == null || link.Href == null)
            {
                throw new GedcomxApplicationException(String.Format("FamilySearch Family Tree at {0} didn't provide a 'relationships' link.", GetUri()));
            }

            FamilySearchPlatform entity = new FamilySearchPlatform();

            entity.ChildAndParentsRelationships = new List <ChildAndParentsRelationship>()
            {
                chap
            };
            IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).Build(link.Href, Method.POST);

            request.SetEntity(entity);
            return(((FamilyTreeStateFactory)this.stateFactory).NewChildAndParentsRelationshipState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }
Beispiel #8
0
        public static ChildAndParentsRelationship GetCreateChildAndParentsRelationship(PersonState father = null, PersonState mother = null, PersonState child = null)
        {
            var result = new ChildAndParentsRelationship();

            if (father != null)
            {
                result.Father = new ResourceReference(father.GetSelfUri());
            }

            if (mother != null)
            {
                result.Mother = new ResourceReference(mother.GetSelfUri());
            }

            if (child != null)
            {
                result.Child = new ResourceReference(child.GetSelfUri());
            }

            return(result);
        }
Beispiel #9
0
 /**
  * Build out this document with a child-and-parents relationship.
  *
  * @param chap The child-and-parents relationship
  */
 public FamilySearchPlatform SetChildAndParentsRelationship(ChildAndParentsRelationship chap)
 {
     AddChildAndParentsRelationship(chap);
     return(this);
 }
 public override void VisitChildAndParentsRelationship(ChildAndParentsRelationship pcr)
 {
     BindIfNeeded(pcr);
     base.VisitChildAndParentsRelationship(pcr);
 }