public List <IRelationship> getRelationshipsOfType(ERelationshipType relationshipType)
        {
            switch (relationshipType)
            {
            case ERelationshipType.aegtefaelle: return(aegtefaelle());

            case ERelationshipType.boern: return(boern());

            case ERelationshipType.bopaelssamling: return(bopaelssamling());

            case ERelationshipType.erstatingAf: return(erstatingAf());

            case ERelationshipType.erstatingFor: return(erstatingFor());

            case ERelationshipType.fader: return(fader());

            case ERelationshipType.foraeldremydighedsboern: return(foraeldremydighedsboern());

            case ERelationshipType.foraeldremyndighedsindehaver: return(foraeldremyndighedsindehaver());

            case ERelationshipType.moder: return(moder());

            case ERelationshipType.registreretPartner: return(registreretPartner());

            case ERelationshipType.retligHandleevneVaergeForPersonen: return(retligHandleevneVaergeForPersonen());

            case ERelationshipType.retligHandleevneVaergemaalsindehaver: return(retligHandleevneVaergemaalsindehaver());

            default: throw new ArgumentException();     //If ERelationshipType is modified it will be caught
            }
        }
            /**
             * helper method to make the class immutable
             * @param referencedValues IRelationship representations of Relationships
             * @return  of a copy of the referencedValues
             */
            private List <IRelationship> defensiveCopyOfValues(
                List <IRelationship> referencedValues,
                ERelationshipType referencedType)
            {
                // null check
                if (referencedValues == null)
                {
                    return(null);
                }

                // make defensive copy
                List <IRelationship> copy = new List <IRelationship>();

                foreach (IRelationship relationship in referencedValues)
                {
                    if (isCorrectRelationshipType(relationship, referencedType))
                    {
                        copy.Add(relationship);
                    }
                    else
                    {
                        throw new ArgumentException();
                    }
                }

                return(copy);
            }
 /**
  * helper method to help check if the relationship is of the correct type
  * @param relationship IRelationship to be checked
  * @param shouldBeType ERelationshipType that the relationship parameter should be
  * @return Boolean value of the check if relationship is of shouldBeType
  */
 private Boolean isCorrectRelationshipType(IRelationship relationship, ERelationshipType shouldBeType)
 {
     if (relationship.relationshipType() == shouldBeType)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 4
0
 private Relationship(Builder builder)
 {
     _comment       = builder._comment;
     _referenceUrn  = builder._referenceUrn;
     _referenceUuid = builder._referenceUuid;
     _effect        = builder._effect;
     _type          = builder._type;
 }
        public Dependent(string employeeId, Name name, Document document, EDependentType depedentType, ERelationshipType relationshipType, decimal percent)
        {
            EmployeeId       = employeeId;
            Name             = name;
            Document         = document;
            DepedentType     = depedentType;
            RelationshipType = relationshipType;
            Percent          = percent;

            AddNotifications(name, document);
        }
            public Builder selectTheRightRelationship(List <IRelationship> newRelationship)
            {
                // guard check
                if (newRelationship == null || newRelationship.Count == 0)
                {
                    return(null);
                }

                ERelationshipType _type = newRelationship[0].relationshipType();

                switch (_type)
                {
                case ERelationshipType.aegtefaelle:     // spouse
                    aegtefaelle(newRelationship);
                    break;

                case ERelationshipType.boern:     // children
                    boern(newRelationship);
                    break;

                case ERelationshipType.bopaelssamling:
                    bopaelssamling(newRelationship);
                    break;

                case ERelationshipType.erstatingAf:
                    erstatingAf(newRelationship);
                    break;

                case ERelationshipType.erstatingFor:
                    erstatingFor(newRelationship);
                    break;

                case ERelationshipType.fader:     // father
                    fader(newRelationship);
                    break;

                case ERelationshipType.foraeldremydighedsboern:
                    foraeldremydighedsboern(newRelationship);
                    break;

                case ERelationshipType.foraeldremyndighedsindehaver:     //
                    foraeldremyndighedsindehaver(newRelationship);
                    break;

                case ERelationshipType.moder:     // mother
                    moder(newRelationship);
                    break;

                case ERelationshipType.registreretPartner:     // registered partner
                    registreretPartner(newRelationship);
                    break;

                case ERelationshipType.retligHandleevneVaergeForPersonen:     // legal guardian
                    retligHandleevneVaergeForPersonen(newRelationship);
                    break;

                case ERelationshipType.retligHandleevneVaergemaalsindehaver:
                    retligHandleevneVaergemaalsindehaver(newRelationship);
                    break;

                default:
                    throw new ArgumentException();     //If ERelationshipType is modified it will be caught
                }
                return(this);
            }
Esempio n. 7
0
 public Builder type(ERelationshipType newType)
 {
     _type = newType; return(this);
 }