Beispiel #1
0
        /// <summary>
        /// Adds an evidence reference to the current relationship.
        /// </summary>
        /// <param name="evidence">The evidence reference to add.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="RelationshipState"/> instance containing the REST API response.
        /// </returns>
        public RelationshipState AddEvidenceReference(RelationshipState evidence, params IStateTransitionOption[] options)
        {
            EvidenceReference reference = new EvidenceReference();

            reference.Resource = evidence.GetSelfUri();
            return(AddEvidenceReference(reference, options));
        }
Beispiel #2
0
 /**
  * Add an evidence reference for this subject.
  *
  * @param evidenceRef The evidence to be added.
  */
 public void AddEvidence(EvidenceReference evidenceRef)
 {
     if (evidenceRef != null)
     {
         if (_evidence == null)
         {
             _evidence = new List <EvidenceReference>();
         }
         _evidence.Add(evidenceRef);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Deletes the evidence reference from the current relationship.
        /// </summary>
        /// <param name="reference">The evidence reference to delete.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="RelationshipState"/> instance containing the REST API response.
        /// </returns>
        /// <exception cref="Gx.Rs.Api.GedcomxApplicationException">Thrown if this collection does not have a link to the resource.</exception>
        public RelationshipState DeleteEvidenceReference(EvidenceReference reference, params IStateTransitionOption[] options)
        {
            Link link = reference.GetLink(Rel.EVIDENCE_REFERENCE);

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

            if (link == null || link.Href == null)
            {
                throw new GedcomxApplicationException("Evidence reference cannot be deleted: missing link.");
            }

            IRestRequest request = CreateAuthenticatedGedcomxRequest().Build(link.Href, Method.DELETE);

            return(this.stateFactory.NewRelationshipState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }
 public virtual void VisitEvidenceReference(EvidenceReference evidenceReference)
 {
     //no-op
 }
Beispiel #5
0
 /**
  * Build up this subject with an persona reference.
  *
  * @param persona The persona reference.
  * @return this.
  */
 public Subject SetPersonaReference(EvidenceReference persona)
 {
     AddEvidence(persona);
     return(this);
 }
Beispiel #6
0
 /// <summary>
 /// Update the evidence reference for the current relationship.
 /// </summary>
 /// <param name="reference">The evidence reference to update.</param>
 /// <param name="options">The options to apply before executing the REST API call.</param>
 /// <returns>
 /// A <see cref="RelationshipState"/> instance containing the REST API response.
 /// </returns>
 public RelationshipState UpdateEvidenceReference(EvidenceReference reference, params IStateTransitionOption[] options)
 {
     return(UpdateEvidenceReferences(new EvidenceReference[] { reference }, options));
 }
Beispiel #7
0
 public override void VisitEvidenceReference(EvidenceReference evidenceReference)
 {
     BindIfNeeded(evidenceReference);
     base.VisitEvidenceReference(evidenceReference);
 }
Beispiel #8
0
 /**
  * Build up this subject with an evidence reference.
  *
  * @param evidence The evidence reference.
  * @return this.
  */
 public Subject SetEvidence(EvidenceReference evidence)
 {
     AddEvidence(evidence);
     return(this);
 }