Beispiel #1
0
        /**
         * Immutable person
         *
         * @param builder
         */
        private Person(Builder builder)
        {
            _code    = builder._code;
            _message = builder._message;
            _uuid    = builder._uuid;

            _firstname         = builder._firstname;
            _middelname        = builder._middelname;
            _lastname          = builder._lastname;
            _callname          = builder._callname;
            _nameForAddressing = builder._nameForAddressing;

            _gender     = builder._gender;
            _birthdate  = builder._birthdate;
            _birthplace = builder._birthplace;
            _birthRegisteringAuthority = builder._birthRegisteringAuthority;

            _registerInformation = builder._registerInformation;

            _address      = builder._address;
            _otherAddress = builder._otherAddress;
            _movingDate   = builder._movingDate;
            // Now name and address have been set
            _postalLabel = new util.Converters().ToPostalLabel(this);

            _contact             = builder._contact;
            _nextOfKinContact    = builder._nextOfKinContact;
            _effect              = builder._effect;
            _relations           = builder._relations;
            _tilstand            = builder._tilstand;
            _tidspunkt           = builder._tidspunkt;
            _relationsWithPerson = builder._relationsWithPerson;
        }
Beispiel #2
0
        public static IEnumerable <Person> Spouse(this Person person)
        {
            List <Person>        result = new List <Person>();
            IPersonRelationships personRelationships = FamilyGraph.Get(person);

            if (personRelationships.Spouse != null)
            {
                result.Add(personRelationships.Spouse);
            }
            return(result);
        }
Beispiel #3
0
        public static IEnumerable <Person> Children(this Person person, Gender?gender = null)
        {
            List <Person>        result = new List <Person>();
            IPersonRelationships personRelationships = FamilyGraph.Get(person);
            List <Person>        children            = personRelationships.Edges
                                                       .Where(m => m.RelationshipType == RelationshipType.Parent)
                                                       .Where(m => gender == null || m.Target.Gender == gender)
                                                       .Select(m => m.Target)
                                                       .ToList();

            result.AddRange(children);
            return(result);
        }
Beispiel #4
0
        public static IEnumerable <Person> Parents(this Person person, Gender?gender = null)
        {
            List <Person>        result = new List <Person>();
            IPersonRelationships personRelationships = FamilyGraph.Get(person);

            if (personRelationships == null)
            {
                return(result);
            }
            IEnumerable <Person> parents = personRelationships.Parents
                                           .Where(m => gender == null || m.Gender == gender);

            result.AddRange(parents);
            return(result);
        }
Beispiel #5
0
 public Builder relations(IPersonRelationships newRelations)
 {
     _relations = newRelations;
     return(this);
 }