private String addSiblingTag(String parentAlias, DetailedSample sample) throws IOException { SampleClass sc = sample.getSampleClass(); if (sc == null || sc.getSuffix() == null) { throw new InvalidParameterException("Unexpected null SampleClass or suffix"); } String partialAlias = parentAlias + SEPARATOR + sc.getSuffix(); if (sample.getSiblingNumber() == null) { if (siblingNumberGenerator == null) { throw new IllegalStateException("No SiblingNumberGenerator configured"); } sample.setSiblingNumber(siblingNumberGenerator.getNextSiblingNumber(SampleImpl.class, partialAlias)); } String siblingNum = sample.getSiblingNumber().toString(); // Sibling number is only padded for Tissue Processing if (isTissueProcessingSample(sample)) { while (siblingNum.length() < 2) siblingNum = "0" + siblingNum; } return partialAlias + siblingNum; }
@Override public void update(SampleClass sampleClass) throws IOException { authorizationManager.throwIfNonAdmin(); SampleClass updatedSampleClass = get(sampleClass.getId()); updatedSampleClass.setAlias(sampleClass.getAlias()); updatedSampleClass.setSampleCategory(sampleClass.getSampleCategory()); updatedSampleClass.setSuffix(sampleClass.getSuffix()); updatedSampleClass.setDNAseTreatable(sampleClass.getDNAseTreatable()); User user = authorizationManager.getCurrentUser(); updatedSampleClass.setUpdatedBy(user); sampleClassDao.update(updatedSampleClass); }
public static SampleClassDto asDto(@Nonnull SampleClass from) { SampleClassDto dto = new SampleClassDto(); dto.setId(from.getId()); dto.setAlias(from.getAlias()); dto.setSampleCategory(from.getSampleCategory()); dto.setSuffix(from.getSuffix()); dto.setArchived(from.isArchived()); dto.setDirectCreationAllowed(from.isDirectCreationAllowed()); dto.setCreatedById(from.getCreatedBy().getUserId()); dto.setCreationDate(formatDateTime(from.getCreationDate())); dto.setUpdatedById(from.getUpdatedBy().getUserId()); dto.setLastUpdated(formatDateTime(from.getLastUpdated())); dto.setDNAseTreatable(from.getDNAseTreatable()); return dto; }