示例#1
0
        //
        // Actions from DWKit Samples (with name changes for Tables and Fields)
        //
        private async Task WriteProductTransitionAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter, CancellationToken token)
        {
            if (processInstance.IdentityIds == null)
            {
                return;
            }

            var currentstate = WorkflowInit.Runtime.GetLocalizedStateName(processInstance.ProcessId, processInstance.CurrentState);

            var nextState = WorkflowInit.Runtime.GetLocalizedStateName(processInstance.ProcessId, processInstance.ExecutedActivityState);

            var command = WorkflowInit.Runtime.GetLocalizedCommandName(processInstance.ProcessId, processInstance.CurrentCommand);

            using (var scope = ServiceProvider.CreateScope())
            {
                var userRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <User> >();
                var userNames      = userRepository.Get()
                                     .Where(u => processInstance.IdentityIds.Contains(u.WorkflowUserId.GetValueOrDefault().ToString()))
                                     .Select(u => u.Name).ToList();
                var userNamesString = String.Join(',', userNames);
                var productTransitionsRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <ProductTransition> >();
                var history = new ProductTransition
                {
                    ProductId        = processInstance.ProcessId,
                    AllowedUserNames = userNamesString,
                    InitialState     = currentstate,
                    DestinationState = nextState,
                    Command          = command
                };
                await productTransitionsRepository.CreateAsync(history);
            }
        }
示例#2
0
        public async Task AddTokenUseAsync(int projectId, int userId, string use)
        {
            var project = await this.ProjectRepository.Get()
                          .Include(proj => proj.Products)
                          .Where(p => p.Id == projectId)
                          .FirstOrDefaultAsync();

            var user = await this.UserRepository.Get()
                       .Where(u => u.Id == userId)
                       .FirstOrDefaultAsync();

            if (project == null || user == null)
            {
                return;
            }

            foreach (var product in project.Products)
            {
                var transition = new ProductTransition
                {
                    ProductId        = product.Id,
                    AllowedUserNames = string.Empty,
                    TransitionType   = ProductTransitionType.ProjectAccess,
                    InitialState     = "Project " + use,
                    WorkflowUserId   = user.WorkflowUserId,
                    DateTransition   = DateTime.UtcNow
                };

                await ProductTransitionRepository.CreateAsync(transition);
            }
        }
示例#3
0
 private async Task createTransitionRecord(Guid processId, ProductTransitionType transitionType, WorkflowType workflowType)
 {
     using (var scope = ServiceProvider.CreateScope())
     {
         var productTransitionsRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <ProductTransition> >();
         var transition = new ProductTransition
         {
             ProductId        = processId,
             AllowedUserNames = String.Empty,
             TransitionType   = transitionType,
             WorkflowType     = workflowType,
             DateTransition   = DateTime.UtcNow
         };
         transition = await productTransitionsRepository.CreateAsync(transition);
     }
 }
示例#4
0
        private async Task UpdateProductTransitionAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter, CancellationToken token)
        {
            if (string.IsNullOrEmpty(processInstance.CurrentCommand))
            {
                return;
            }

            var currentstate = WorkflowInit.Runtime.GetLocalizedStateName(processInstance.ProcessId, processInstance.CurrentState);

            var nextState = WorkflowInit.Runtime.GetLocalizedStateName(processInstance.ProcessId, processInstance.ExecutedActivityState);

            var command = WorkflowInit.Runtime.GetLocalizedCommandName(processInstance.ProcessId, processInstance.CurrentCommand);

            var isTimer = !string.IsNullOrEmpty(processInstance.ExecutedTimer);

            using (var scope = ServiceProvider.CreateScope())
            {
                var productTransitionsRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <ProductTransition> >();
                var history = await productTransitionsRepository.Get()
                              .Where(h => h.ProductId == processInstance.ProcessId &&
                                     h.DateTransition == null &&
                                     h.InitialState == currentstate &&
                                     h.DestinationState == nextState).FirstOrDefaultAsync();

                if (history == null)
                {
                    history = new ProductTransition
                    {
                        ProductId        = processInstance.ProcessId,
                        AllowedUserNames = String.Empty,
                        InitialState     = currentstate,
                        DestinationState = nextState
                    };
                    history = await productTransitionsRepository.CreateAsync(history);
                }

                history.Command        = !isTimer ? command : string.Format("Timer: {0}", processInstance.ExecutedTimer);
                history.DateTransition = DateTime.UtcNow;
                if (Guid.TryParse(processInstance.IdentityId, out Guid identityId))
                {
                    history.WorkflowUserId = identityId;
                }
                await productTransitionsRepository.UpdateAsync(history);
            }
        }
        /*
         *  DWKit Activities have two callbacks: Implementation and PreExecution Implementation.
         *
         *  For each Activity on the direct path through the workflow, these should be assigned:
         *  Implementation:              UpdateProductTransition
         *  PreExecution Implementation: WriteProductTransition
         *
         *  The PreExecution Implementation callback is called for each Activity in the workflow when Runtime.PreExecuteFromCurrentActivityAsync is called.
         *  That Runtime function follows the Direct Transitions in the workflow to provide an estimation of the steps that will be performed in the workflow.
         *  Note: If there are Direct Auto-Action Transitions with a conditional that is considered the next step in the "happy path", then
         *  the "Result on PreExecution" should be set to true so that the direct path will be followed.
         *
         *  The Implementation callback is called while the workflow is running and the activity changes. It should update an existing ProductTransition.
         */
        private async Task WriteProductTransitionAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter, CancellationToken token)
        {
            if (processInstance.IdentityIds == null)
            {
                return;
            }

            var currentstate = processInstance.CurrentState;
            var nextState    = processInstance.ExecutedActivityState;

            using (var scope = ServiceProvider.CreateScope())
            {
                // Only capture the command and allowedUsers if Command Trigger Type.  DWKit will reuse the previous Command and IdentityIds on Auto Trigger Type.
                // We don't want to report the previous Command or Identity with Auto Trigger Types.
                string command          = null;
                string allowedUserNames = null;
                if (processInstance.ExecutedTransition.Trigger.Type == TriggerType.Command)
                {
                    command = WorkflowInit.Runtime.GetLocalizedCommandName(processInstance.ProcessId, processInstance.CurrentCommand);

                    var     identityIds       = processInstance.IdentityIds.ConvertAll(s => Guid.Parse(s)).ToList();
                    var     productRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <Product, Guid> >();
                    Product product           = await GetProductForProcess(processInstance, productRepository);

                    var userRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <User> >();
                    var userNames      = userRepository.Get()
                                         .Where(u => u.WorkflowUserId != null && identityIds.Contains(u.WorkflowUserId.Value))
                                         .Select(u => u.Name).ToList();
                    allowedUserNames = String.Join(',', userNames);
                }

                var productTransitionsRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <ProductTransition> >();
                var history = new ProductTransition
                {
                    ProductId        = processInstance.ProcessId,
                    AllowedUserNames = allowedUserNames,
                    InitialState     = currentstate,
                    DestinationState = nextState,
                    Command          = command
                };

                await productTransitionsRepository.CreateAsync(history);
            }
        }
        private async Task UpdateProductTransitionAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter, CancellationToken token)
        {
            // Note: If admin uses "Set State" from DWKit Admin UI, the ExecutedTransition will be null

            if (string.IsNullOrEmpty(processInstance.CurrentCommand))
            {
                return;
            }

            // Skip Timers -- we are choosing not to report them in the ProductTransitions
            if (processInstance.ExecutedTransition?.Trigger.Type == TriggerType.Timer)
            {
                return;
            }

            var currentstate = processInstance.CurrentState;
            var nextState    = processInstance.ExecutedActivityState;
            var command      = WorkflowInit.Runtime.GetLocalizedCommandName(processInstance.ProcessId, processInstance.CurrentCommand);

            Log.Information($"Update Product Transition Async current: {currentstate} next: {nextState}");
            using (var scope = ServiceProvider.CreateScope())
            {
                var     productRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <Product, Guid> >();
                Product product           = await GetProductForProcess(processInstance, productRepository);

                var productTransitionsRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <ProductTransition> >();
                var history = await productTransitionsRepository.Get()
                              .Where(h => h.ProductId == processInstance.ProcessId &&
                                     h.DateTransition == null &&
                                     h.InitialState == currentstate &&
                                     h.DestinationState == nextState).FirstOrDefaultAsync();

                if (history == null)
                {
                    history = new ProductTransition
                    {
                        ProductId        = processInstance.ProcessId,
                        AllowedUserNames = String.Empty,
                        InitialState     = currentstate,
                        DestinationState = nextState
                    };
                    history = await productTransitionsRepository.CreateAsync(history);
                }

                // Only capture the command or userif Command Trigger Type.  DWKit will reuse the previous Command and IdentityIds on Auto Trigger Type.
                // We don't want to report the previous Command or Identity with Auto Trigger Types.
                if (processInstance.ExecutedTransition?.Trigger.Type == TriggerType.Command)
                {
                    history.Command = command;

                    if (Guid.TryParse(processInstance.IdentityId, out Guid identityId))
                    {
                        history.WorkflowUserId = identityId;
                    }
                }
                if (!String.IsNullOrWhiteSpace(product.WorkflowComment))
                {
                    history.Comment = product.WorkflowComment;
                    await ClearComment(processInstance);
                }
                history.DateTransition = DateTime.UtcNow;
                await productTransitionsRepository.UpdateAsync(history);
            }
        }
示例#7
0
        protected void BuildTestData()
        {
            CurrentUser = NeedsCurrentUser();
            user1       = AddEntity <AppDbContext, User>(new User
            {
                ExternalId = "test-auth0-id1",
                Email      = "*****@*****.**",
                Name       = "Test Testenson1",
                GivenName  = "Test1",
                FamilyName = "Testenson1"
            });
            storeType1 = AddEntity <AppDbContext, StoreType>(new StoreType
            {
                Name        = "google_play_store",
                Description = "Google Play Store"
            });
            storeType2 = AddEntity <AppDbContext, StoreType>(new StoreType
            {
                Name        = "ios_app_store",
                Description = "IOS App Store"
            });
            storeLang1 = AddEntity <AppDbContext, StoreLanguage>(new StoreLanguage
            {
                Name        = "en-US",
                Description = "US English",
                StoreTypeId = storeType1.Id
            });
            storeLang2 = AddEntity <AppDbContext, StoreLanguage>(new StoreLanguage
            {
                Name        = "en-GB",
                Description = "United Kingdom English",
                StoreTypeId = storeType1.Id
            });
            store1 = AddEntity <AppDbContext, Store>(new Store
            {
                Name        = "wycliffeusa",
                Description = "Wycliffe USA - Google Play Store",
                StoreTypeId = storeType1.Id
            });
            store2 = AddEntity <AppDbContext, Store>(new Store
            {
                Name        = "wycliffeusa",
                Description = "Wycliffe USA - IOS Play Store",
                StoreTypeId = storeType2.Id
            });
            org1 = AddEntity <AppDbContext, Organization>(new Organization
            {
                Name                      = "TestOrg1",
                WebsiteUrl                = "https://testorg1.org",
                BuildEngineUrl            = "https://buildengine.testorg1",
                BuildEngineApiAccessToken = "replace",
                OwnerId                   = CurrentUser.Id
            });
            org2 = AddEntity <AppDbContext, Organization>(new Organization
            {
                Name                      = "TestOrg2",
                WebsiteUrl                = "https://testorg2.org",
                BuildEngineUrl            = "https://buildengine.testorg2",
                BuildEngineApiAccessToken = "replace",
                OwnerId                   = CurrentUser.Id
            });
            org3 = AddEntity <AppDbContext, Organization>(new Organization
            {
                Name                      = "TestOrg3",
                WebsiteUrl                = "https://testorg3.org",
                BuildEngineUrl            = "https://buildengine.testorg3",
                BuildEngineApiAccessToken = "replace",
                OwnerId                   = CurrentUser.Id
            });
            org4 = AddEntity <AppDbContext, Organization>(new Organization
            {
                Name                      = "TestOrg4",
                WebsiteUrl                = "https://testorg4.org",
                BuildEngineUrl            = "https://buildengine.testorg1",
                BuildEngineApiAccessToken = "replace",
                OwnerId                   = CurrentUser.Id
            });
            orgStore1 = AddEntity <AppDbContext, OrganizationStore>(new OrganizationStore
            {
                OrganizationId = org4.Id,
                StoreId        = store1.Id
            });
            CurrentUserMembership = AddEntity <AppDbContext, OrganizationMembership>(new OrganizationMembership
            {
                UserId         = CurrentUser.Id,
                OrganizationId = org1.Id
            });
            CurrentUserMembership2 = AddEntity <AppDbContext, OrganizationMembership>(new OrganizationMembership
            {
                UserId         = CurrentUser.Id,
                OrganizationId = org2.Id
            });
            CurrentUserMembership3 = AddEntity <AppDbContext, OrganizationMembership>(new OrganizationMembership
            {
                UserId         = user1.Id,
                OrganizationId = org3.Id
            });
            CurrentUserMembership3 = AddEntity <AppDbContext, OrganizationMembership>(new OrganizationMembership
            {
                UserId         = CurrentUser.Id,
                OrganizationId = org4.Id
            });
            group1 = AddEntity <AppDbContext, Group>(new Group
            {
                Name         = "TestGroup1",
                Abbreviation = "TG1",
                OwnerId      = org1.Id
            });
            group2 = AddEntity <AppDbContext, Group>(new Group
            {
                Name         = "TestGroup2",
                Abbreviation = "TG2",
                OwnerId      = org1.Id
            });
            group3 = AddEntity <AppDbContext, Group>(new Group
            {
                Name         = "TestGroup3",
                Abbreviation = "TG3",
                OwnerId      = org2.Id
            });
            group4 = AddEntity <AppDbContext, Group>(new Group
            {
                Name         = "TestGroup4",
                Abbreviation = "TG4",
                OwnerId      = org3.Id
            });
            group5 = AddEntity <AppDbContext, Group>(new Group
            {
                Name         = "TestGroup5",
                Abbreviation = "TG5",
                OwnerId      = org4.Id
            });
            groupMembership1 = AddEntity <AppDbContext, GroupMembership>(new GroupMembership
            {
                UserId  = CurrentUser.Id,
                GroupId = group1.Id
            });
            groupMembership2 = AddEntity <AppDbContext, GroupMembership>(new GroupMembership
            {
                UserId  = CurrentUser.Id,
                GroupId = group5.Id
            });
            type1 = AddEntity <AppDbContext, ApplicationType>(new ApplicationType
            {
                Name        = "scriptureappbuilder",
                Description = "Scripture App Builder"
            });
            project1 = AddEntity <AppDbContext, Project>(new Project
            {
                Name               = "Test Project1",
                TypeId             = type1.Id,
                Description        = "Test Description",
                OwnerId            = CurrentUser.Id,
                GroupId            = group1.Id,
                OrganizationId     = org1.Id,
                Language           = "eng-US",
                IsPublic           = true,
                WorkflowProjectUrl = "www.workflow.url"
            });
            project2 = AddEntity <AppDbContext, Project>(new Project
            {
                Name               = "Test Project2",
                TypeId             = type1.Id,
                Description        = "Test Description",
                OwnerId            = CurrentUser.Id,
                GroupId            = group1.Id,
                OrganizationId     = org1.Id,
                Language           = "eng-US",
                IsPublic           = true,
                WorkflowProjectUrl = "www.workflow.url"
            });
            project3 = AddEntity <AppDbContext, Project>(new Project
            {
                Name               = "Test Project3",
                TypeId             = type1.Id,
                Description        = "Test Description",
                OwnerId            = CurrentUser.Id,
                GroupId            = group3.Id,
                OrganizationId     = org2.Id,
                Language           = "eng-US",
                IsPublic           = true,
                WorkflowProjectUrl = "www.workflow.url"
            });
            project4 = AddEntity <AppDbContext, Project>(new Project
            {
                Name               = "Test Project4",
                TypeId             = type1.Id,
                Description        = "Test Description",
                OwnerId            = user1.Id,
                GroupId            = group4.Id,
                OrganizationId     = org3.Id,
                Language           = "eng-US",
                IsPublic           = true,
                WorkflowProjectUrl = "www.workflow.url"
            });
            project5 = AddEntity <AppDbContext, Project>(new Project
            {
                Name               = "Test Project5",
                TypeId             = type1.Id,
                Description        = "Test Description",
                OwnerId            = CurrentUser.Id,
                GroupId            = group5.Id,
                OrganizationId     = org4.Id,
                Language           = "eng-US",
                IsPublic           = true,
                WorkflowProjectUrl = "www.workflow.url"
            });
            project6 = AddEntity <AppDbContext, Project>(new Project
            {
                Name               = "Test Project6",
                TypeId             = type1.Id,
                Description        = "Test Description",
                OwnerId            = CurrentUser.Id,
                GroupId            = group5.Id,
                OrganizationId     = org4.Id,
                Language           = "eng-GB",
                IsPublic           = true,
                WorkflowProjectUrl = "www.workflow.url"
            });
            project7 = AddEntity <AppDbContext, Project>(new Project
            {
                Name           = "Test Project7",
                TypeId         = type1.Id,
                Description    = "Test Description",
                OwnerId        = CurrentUser.Id,
                GroupId        = group1.Id,
                OrganizationId = org1.Id,
                Language       = "eng-US",
                IsPublic       = true
            });

            workflow1 = AddEntity <AppDbContext, WorkflowDefinition>(new WorkflowDefinition
            {
                Name           = "TestWorkFlow",
                Enabled        = true,
                Description    = "This is a test workflow",
                WorkflowScheme = "Don't know what this is"
            });
            workflow2 = AddEntity <AppDbContext, WorkflowDefinition>(new WorkflowDefinition
            {
                Name           = "TestWorkFlow2",
                Enabled        = true,
                Description    = "This is a test workflow",
                WorkflowScheme = "Don't know what this is",
                StoreTypeId    = storeType1.Id
            });
            productDefinition1 = AddEntity <AppDbContext, ProductDefinition>(new ProductDefinition
            {
                Name        = "TestProd1",
                TypeId      = type1.Id,
                Description = "This is a test product",
                WorkflowId  = workflow1.Id
            });
            productDefinition2 = AddEntity <AppDbContext, ProductDefinition>(new ProductDefinition
            {
                Name        = "TestProd2",
                TypeId      = type1.Id,
                Description = "This is test product 2",
                WorkflowId  = workflow1.Id
            });
            productDefinition3 = AddEntity <AppDbContext, ProductDefinition>(new ProductDefinition
            {
                Name        = "TestProd3",
                TypeId      = type1.Id,
                Description = "This is test product 3",
                WorkflowId  = workflow1.Id
            });
            productDefinition4 = AddEntity <AppDbContext, ProductDefinition>(new ProductDefinition
            {
                Name        = "TestProd4",
                TypeId      = type1.Id,
                Description = "This is a test product",
                WorkflowId  = workflow2.Id
            });

            orgProduct1 = AddEntity <AppDbContext, OrganizationProductDefinition>(new OrganizationProductDefinition
            {
                OrganizationId      = org1.Id,
                ProductDefinitionId = productDefinition1.Id
            });
            orgProduct2 = AddEntity <AppDbContext, OrganizationProductDefinition>(new OrganizationProductDefinition
            {
                OrganizationId      = org2.Id,
                ProductDefinitionId = productDefinition2.Id
            });
            orgProduct3 = AddEntity <AppDbContext, OrganizationProductDefinition>(new OrganizationProductDefinition
            {
                OrganizationId      = org3.Id,
                ProductDefinitionId = productDefinition3.Id
            });
            orgProduct4 = AddEntity <AppDbContext, OrganizationProductDefinition>(new OrganizationProductDefinition
            {
                OrganizationId      = org4.Id,
                ProductDefinitionId = productDefinition4.Id
            });
            product1 = AddEntity <AppDbContext, Product>(new Product
            {
                ProjectId           = project1.Id,
                ProductDefinitionId = productDefinition1.Id
            });
            product2 = AddEntity <AppDbContext, Product>(new Product
            {
                ProjectId           = project4.Id,
                ProductDefinitionId = productDefinition3.Id
            });
            product3 = AddEntity <AppDbContext, Product>(new Product
            {
                ProjectId           = project3.Id,
                ProductDefinitionId = productDefinition2.Id
            });
            product4 = AddEntity <AppDbContext, Product>(new Product
            {
                ProjectId           = project5.Id,
                ProductDefinitionId = productDefinition4.Id,
                StoreId             = store1.Id,
                StoreLanguageId     = storeLang1.Id
            });
            productBuild1 = AddEntity <AppDbContext, ProductBuild>(new ProductBuild
            {
                ProductId = product1.Id,
                Version   = "4.7.1",
                BuildId   = 2879,
                Success   = true
            });
            productBuild2 = AddEntity <AppDbContext, ProductBuild>(new ProductBuild
            {
                ProductId = product1.Id,
                Version   = "4.7.1",
                BuildId   = 2880,
                Success   = true
            });
            productBuild3 = AddEntity <AppDbContext, ProductBuild>(new ProductBuild
            {
                ProductId = product1.Id,
                Version   = "4.7.1",
                BuildId   = 2881,
                Success   = true
            });
            productBuild4 = AddEntity <AppDbContext, ProductBuild>(new ProductBuild
            {
                ProductId = product3.Id,
                Version   = "4.7.1",
                BuildId   = 2882,
                Success   = true
            });
            productArtifact1_1 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild1.Id,
                ArtifactType   = "apk",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2879/test-4.7.apk",
                ContentType    = "application/octet-stream"
            });
            productArtifact1_2 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild1.Id,
                ArtifactType   = "about",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2879/about.txt",
                ContentType    = "text/plain"
            });
            productArtifact2_1 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild2.Id,
                ArtifactType   = "apk",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2880/test-4.7.apk",
                ContentType    = "application/octet-stream"
            });
            productArtifact2_2 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild2.Id,
                ArtifactType   = "about",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2880/about.txt",
                ContentType    = "text/plain"
            });
            productArtifact3_1 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild3.Id,
                ArtifactType   = "apk",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2881/test-4.7.apk",
                ContentType    = "application/octet-stream"
            });
            productArtifact3_2 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild3.Id,
                ArtifactType   = "about",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2881/about.txt",
                ContentType    = "text/plain"
            });
            productArtifact3_3 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild3.Id,
                ArtifactType   = "version",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2881/version.json",
            });
            productArtifact4_1 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product3.Id,
                ProductBuildId = productBuild4.Id,
                ArtifactType   = "apk",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2882/test-4.7.apk",
                ContentType    = "application/octet-stream"
            });
            productArtifact4_2 = AddEntity <AppDbContext, ProductArtifact>(new ProductArtifact
            {
                ProductId      = product4.Id,
                ProductBuildId = productBuild4.Id,
                ArtifactType   = "about",
                Url            = "https://sil-prd-aps-artifacts.s3.amazonaws.com/prd/jobs/build_scriptureappbuilder_1/2882/about.txt",
                ContentType    = "text/plain"
            });
            productPublication1 = AddEntity <AppDbContext, ProductPublication>(new ProductPublication
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild1.Id,
                ReleaseId      = 2180,
                Channel        = "production",
                Success        = true
            });
            productPublication2 = AddEntity <AppDbContext, ProductPublication>(new ProductPublication
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild2.Id,
                ReleaseId      = 2181,
                Channel        = "production",
                Success        = true
            });
            productPublication3 = AddEntity <AppDbContext, ProductPublication>(new ProductPublication
            {
                ProductId      = product1.Id,
                ProductBuildId = productBuild3.Id,
                ReleaseId      = 2182,
                Channel        = "production",
                Success        = false
            });
            productPublication4 = AddEntity <AppDbContext, ProductPublication>(new ProductPublication
            {
                ProductId      = product3.Id,
                ProductBuildId = productBuild4.Id,
                ReleaseId      = 2183,
                Channel        = "production",
                Success        = false
            });
            transition1 = AddEntity <AppDbContext, ProductTransition>(new ProductTransition
            {
                ProductId        = product1.Id,
                WorkflowUserId   = Guid.NewGuid(),
                AllowedUserNames = "Chris Hubbard",
                InitialState     = "Readiness Check",
                DestinationState = "Approval",
                Command          = "Continue",
                DateTransition   = new DateTime(2019, 06, 17)
            });
            transition2 = AddEntity <AppDbContext, ProductTransition>(new ProductTransition
            {
                ProductId        = product1.Id,
                WorkflowUserId   = Guid.NewGuid(),
                AllowedUserNames = "David Moore",
                InitialState     = "Approval",
                DestinationState = "Product Creation",
                Command          = "Approve",
                DateTransition   = new DateTime(2019, 06, 17)
            });
            transition3 = AddEntity <AppDbContext, ProductTransition>(new ProductTransition
            {
                ProductId        = product1.Id,
                WorkflowUserId   = null,
                InitialState     = "Product Creation",
                DestinationState = "Check Product Creation",
                Command          = "Approve"
            });
            transition4 = AddEntity <AppDbContext, ProductTransition>(new ProductTransition
            {
                ProductId        = product1.Id,
                WorkflowUserId   = null,
                InitialState     = "Check Product Creation",
                DestinationState = "App Builder Configuration",
                Command          = "Approve"
            });
        }