Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCRUM-4175 (update) Return assembly name so available for association loads #1620

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -120,7 +120,7 @@ private Map<String, List<Long>> runLoad(BulkLoadFileHistory history, List<String
ph.addDisplayHandler(loadProcessDisplayService);
ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 2) + 1);

loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph);
assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph);
idsAdded = loadEntities(history, gffData, idsAdded, dataProvider, ph);
idsAdded = loadAssociations(history, gffData, idsAdded, dataProvider, assemblyId, ph);

Expand All @@ -143,9 +143,9 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List
return new LoadHistoryResponce(history);
}

private void loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List<String> gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) {
private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List<String> gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) {
try {
gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider);
assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider);
history.incrementCompleted();
} catch (ObjectUpdateException e) {
history.incrementFailed();
Expand All @@ -157,6 +157,8 @@ private void loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history
}
updateHistory(history);
ph.progressProcess();

return assemblyName;
}

private Map<String, List<Long>> loadEntities(BulkLoadFileHistory history, List<Gff3DTO> gffData, Map<String, List<Long>> idsAdded,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Gff3Service {
@Inject Gff3DtoValidator gff3DtoValidator;

@Transactional
public void loadGenomeAssembly(String assemblyName, List<String> gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException {
public String loadGenomeAssembly(String assemblyName, List<String> gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException {

if (StringUtils.isBlank(assemblyName)) {
for (String header : gffHeaderData) {
Expand All @@ -76,6 +76,8 @@ public void loadGenomeAssembly(String assemblyName, List<String> gffHeaderData,

genomeAssemblyDAO.persist(assembly);
}

return assemblyName;
} else {
throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE);
}
Expand Down Expand Up @@ -106,7 +108,7 @@ public Map<String, List<Long>> loadEntity(BulkLoadFileHistory history, Gff3DTO g

@Transactional
public Map<String, List<Long>> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map<String, List<Long>> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ObjectUpdateException {
if (StringUtils.isEmpty(assemblyId)) {
if (StringUtils.isBlank(assemblyId)) {
throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly");
}

Expand Down
Loading