예제 #1
0
        public void ImportStatusFromCrab(
            CrabStreetNameStatusId streetNameStatusId,
            CrabStreetNameId streetNameId,
            CrabStreetNameStatus streetNameStatus,
            CrabLifetime lifeTime,
            CrabTimestamp timestamp,
            CrabOperator beginOperator,
            CrabModification?beginModification,
            CrabOrganisation?beginOrganisation)
        {
            if (IsRemoved && beginModification != CrabModification.Delete)
            {
                throw new InvalidOperationException($"Cannot change removed street name for street name id {_streetNameId}/{streetNameId}");
            }

            var legacyEvent = new StreetNameStatusWasImportedFromCrab(
                streetNameStatusId,
                streetNameId,
                streetNameStatus,
                lifeTime,
                timestamp,
                beginOperator,
                beginModification,
                beginOrganisation);

            ApplyStatusChangesFor(legacyEvent);

            ApplyCompletion();

            ApplyChange(legacyEvent);
        }
 public ImportStreetNameFromCrab(
     CrabStreetNameId streetNameId,
     CrabMunicipalityId municipalityId,
     NisCode nisCode,
     CrabStreetName primaryStreetName,
     CrabStreetName secondaryStreetName,
     CrabTransStreetName primaryTransStreetName,
     CrabTransStreetName secondaryTransStreetName,
     CrabLanguage?primaryLanguage,
     CrabLanguage?secondaryLanguage,
     CrabLifetime lifeTime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     StreetNameId             = streetNameId;
     MunicipalityId           = municipalityId;
     NisCode                  = nisCode;
     PrimaryStreetName        = primaryStreetName;
     SecondaryStreetName      = secondaryStreetName;
     PrimaryTransStreetName   = primaryTransStreetName;
     SecondaryTransStreetName = secondaryTransStreetName;
     PrimaryLanguage          = primaryLanguage;
     SecondaryLanguage        = secondaryLanguage;
     LifeTime                 = lifeTime;
     Timestamp                = timestamp;
     Operator                 = @operator;
     Modification             = modification;
     Organisation             = organisation;
 }
 public StreetNameWasImportedFromCrab(
     CrabStreetNameId streetNameId,
     CrabMunicipalityId municipalityId,
     CrabStreetName primaryStreetName,
     CrabStreetName secondaryStreetName,
     CrabTransStreetName primaryTransStreetName,
     CrabTransStreetName secondaryTransStreetName,
     CrabLanguage?primaryLanguage,
     CrabLanguage?secondaryLanguage,
     CrabTimestamp timestamp,
     CrabLifetime lifetime,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     StreetNameId             = streetNameId;
     MunicipalityId           = municipalityId;
     PrimaryStreetName        = primaryStreetName?.Name;
     SecondaryStreetName      = secondaryStreetName?.Name;
     PrimaryTransStreetName   = primaryTransStreetName?.TransStreetName;
     SecondaryTransStreetName = secondaryTransStreetName?.TransStreetName;
     PrimaryLanguage          = primaryLanguage;
     SecondaryLanguage        = secondaryLanguage;
     Timestamp     = timestamp;
     BeginDateTime = lifetime.BeginDateTime;
     EndDateTime   = lifetime.EndDateTime;
     Operator      = @operator;
     Modification  = modification;
     Organisation  = organisation;
 }
예제 #4
0
        private void ApplyHouseNumberChange(
            CrabStreetNameId crabStreetNameId,
            HouseNumber houseNumber,
            CrabModification?modification)
        {
            if (HouseNumber != houseNumber)
            {
                if (modification != CrabModification.Correction)
                {
                    ApplyChange(new AddressHouseNumberWasChanged(_addressId, houseNumber));
                }
                else
                {
                    ApplyChange(new AddressHouseNumberWasCorrected(_addressId, houseNumber));
                }
            }

            var streetNameId = StreetNameId.CreateFor(crabStreetNameId);

            if (streetNameId == StreetNameId)
            {
                return;
            }

            if (modification != CrabModification.Correction)
            {
                ApplyChange(new AddressStreetNameWasChanged(_addressId, streetNameId));
            }
            else
            {
                ApplyChange(new AddressStreetNameWasCorrected(_addressId, streetNameId));
            }
        }
예제 #5
0
        public CrabHouseNumberId913BetaTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
        {
            Fixture fixture = new Fixture();

            _streetNameId = fixture.Create <CrabStreetNameId>();
            _houseNumber  = fixture.Create <HouseNumber>();
        }
        protected StreetName Act(StreetName sut,
                                 CrabStreetNameId CrabStreetNameId,
                                 CrabMunicipalityId crabMunicipalityId,
                                 CrabStreetName primaryStreetName,
                                 CrabStreetName secondaryStreetName,
                                 CrabTransStreetName primaryTransStreetName,
                                 CrabTransStreetName secondaryTransStreetName,
                                 CrabLanguage?primaryLanguage,
                                 CrabLanguage?secondaryLanguage,
                                 CrabLifetime lifetime,
                                 CrabTimestamp crabTimestamp,
                                 CrabOperator beginOperator,
                                 CrabModification?modification,
                                 CrabOrganisation?beginOrganisation)
        {
            LogAct($"ImportFromCrab({CrabStreetNameId},{crabMunicipalityId},{primaryStreetName},{secondaryStreetName},{secondaryTransStreetName},{primaryTransStreetName},{primaryLanguage},{secondaryLanguage},{lifetime},{crabTimestamp},{beginOperator},{modification},{beginOrganisation})");

            sut.ImportFromCrab(CrabStreetNameId,
                               crabMunicipalityId,
                               primaryStreetName,
                               secondaryStreetName,
                               primaryTransStreetName,
                               secondaryTransStreetName,
                               primaryLanguage,
                               secondaryLanguage,
                               lifetime,
                               crabTimestamp,
                               beginOperator,
                               modification,
                               beginOrganisation);

            return(sut);
        }
예제 #7
0
 public AssignPersistentLocalIdForCrabId(
     CrabStreetNameId streetNameId,
     PersistentLocalId persistentLocalId,
     PersistentLocalIdAssignmentDate assignmentDate)
 {
     StreetNameId      = streetNameId;
     PersistentLocalId = persistentLocalId;
     AssignmentDate    = assignmentDate;
 }
예제 #8
0
        public void ImportFromCrab(
            CrabStreetNameId streetNameId,
            CrabMunicipalityId municipalityId,
            CrabStreetName primaryStreetName,
            CrabStreetName secondaryStreetName,
            CrabTransStreetName primaryTransStreetName,
            CrabTransStreetName secondaryTransStreetName,
            CrabLanguage?primaryLanguage,
            CrabLanguage?secondaryLanguage,
            CrabLifetime lifeTime,
            CrabTimestamp timestamp,
            CrabOperator beginOperator,
            CrabModification?beginModification,
            CrabOrganisation?beginOrganisation)
        {
            if (IsRemoved)
            {
                throw new InvalidOperationException($"Cannot change removed street name for street name id {_streetNameId}/{streetNameId}");
            }

            if (beginModification == CrabModification.Delete)
            {
                ApplyChange(new StreetNameWasRemoved(_streetNameId));
            }
            else
            {
                ApplyRetiredOrUnretire(lifeTime, beginModification);

                if (beginModification != CrabModification.Correction)
                {
                    ApplyNameChanges(primaryStreetName, secondaryStreetName);
                    ApplyLanguageChanges(primaryLanguage?.ToLanguage(), secondaryLanguage?.ToLanguage());
                }
                else
                {
                    ApplyNameCorrections(primaryStreetName, secondaryStreetName);
                    ApplyLanguageCorrections(primaryLanguage?.ToLanguage(), secondaryLanguage?.ToLanguage());
                }
            }

            AssignPersistentLocalId(new PersistentLocalId(streetNameId), new PersistentLocalIdAssignmentDate(timestamp));

            ApplyChange(new StreetNameWasImportedFromCrab(
                            streetNameId,
                            municipalityId,
                            primaryStreetName,
                            secondaryStreetName,
                            primaryTransStreetName,
                            secondaryTransStreetName,
                            primaryLanguage,
                            secondaryLanguage,
                            timestamp,
                            lifeTime,
                            beginOperator,
                            beginModification,
                            beginOrganisation));
        }
 public ImportStreetNameStatusFromCrab(
     CrabStreetNameStatusId streetNameStatusId,
     CrabStreetNameId streetNameId,
     CrabStreetNameStatus streetNameStatus,
     CrabLifetime lifeTime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     StreetNameStatusId = streetNameStatusId;
     StreetNameId       = streetNameId;
     StreetNameStatus   = streetNameStatus;
     LifeTime           = lifeTime;
     Timestamp          = timestamp;
     Operator           = @operator;
     Modification       = modification;
     Organisation       = organisation;
 }
 public StreetNameStatusWasImportedFromCrab(
     CrabStreetNameStatusId streetNameStatusId,
     CrabStreetNameId streetNameId,
     CrabStreetNameStatus streetNameStatus,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     StreetNameStatusId = streetNameStatusId;
     StreetNameId       = streetNameId;
     StreetNameStatus   = streetNameStatus;
     BeginDateTime      = lifetime.BeginDateTime;
     EndDateTime        = lifetime.EndDateTime;
     Timestamp          = timestamp;
     Operator           = @operator;
     Modification       = modification;
     Organisation       = organisation;
 }
 public ImportHouseNumberFromCrab(
     CrabHouseNumberId houseNumberId,
     CrabStreetNameId streetNameId,
     HouseNumber houseNumber,
     GrbNotation grbNotation,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     HouseNumberId = houseNumberId;
     StreetNameId  = streetNameId;
     HouseNumber   = houseNumber;
     GrbNotation   = grbNotation;
     Lifetime      = lifetime;
     Timestamp     = timestamp;
     Operator      = @operator;
     Modification  = modification;
     Organisation  = organisation;
 }
예제 #12
0
        public void ImportHouseNumberFromCrab(
            CrabHouseNumberId houseNumberId,
            CrabStreetNameId crabStreetNameId,
            HouseNumber houseNumber,
            GrbNotation grbNotation,
            CrabLifetime crabLifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            if (IsRemoved && !IsSubaddress)
            {
                throw new AddressRemovedException($"Cannot change removed address for address id {_addressId}");
            }

            if (!(_coupledHouseNumberId != null && _coupledHouseNumberId != houseNumberId) && !IsRemoved)
            {
                if (modification == CrabModification.Delete)
                {
                    ApplyChange(new AddressWasRemoved(_addressId));
                }
                else
                {
                    ApplyHouseNumberChange(crabStreetNameId, houseNumber, modification);
                    EvaluateRetirement(crabLifetime, modification);
                }
            }

            ApplyChange(new AddressHouseNumberWasImportedFromCrab(
                            houseNumberId,
                            crabStreetNameId,
                            houseNumber,
                            grbNotation,
                            crabLifetime,
                            timestamp,
                            @operator,
                            modification,
                            organisation));
        }
 public AddressHouseNumberWasImportedFromCrab(
     CrabHouseNumberId houseNumberId,
     CrabStreetNameId streetNameId,
     HouseNumber houseNumber,
     GrbNotation grbNotation,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     HouseNumberId = houseNumberId;
     StreetNameId  = streetNameId;
     HouseNumber   = houseNumber;
     GrbNotation   = grbNotation;
     Begin         = lifetime.BeginDateTime;
     End           = lifetime.EndDateTime;
     Timestamp     = timestamp;
     Operator      = @operator;
     Modification  = modification;
     Organisation  = organisation;
 }
예제 #14
0
 public static StreetNameId CreateFor(CrabStreetNameId crabStreetNameId)
 => new StreetNameId(crabStreetNameId.CreateDeterministicId());
예제 #15
0
 public static ImportHouseNumberFromCrab WithStreetNameId(this ImportHouseNumberFromCrab command, CrabStreetNameId streetNameId)
 {
     return(new ImportHouseNumberFromCrab(
                command.HouseNumberId,
                streetNameId,
                command.HouseNumber,
                command.GrbNotation,
                command.Lifetime,
                command.Timestamp,
                command.Operator,
                command.Modification,
                command.Organisation));
 }