return getPseudoSubmission(magicSubmissionStudyName);
}
public static Submission getPseudoSubmission(String name) {
if (pseudoSubmission == null) {
StudyHome sh = ContextManager.getStudyHome();
SubmissionService ss = ContextManager.getSubmissionService();
Collection<Study> pseudoStudies = sh.findByName(name, true);
if (pseudoStudies.size() == 0) {
pseudoSubmission = ss.createSubmission(null, null);
pseudoSubmission.getStudy().setName(name);
ss.save(pseudoSubmission.getStudy());
sh.flush();
} else if (pseudoStudies.size() == 1) {
Study pseudoStudy = pseudoStudies.iterator().next();
pseudoSubmission = pseudoStudy.getSubmission();
} else {
return null;