public static MigrationPlan toMigrationPlan(ProcessEngine processEngine, MigrationPlanDto migrationPlanDto) { MigrationPlanBuilder migrationPlanBuilder = processEngine.RuntimeService.createMigrationPlan(migrationPlanDto.SourceProcessDefinitionId, migrationPlanDto.TargetProcessDefinitionId); if (migrationPlanDto.Instructions != null) { foreach (MigrationInstructionDto migrationInstructionDto in migrationPlanDto.Instructions) { MigrationInstructionBuilder migrationInstructionBuilder = migrationPlanBuilder.mapActivities(migrationInstructionDto.SourceActivityIds[0], migrationInstructionDto.TargetActivityIds[0]); if (true.Equals(migrationInstructionDto.UpdateEventTrigger)) { migrationInstructionBuilder = migrationInstructionBuilder.updateEventTrigger(); } migrationPlanBuilder = migrationInstructionBuilder; } } return(migrationPlanBuilder.build()); }
public static MigrationPlanDto from(MigrationPlan migrationPlan) { MigrationPlanDto dto = new MigrationPlanDto(); dto.SourceProcessDefinitionId = migrationPlan.SourceProcessDefinitionId; dto.TargetProcessDefinitionId = migrationPlan.TargetProcessDefinitionId; List <MigrationInstructionDto> instructionDtos = new List <MigrationInstructionDto>(); if (migrationPlan.Instructions != null) { foreach (MigrationInstruction migrationInstruction in migrationPlan.Instructions) { MigrationInstructionDto migrationInstructionDto = MigrationInstructionDto.from(migrationInstruction); instructionDtos.Add(migrationInstructionDto); } } dto.Instructions = instructionDtos; return(dto); }