@Override public String getLabel(Specimen specimen) { String ppid = specimen.getVisit().getRegistration().getPpid(); while (specimen.isAliquot() || specimen.isDerivative()) { specimen = specimen.getParentSpecimen(); } Calendar cal = Calendar.getInstance(); SpecimenCollectionEvent collEvent = specimen.getCollectionEvent(); if (collEvent != null) { cal.setTime(collEvent.getTime()); } else if (specimen.getCreatedOn() != null) { cal.setTime(specimen.getCreatedOn()); } int yoc = cal.get(Calendar.YEAR); String key = ppid + "_" + yoc; Long uniqueId = daoFactory.getUniqueIdGenerator().getUniqueId(name, key); return uniqueId.toString(); }
@Override public String getNextTrid() { return TRID_PREFIX + daoFactory.getUniqueIdGenerator().getUniqueId("TRID", "SGH"); }