Source:
public long saveProject(Project project) throws IOException { authorizationManager.throwIfNotWritable(project); if (projectStore != null) { ValidationResult shortNameValidation = namingScheme.validateProjectShortName(project.getShortName()); if (!shortNameValidation.isValid()) { throw new IOException("Cannot save project - invalid shortName: " + shortNameValidation.getMessage()); } if (project.getId() == ProjectImpl.UNSAVED_ID) { resolveMembers(project.getSecurityProfile()); project.setName(generateTemporaryName()); projectStore.save(project); try { project.setName(namingScheme.generateNameFor(project)); } catch (MisoNamingException e) { throw new IOException("Cannot save Project - issue with naming scheme", e); } LimsUtils.validateNameOrThrow(project, namingScheme); } else { Project original = projectStore.get(project.getId()); original.setAlias(project.getAlias()); original.setDescription(project.getDescription()); original.setIssueKeys(project.getIssueKeys()); original.setLastUpdated(project.getLastUpdated()); original.setProgress(project.getProgress()); original.setReferenceGenome(referenceGenomeDao.getReferenceGenome(project.getReferenceGenome().getId())); original.setShortName(project.getShortName()); for (ProjectOverview po : project.getOverviews()) { if (po.getId() == ProjectOverview.UNSAVED_ID) { original.getOverviews().add(po); } } updateSecurityProfile(original.getSecurityProfile(), project.getSecurityProfile()); project = original; } project.getSecurityProfile().setProfileId(saveSecurityProfile(project.getSecurityProfile())); long id = projectStore.save(project); return id; } else { throw new IOException("No projectStore available. Check that it has been declared in the Spring config."); } }

Target:
public long saveProject(Project project) throws IOException { ValidationResult shortNameValidation = namingScheme.validateProjectShortName(project.getShortName()); if (!shortNameValidation.isValid()) { throw new IOException("Cannot save project - invalid shortName: " + shortNameValidation.getMessage()); } if (project.getId() == ProjectImpl.UNSAVED_ID) { resolveMembers(project.getSecurityProfile()); project.setName(generateTemporaryName()); projectStore.save(project); try { project.setName(namingScheme.generateNameFor(project)); } catch (MisoNamingException e) { throw new IOException("Cannot save Project - issue with naming scheme", e); } LimsUtils.validateNameOrThrow(project, namingScheme); } else { Project original = projectStore.get(project.getId()); authorizationManager.throwIfNotWritable(original); original.setAlias(project.getAlias()); original.setDescription(project.getDescription()); original.setIssueKeys(project.getIssueKeys()); original.setLastUpdated(new Date()); original.setProgress(project.getProgress()); original.setReferenceGenome(referenceGenomeDao.getReferenceGenome(project.getReferenceGenome().getId())); original.setShortName(project.getShortName()); for (ProjectOverview po : project.getOverviews()) { if (po.getId() == ProjectOverview.UNSAVED_ID) { original.getOverviews().add(po); } } updateSecurityProfile(original.getSecurityProfile(), project.getSecurityProfile()); project = original; } project.getSecurityProfile().setProfileId(saveSecurityProfile(project.getSecurityProfile())); long id = projectStore.save(project); return id; }