use of uk.ac.ebi.spot.goci.model.deposition.DepositionAuthor in project goci by EBISPOT.
the class SubmissionController method buildSubmission.
private Submission buildSubmission(DepositionSubmission depositionSubmission) {
Submission testSub = new Submission();
testSub.setId(depositionSubmission.getSubmissionId());
testSub.setImportStatus(Submission.ImportStatus.NOT_READY);
if (depositionSubmission.getPublication() != null) {
testSub.setPubMedID(depositionSubmission.getPublication().getPmid());
testSub.setAuthor(depositionSubmission.getPublication().getFirstAuthor());
testSub.setCurator(depositionSubmission.getCreated().getUser().getName());
testSub.setStatus(depositionSubmission.getStatus());
testSub.setTitle(depositionSubmission.getPublication().getTitle());
testSub.setJournal(depositionSubmission.getPublication().getJournal());
testSub.setCreated(depositionSubmission.getCreated().getTimestamp().toString(DateTimeFormat.forPattern("yyyy-MM-dd")));
testSub.setPublicationStatus(depositionSubmission.getPublication().getStatus());
testSub.setSubmissionType(DepositionUtil.getSubmissionType(depositionSubmission));
testSub.setPublicationDate(depositionSubmission.getPublication().getPublicationDate());
if (depositionSubmission.getPublication().getCorrespondingAuthor() != null) {
DepositionAuthor author = depositionSubmission.getPublication().getCorrespondingAuthor();
if (author.getGroup() != null) {
testSub.setCorrespondingAuthor(author.getGroup());
} else {
testSub.setCorrespondingAuthor(author.getFirstName() + ' ' + author.getLastName());
}
}
if (testSub.getSubmissionType().equals(Submission.SubmissionType.UNKNOWN)) {
testSub.setStatus("REVIEW");
}
} else if (depositionSubmission.getBodyOfWork() != null) {
if (depositionSubmission.getBodyOfWork().getFirstAuthor() != null) {
if (depositionSubmission.getBodyOfWork().getFirstAuthor().getGroup() != null) {
testSub.setAuthor(depositionSubmission.getBodyOfWork().getFirstAuthor().getGroup());
} else {
testSub.setAuthor(depositionSubmission.getBodyOfWork().getFirstAuthor().getFirstName() + ' ' + depositionSubmission.getBodyOfWork().getFirstAuthor().getLastName());
}
}
if (depositionSubmission.getBodyOfWork().getCorrespondingAuthors() != null) {
DepositionAuthor author = depositionSubmission.getBodyOfWork().getCorrespondingAuthors().get(0);
if (author.getGroup() != null) {
testSub.setCorrespondingAuthor(author.getGroup());
} else {
testSub.setCorrespondingAuthor(author.getFirstName() + ' ' + author.getLastName());
}
}
testSub.setStatus(depositionSubmission.getStatus());
testSub.setTitle(depositionSubmission.getBodyOfWork().getTitle());
testSub.setJournal(depositionSubmission.getBodyOfWork().getJournal());
testSub.setCreated(depositionSubmission.getCreated().getTimestamp().toString(DateTimeFormat.forPattern("yyyy-MM-dd")));
testSub.setPublicationStatus(depositionSubmission.getBodyOfWork().getStatus());
testSub.setSubmissionType(DepositionUtil.getSubmissionType(depositionSubmission));
if (testSub.getSubmissionType().equals(Submission.SubmissionType.UNKNOWN)) {
testSub.setStatus("REVIEW");
}
}
boolean importInProgress = submissionImportProgressService.importInProgress(depositionSubmission.getSubmissionId());
if (importInProgress) {
testSub.setStatus("IMPORT_IN_PROGRESS");
}
if (testSub.getStatus().equalsIgnoreCase("SUBMITTED") && !testSub.getSubmissionType().equals(Submission.SubmissionType.PRE_PUBLISHED) && !testSub.getSubmissionType().equals(Submission.SubmissionType.UNKNOWN)) {
testSub.setImportStatus(Submission.ImportStatus.READY);
}
return testSub;
}
Aggregations