Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d21a988
Merge pull request #360 from Breeding-Insight/feature/BI-2122-A
dmeidlin Jun 11, 2024
e406e38
Merge branch 'feature/BI-2122' into feature/BI-2132-A
nickpalladino Jun 18, 2024
79189ba
Messing with dependency issue
nickpalladino Jun 18, 2024
0ef8cd5
Removed ununsed fileImportService injection and resolved DI issue
nickpalladino Jun 21, 2024
1acd04b
Added in BI-2128 change
nickpalladino Jun 21, 2024
fc2a661
Merge branch 'develop' into feature/BI-2132-A
nickpalladino Jun 21, 2024
6a4043d
Updated create only tests to use create workflow
nickpalladino Jun 21, 2024
651cffc
Removed unused migration
nickpalladino Jun 21, 2024
39fb8cd
Removed append environment workflow
nickpalladino Jun 21, 2024
be8ea38
Fix error message
nickpalladino Jun 21, 2024
d11ef3c
Removed navigator stuff handled in domain import service
nickpalladino Jun 21, 2024
eebb493
Removed some development comments
nickpalladino Jun 21, 2024
b5dc3e8
Reference enum for new-experiment
nickpalladino Jul 1, 2024
2bbf7f3
Change variable name to reflect string type
nickpalladino Jul 1, 2024
ccc1414
Clarified comment
nickpalladino Jul 1, 2024
7a35165
Clarified comment
nickpalladino Jul 1, 2024
aa06c6e
Removed old comment
nickpalladino Jul 1, 2024
dd6f348
Updated doc comment
nickpalladino Jul 1, 2024
a6c3590
Cleaned up ProcessedData code
nickpalladino Jul 1, 2024
1a6de32
Changed from workflow to workflowId
nickpalladino Jul 2, 2024
a488612
Change exception handling
nickpalladino Jul 2, 2024
9b04d44
Merge branch 'develop' into feature/BI-2132-A
nickpalladino Jul 2, 2024
c9ed7d0
Merge branch 'feature/BI-2132-A' into bug/BI-2115
nickpalladino Jul 16, 2024
94a5ff0
Removed throws Exception in method signature
nickpalladino Jul 16, 2024
e5c7aaf
Removed todo
nickpalladino Jul 16, 2024
ba4c0a0
Merged missing BI-2109 changes
nickpalladino Jul 16, 2024
b284e1a
Update tests
nickpalladino Jul 19, 2024
2a636b6
Merge branch 'develop' into bug/BI-2115
nickpalladino Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ public HttpResponse<Response<ImportResponse>> previewData(@PathVariable UUID pro
}
}

@Put("programs/{programId}/import/mappings/{mappingId}/workflows/{workflow}/data/{uploadId}/preview")
@Put("programs/{programId}/import/mappings/{mappingId}/workflows/{workflowId}/data/{uploadId}/preview")
@Produces(MediaType.APPLICATION_JSON)
@AddMetadata
@ProgramSecured(roles = {ProgramSecuredRole.BREEDER, ProgramSecuredRole.SYSTEM_ADMIN})
public HttpResponse<Response<ImportResponse>> previewData(@PathVariable UUID programId, @PathVariable UUID mappingId,
@PathVariable String workflow, @PathVariable UUID uploadId) {
@PathVariable String workflowId, @PathVariable UUID uploadId) {
try {
AuthenticatedUser actingUser = securityService.getUser();
ImportResponse result = fileImportService.updateUpload(programId, uploadId, workflow, actingUser, null, false);
Response<ImportResponse> response = new Response<>(result);
ImportResponse result = fileImportService.updateUpload(programId, uploadId, workflowId, actingUser, null, false);
Response<ImportResponse> response = new Response(result);
return HttpResponse.ok(response).status(HttpStatus.ACCEPTED);
} catch (DoesNotExistException e) {
log.error(e.getMessage(), e);
Expand All @@ -184,17 +184,17 @@ public HttpResponse<Response<ImportResponse>> previewData(@PathVariable UUID pro
}
}

@Put("programs/{programId}/import/mappings/{mappingId}/workflows/{workflow}/data/{uploadId}/commit")
@Put("programs/{programId}/import/mappings/{mappingId}/workflows/{workflowId}/data/{uploadId}/commit")
@Produces(MediaType.APPLICATION_JSON)
@AddMetadata
@ProgramSecured(roles = {ProgramSecuredRole.BREEDER, ProgramSecuredRole.SYSTEM_ADMIN})
public HttpResponse<Response<ImportResponse>> commitData(@PathVariable UUID programId, @PathVariable UUID mappingId,
@PathVariable String workflow, @PathVariable UUID uploadId,
@PathVariable String workflowId, @PathVariable UUID uploadId,
@Body @Nullable Map<String, Object> userInput) {
try {
AuthenticatedUser actingUser = securityService.getUser();
ImportResponse result = fileImportService.updateUpload(programId, uploadId, workflow, actingUser, userInput, true);
Response<ImportResponse> response = new Response<>(result);
ImportResponse result = fileImportService.updateUpload(programId, uploadId, workflowId, actingUser, userInput, true);
Response<ImportResponse> response = new Response(result);
return HttpResponse.ok(response).status(HttpStatus.ACCEPTED);
} catch (DoesNotExistException e) {
log.error(e.getMessage(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public List<ImportWorkflow> getWorkflows() {
public ImportPreviewResponse process(ImportServiceContext context)
throws Exception {

Optional.ofNullable(context.getWorkflow())
Optional.ofNullable(context.getWorkflowId())
.filter(workflow -> !workflow.isEmpty())
.ifPresent(workflow -> log.info("Workflow: " + workflow));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@AllArgsConstructor
@NoArgsConstructor
public class ImportServiceContext {
private String workflow;
private String workflowId;
private List<BrAPIImport> brAPIImports;
private Table data;
private Program program;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ public String getImportTypeId() {
return "ExperimentImport";
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import lombok.*;
import org.breedinginsight.brapps.importer.model.ImportUpload;
import org.breedinginsight.brapps.importer.model.imports.BrAPIImport;
import org.breedinginsight.brapps.importer.model.imports.ImportServiceContext;
import org.breedinginsight.brapps.importer.model.imports.PendingImport;
import org.breedinginsight.model.Program;
import org.breedinginsight.model.User;
Expand All @@ -39,10 +40,19 @@ public class ImportContext {
private UUID workflowId;
private ImportUpload upload;
private List<BrAPIImport> importRows;
// TODO: move this out potentially
//private Map<Integer, PendingImport> mappedBrAPIImport;
private Table data;
private Program program;
private User user;
private boolean commit;

public static ImportContext from(ImportServiceContext importServiceContext) {
return ImportContext.builder()
.program(importServiceContext.getProgram())
.user(importServiceContext.getUser())
.commit(importServiceContext.isCommit())
.data(importServiceContext.getData())
.importRows(importServiceContext.getBrAPIImports())
.upload(importServiceContext.getUpload())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,5 @@
@ToString
@NoArgsConstructor
public class ProcessedData {
// TODO: remove this, already in ImportPreviewResponse
//private Map<String, ImportPreviewStatistics> statistics;
// TODO
private Map<Integer, PendingImport> mappedBrAPIImport;
private ImportPreviewResponse importPreviewResponse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Optional;


/**
* This Functional Interface represents a Workflow that can be executed as part of an import process.
* It extends the Ordered interface to allow workflows to be ordered in a sequence.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,14 @@ public ImportUpload setDynamicColumns(ImportUpload newUpload, Table data, Import
return newUpload;
}

private void processFile(String workflow, List<BrAPIImport> finalBrAPIImportList, Table data, Program program,
private void processFile(String workflowId, List<BrAPIImport> finalBrAPIImportList, Table data, Program program,
ImportUpload upload, User user, Boolean commit, BrAPIImportService importService,
AuthenticatedUser actingUser) {
// Spin off new process for processing the file
CompletableFuture.supplyAsync(() -> {
try {
ImportServiceContext context = ImportServiceContext.builder()
.workflow(workflow)
.workflowId(workflowId)
.brAPIImports(finalBrAPIImportList)
.data(data)
.program(program)
Expand Down Expand Up @@ -580,6 +580,7 @@ public List<ImportMapping> getSystemMappingByName(String name) {
*/
public List<ImportWorkflow> getWorkflowsForSystemMapping(UUID mappingId) throws DoesNotExistException {
// Retrieve the import mapping configuration based on the provided mapping ID

ImportMapping mappingConfig = importMappingDAO.getMapping(mappingId)
.orElseThrow(() -> new DoesNotExistException("Cannot find mapping config associated with upload."));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@
@Singleton
public class FileMappingUtil {

public static final String EXPERIMENT_TEMPLATE_NAME = "ExperimentsTemplateMap";
private FileImportService fileImportService;


@Inject
public FileMappingUtil(FileImportService fileImportService) {
this.fileImportService = fileImportService;
public FileMappingUtil() {
}

// Returns a list of integers to identify the target row of the relationship. -1 if no relationship was found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public enum Workflow {
*/
NEW_OBSERVATION("new-experiment","Create new experiment"),


/**
* Represents an append or overwrite workflow where experimental dataset is appended.
* ID: "append-dataset"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public Optional<ImportWorkflowResult> process(ImportServiceContext context) {
.build());

// Skip this workflow unless appending or overwriting observation data
if (context != null && !this.workflow.isEqual(context.getWorkflow())) {
if (context != null && !this.workflow.isEqual(context.getWorkflowId())) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import java.util.List;
import java.util.Map;

// TODO: move to common higher level location
// TODO: move to common higher level location, could be used by both append and create workflows so being located
// in the create namespace won't make sense if we decide to do that in the future.
@Getter
@Setter
@Builder
Expand Down
Loading